| Summary: | Broken cache of glyphs [patch] | ||
|---|---|---|---|
| Product: | SDL_ttf | Reporter: | Peter Kosyh <gl00my> |
| Component: | misc | Assignee: | Sam Lantinga <slouken> |
| Status: | RESOLVED FIXED | QA Contact: | Sam Lantinga <slouken> |
| Severity: | major | ||
| Priority: | P2 | ||
| Version: | 2.0.10 | ||
| Hardware: | All | ||
| OS: | All | ||
| Attachments: | Patch | ||
Created attachment 552 [details]
Patch
Forgotten patch attached. :)
I'm looking at the possibility of bundling SDL_ttf with the commercial license option for SDL 1.3. Do you give me permission to release your contributions to SDL_ttf under both the LGPL and a closed-source commercial license? Thanks! (In reply to comment #2) > I'm looking at the possibility of bundling SDL_ttf with the commercial > license option for SDL 1.3. > > Do you give me permission to release your contributions to SDL_ttf > under both the LGPL and a closed-source commercial license? > > Thanks! Yes, you can use this patch as you want. Thanks, your patch has been added! http://hg.libsdl.org/SDL_ttf/rev/a6e04cc57348 |
It's like that cache of glyphs works only with symbols with codes <= 255. Se the code in SDL_ttf.c: static FT_Error Find_Glyph( TTF_Font* font, Uint16 ch, int want ) { int retval = 0; if( ch < 256 ) { /* here it is. very strange approach! */ font->current = &font->cache[ch]; } else { It is too bad, because leads to very high cpu load on slow machines. Here is a tiny patch, that makes cache more clever and speed up non english languages rendering about 50 times in my project (build wince, s60, android). The idea is trivial: static FT_Error Find_Glyph( TTF_Font* font, Uint16 ch, int want ) { int retval = 0; int hsize = sizeof( font->cache ) / sizeof( font->cache[0] ); int h = ch % hsize; font->current = &font->cache[h]; if (font->current->cached != ch) Flush_Glyph( font->current ); I hope (it is too hard to support own version of SDL_ttf), you will include this patch, or i can write more clever cache logic (built on list/hash).