[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[ft] Using the freetype ImageCache for 2D graphics rendering
From: |
Florian Hackenberger |
Subject: |
[ft] Using the freetype ImageCache for 2D graphics rendering |
Date: |
Wed, 3 Sep 2008 22:06:49 +0200 |
User-agent: |
KMail/1.9.10 |
Hi!
First of all: Thank you for your great work! GNU/Linux would be unusable
without your excellent library (but you probably know that :-) ).
Could someone please explain how I can use the ImageCache to obtain
glyphs in a bitmap format to avoid rerendering the vector glyph on each
cache lookup? I still need to be able to transform the copy after
retrieving it from the cache and it would be very convenient if I could
use freetype for this transformation (as I do below).
The application (navit) uses mostly glyphs from one font in one size,
but with various transformations applied.
Cheers,
Florian
Here is the current code (which is quite slow as it seems to rerender
the vector glyph on each cache lookup):
FT_Face face = NULL;
FT_Glyph glyph = NULL;
FTC_Node anode = NULL;
FTC_Manager_LookupFace( font->manager, (FT_Pointer)font, &face);
glyph_index = FTC_CMapCache_Lookup( font->charmap_cache,
(FT_Pointer)font, font->charmap_index, g_utf8_get_char(p));
FTC_ImageCache_LookupScaler( font->image_cache, &font->scaler,
FT_LOAD_DEFAULT, glyph_index, &glyph, &anode);
FT_Glyph temp_glyph = NULL;
FT_BitmapGlyph glyph_bitmap = NULL;
if(FT_Glyph_Copy(glyph, &temp_glyph)) {
fprintf(stderr, "Error copying glyph\n");
FTC_Node_Unref(anode, font->manager);
continue;
}
FT_Glyph_Transform(temp_glyph, &matrix, &pen);
if(!FT_Glyph_To_Bitmap(&temp_glyph, ft_render_mode_normal, NULL, TRUE))
{
glyph_bitmap = (FT_BitmapGlyph)temp_glyph;
/* COPY GLYPH TO BITMAP */
FT_Done_Glyph(temp_glyph);
}
--
DI Florian Hackenberger
address@hidden
www.hackenberger.at
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [ft] Using the freetype ImageCache for 2D graphics rendering,
Florian Hackenberger <=