| Summary: | Improve SDL_ttf glyph cache system | ||
|---|---|---|---|
| Product: | SDL_ttf | Reporter: | Sylvain <sylvain.becker> |
| Component: | misc | Assignee: | Sam Lantinga <slouken> |
| Status: | RESOLVED FIXED | QA Contact: | Sam Lantinga <slouken> |
| Severity: | normal | ||
| Priority: | P2 | ||
| Version: | unspecified | ||
| Hardware: | x86_64 | ||
| OS: | Linux | ||
| Attachments: |
patch
patch updated |
||
|
Description
Sylvain
2018-10-12 13:47:01 UTC
Created attachment 3368 [details]
patch
Update: I was too optimistic when I said it would reduce number of collisions when caching glyphs, hence, be more efficient. In fact, I took into account the initialisation of cache, because it calls "Flush_Glyph" the first time for Glyph cache system. I was mistaken. In the end, it seems to be the same. Maybe a little bit less of collision with Index, when using Arabic or Chinese, but this is minimal and that can also be my test-case. But, in favour of the patch =========================== Using Index instead of Glyph is a better option to ease the integration of a text shaping engine into SDL_ttf (like in bug 3046 and bug 3211). It also doesn't break current SDL_ttf. This way, SDL_ttf can have in the future a function to render an array of indexes e.g: SDL_Surface *TTF_RenderINDEX_Solid(TTF_Font *font, int *indexes, int nb_indexes, SDL_Color fg); Where (indexes, nb_indexes) would be produced by a text shaping engine. Having a text shaping engine is essential to render text correctly. To be picky, even English language needs it to render ligatures like "fi". https://en.wikipedia.org/wiki/Typographic_ligature https://en.wikipedia.org/wiki/Typographic_ligature#/media/File:Ligatures.svg Can you rebase this patch on the current code in Mercurial? Thanks! Created attachment 3436 [details]
patch updated
I've updated the patch and changed it a little bit.
(no need to have twice the index in the cache slot!)
Patch added, thanks! https://hg.libsdl.org/SDL_ttf/rev/1fc2b16737da |