efficiency of freetype?
Posted: Sat Jun 04, 2016 11:07 am
Do any of your GUIs use FreeType for text rendering? If so, how efficient is it?
I have seen some advice on the Internet claiming that FreeType can be extremely inefficient, and they recommended using it to pre-render the characters you want to use, and then reuse the cached bitmaps.
My window manager re-renders all windows (including their captions) whenever the screen is changed (e.g. the mouse moves). (Note however, that the contents of each window are not re-drawn; they are stored in a buffer until an application updates it, and the manager just blits them to the screen during the update). Currently, if I move the mouse, and I'm using FreeType to render the captions, it takes a few seconds for the screen to respond. But since this problem does not occur when I type, I;m assuming it's most probably to do with bad contention issues as spinlocks (instead of mutexes, which I have not yet implemented in userspace, but I'm on it), are used to lock the window list, the cursor positon etc.
Either way, I just wanted to ask who uses FreeType in their GUIs for rendering text, and if there are any recommendations on how to use it efficiently. Currently my system works as follows: an application that wants to draw text creates a Pen object; this initialises FreeType and stores the FT_Library handle in the Pen object, then it loads the default font (as an FT_Face), and the application can make calls to write text using the pen, chaning the font etc inbetween segments if necessary, and the graphics library lays out the text. Every time the screen freezes, I can see the HDD read LED (the virtual one, in VirtualBox) is on, so I think it might also be that re-reading the font on each redraw is not the best idea.
I have seen some advice on the Internet claiming that FreeType can be extremely inefficient, and they recommended using it to pre-render the characters you want to use, and then reuse the cached bitmaps.
My window manager re-renders all windows (including their captions) whenever the screen is changed (e.g. the mouse moves). (Note however, that the contents of each window are not re-drawn; they are stored in a buffer until an application updates it, and the manager just blits them to the screen during the update). Currently, if I move the mouse, and I'm using FreeType to render the captions, it takes a few seconds for the screen to respond. But since this problem does not occur when I type, I;m assuming it's most probably to do with bad contention issues as spinlocks (instead of mutexes, which I have not yet implemented in userspace, but I'm on it), are used to lock the window list, the cursor positon etc.
Either way, I just wanted to ask who uses FreeType in their GUIs for rendering text, and if there are any recommendations on how to use it efficiently. Currently my system works as follows: an application that wants to draw text creates a Pen object; this initialises FreeType and stores the FT_Library handle in the Pen object, then it loads the default font (as an FT_Face), and the application can make calls to write text using the pen, chaning the font etc inbetween segments if necessary, and the graphics library lays out the text. Every time the screen freezes, I can see the HDD read LED (the virtual one, in VirtualBox) is on, so I think it might also be that re-reading the font on each redraw is not the best idea.