[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[ft] My experiments with FreeType cache.
From: |
John Found |
Subject: |
[ft] My experiments with FreeType cache. |
Date: |
Fri, 20 Feb 2015 22:15:14 +0200 |
After some experiments with the FreeType cache sub-system, I was able to
produce some working code.
Well, I think is it "working", only because the text rendering speed raised
more than five times.
But is it really OK?
What I am doing is:
At first, I defined my own structure "TFont" to keep the string with the font
name in format for FontConfig and the needed font height. The address of this
structure will be the Face_ID for the cache manager.
The FT_Face_Requester procedure using the from the Face_ID calls the FontConfig
functions in the following order:
1. FcNameParse
2. FcConfigSubstitute
3. FcDefaultSubstitute
4. FcFontMatch
5. FcPatternGetString, ..., FC_FILE,...
5. FcPatternGetInteger, ..., FC_INDEX,...
After obtaining the font filename and the face index, the requester creates the
face object calling:
7. FT_New_Face ...
8. FT_Set_Pixel_Sizes - from the passed Face_ID structure.
Thus created face is returned to the caller.
In the procedure that renders the text the string loop looks following way:
1. Decode one UTF-8 character.
2. FT_Get_Char_Index
3. FTC_ImageCache_Lookup (with FT_LOAD_RENDER in the FT_Image_type.flags and
the height of the font in the .height arguments)
4. DrawGlyph the returned FT_BitmapGlyphRec.bitmap image (it is my custom
procedure, that draws the bitmap in color)
5. goto 1
What I am doing wrong?
The full source (x86 assembly language) can be seen here:
http://fresh.flatassembler.net/fossil/repo/fresh/info/812dc7?ln=17-169
Notice, that it is still a draft and misses any error checking.
I hope I didn't miss something important.
Best Regards.
--
John Found <address@hidden>
- [ft] My experiments with FreeType cache.,
John Found <=