Yuking 0 Posted February 20, 2003 I wrote a small test program using XFT rendering fonts. 'ps -aux' shows it used ~18M mem, why so terrible? thanks very much! Share this post Link to post
gfolkert 0 Posted February 20, 2003 As to what your program actually does... I am guessing you are displaying all your fonts you have installed.... Okay, guess what XFT only uses what it needs to cache the rendering info it needs to render the fonts in your program... each font requires a certain amount... so if you were showing *ALL* the fonts... then *ALL* the currently in use fonts are cached... And, BTW, I have ~2000 fonts installed on my mahcine... for publishing and such. A wide array, PS Type1 and TT Fonts combined... if I were to Display all the fonts at the same time... well, XFT would take ~260MB... Hope this helps... Share this post Link to post
Yuking 0 Posted February 20, 2003 Here is my codes: ----------------------------------------------- ...... XftPatternAddString (pattern, "family", myFont); XftPatternAddInteger (pattern, "pixelsize", 14); XftPatternAddBool (pattern, "antialias", 1); XftColorAllocName (dpy, DefaultVisual (dpy, DefaultScreen (dpy)), DefaultColormap (dpy, DefaultScreen (dpy)), "black", &color); xftFont = XftFontOpenPattern (dpy, XftFontMatch (dpy, iScreen, pattern, &result)); xftDraw = XftDrawCreate (dpy, myWindow, DefaultVisual (dpy, DefaultScreen (dpy)), DefaultColormap (dpy, DefaultScreen (dpy))); ...... ----------------------------------------------- myFont is string referring to a Chinese font (simsun). If I chang myFont to another font, such as "courier", all are OK! Does XFT load the whole font file into mem? The size of "simsun" is about 10M. Share this post Link to post
gfolkert 0 Posted February 21, 2003 If it is being referenced... on screen or in the rendering engine for "X" then yes is has to load the whole thing... There is no partial caching of the info for a particiular font. Look at it this way, Let's say you want to run the dreaded Microsoft word... which is a huge pig for memory. But you only want to use it for text editing... and saving to ASCII. You get the WHOLE thing... not just the TEXT editing part. So, needless to say, it does read the whole file... it has to be ready to encode to the Rendering engine all the info *ANY* character in the font... even if you NEVER display but one character. Hope this helps! If not, questions posted publically will be answered... private messages will be ignored. Share this post Link to post