summaryrefslogtreecommitdiff
path: root/navit/font/freetype
diff options
context:
space:
mode:
authormartin-s <martin-s@ffa7fe5e-494d-0410-b361-a75ebd5db220>2009-01-06 15:08:58 +0000
committermartin-s <martin-s@ffa7fe5e-494d-0410-b361-a75ebd5db220>2009-01-06 15:08:58 +0000
commit3f9049391c10c1df8de52571d3705431aceb4dd1 (patch)
tree942616effa25050528e7a5ce5e8df87cb4dc2315 /navit/font/freetype
parente64ac9576858aef45e327ea7fd127cd95e2ac729 (diff)
downloadnavit-3f9049391c10c1df8de52571d3705431aceb4dd1.tar.gz
Fix:font_freetype:Make workable with older freetype versions
git-svn-id: http://svn.code.sf.net/p/navit/code/trunk/navit@1905 ffa7fe5e-494d-0410-b361-a75ebd5db220
Diffstat (limited to 'navit/font/freetype')
-rw-r--r--navit/font/freetype/font_freetype.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/navit/font/freetype/font_freetype.c b/navit/font/freetype/font_freetype.c
index 6bb4ff87f..86363ba94 100644
--- a/navit/font/freetype/font_freetype.c
+++ b/navit/font/freetype/font_freetype.c
@@ -16,10 +16,18 @@
#include "atom.h"
#include "font_freetype.h"
+#if FREETYPE_MAJOR > 2 || FREETYPE_MINOR > 3 || FREETYPE_PATCH > 4
+#define HAVE_LOOKUP_SCALER
+#endif
+
struct font_freetype_font {
int size;
#ifdef USE_CACHING
+#ifdef HAVE_LOOKUP_SCALER
FTC_ScalerRec scaler;
+#else
+ FTC_ImageTypeRec scaler;
+#endif
int charmap_index;
#else
FT_Face face;
@@ -87,7 +95,11 @@ font_freetype_get_text_bbox(struct graphics_priv *gr,
FTC_Node anode = NULL;
glyph_index = FTC_CMapCache_Lookup(charmap_cache, font->scaler.face_id, font->charmap_index, g_utf8_get_char(p));
FT_Glyph cached_glyph;
+#ifdef HAVE_LOOKUP_SCALER
FTC_ImageCache_LookupScaler(image_cache, &font->scaler, FT_LOAD_DEFAULT, glyph_index, &cached_glyph, &anode);
+#else
+ FTC_ImageCache_Lookup(image_cache, &font->scaler, glyph_index, &cached_glyph, &anode);
+#endif
FT_Glyph_Copy(cached_glyph, &glyph);
FT_Glyph_Transform(glyph, &matrix, &pen);
#else
@@ -178,7 +190,11 @@ font_freetype_text_new(char *text, struct font_freetype_font *font, int dx,
FTC_Node anode=NULL;
FT_Glyph cached_glyph;
glyph_index = FTC_CMapCache_Lookup(charmap_cache, font->scaler.face_id, font->charmap_index, g_utf8_get_char(p));
+#ifdef HAVE_LOOKUP_SCALER
FTC_ImageCache_LookupScaler(image_cache, &font->scaler, FT_LOAD_DEFAULT, glyph_index, &cached_glyph, &anode);
+#else
+ FTC_ImageCache_Lookup(image_cache, &font->scaler, glyph_index, &cached_glyph, &anode);
+#endif
FT_Glyph_Copy(cached_glyph, &glyph);
FT_Glyph_Transform(glyph, &matrix, &pen);
FT_Glyph_To_Bitmap(&glyph, ft_render_mode_normal, NULL, TRUE);
@@ -385,11 +401,17 @@ font_freetype_font_new(struct graphics_priv *gr,
idstr=g_strdup_printf("%s/%d", fontfile, fontindex);
font->scaler.face_id=(FTC_FaceID)atom(idstr);
g_free(idstr);
+#ifdef HAVE_LOOKUP_SCALER
font->scaler.width=0;
font->scaler.height=size;
font->scaler.pixel=0;
font->scaler.x_res=300;
font->scaler.y_res=300;
+#else
+ font->scaler.width=size/15;
+ font->scaler.height=size/15;
+ font->scaler.flags=FT_LOAD_DEFAULT;
+#endif
FTC_Manager_LookupFace(manager, font->scaler.face_id, &face);
font->charmap_index=face->charmap ? FT_Get_Charmap_Index(face->charmap) : 0;
#else