… | |
… | |
70 | NULL); |
70 | NULL); |
71 | |
71 | |
72 | if (FcPatternGetDouble (pattern, FC_PIXEL_SIZE, 0, &d) == FcResultMatch) |
72 | if (FcPatternGetDouble (pattern, FC_PIXEL_SIZE, 0, &d) == FcResultMatch) |
73 | font->size = d * PANGO_SCALE; |
73 | font->size = d * PANGO_SCALE; |
74 | |
74 | |
|
|
75 | #if PANGO_VERSION_CHECK (1, 16, 0) |
|
|
76 | /* pango 1.24 is ABI-incompatible with 1.22, but distros */ |
|
|
77 | /* usually package it under the same name, so a runtime check */ |
|
|
78 | /* is required */ |
|
|
79 | /* unfortunately, pango doesn't support runtime checks in < 1.16 */ |
|
|
80 | /* so there is no real way to ensure binary compatibility portably */ |
|
|
81 | /* great move, pango */ |
|
|
82 | if (pango_version () > PANGO_VERSION_ENCODE (1, 23, 0)) |
|
|
83 | PANGO_FC_FONT (font)->fontmap = fontmap; |
|
|
84 | #endif |
|
|
85 | |
75 | return font; |
86 | return font; |
76 | } |
87 | } |
77 | |
88 | |
78 | static void |
89 | static void |
79 | load_fallback_face (PangoOpenGLFont *font, const char *original_file) |
90 | load_fallback_face (PangoOpenGLFont *font, const char *original_file) |
… | |
… | |
101 | goto bail1; |
112 | goto bail1; |
102 | |
113 | |
103 | error = FT_New_Face (_pango_opengl_font_map_get_library (fcfont->fontmap), |
114 | error = FT_New_Face (_pango_opengl_font_map_get_library (fcfont->fontmap), |
104 | (char *) filename2, id, &font->face); |
115 | (char *) filename2, id, &font->face); |
105 | |
116 | |
106 | |
|
|
107 | if (error) |
117 | if (error) |
108 | { |
118 | { |
109 | bail1: |
119 | bail1: |
110 | name = pango_font_description_to_string (fcfont->description); |
120 | name = pango_font_description_to_string (fcfont->description); |
111 | g_warning ("Unable to open font file %s for font %s, exiting\n", filename2, name); |
121 | g_warning ("Unable to open font file %s for font %s, exiting\n", filename2, name); |
… | |
… | |
217 | font->size = 0; |
227 | font->size = 0; |
218 | font->glyph_info = g_hash_table_new (NULL, NULL); |
228 | font->glyph_info = g_hash_table_new (NULL, NULL); |
219 | } |
229 | } |
220 | |
230 | |
221 | static void |
231 | static void |
222 | pango_opengl_font_class_init (PangoOpenGLFontClass *class) |
232 | pango_opengl_font_class_init (PangoOpenGLFontClass *klass) |
223 | { |
233 | { |
224 | GObjectClass *object_class = G_OBJECT_CLASS (class); |
234 | GObjectClass *object_class = G_OBJECT_CLASS (klass); |
225 | PangoFontClass *font_class = PANGO_FONT_CLASS (class); |
235 | PangoFontClass *font_class = PANGO_FONT_CLASS (klass); |
226 | PangoFcFontClass *fc_font_class = PANGO_FC_FONT_CLASS (class); |
236 | PangoFcFontClass *fc_font_class = PANGO_FC_FONT_CLASS (klass); |
227 | |
237 | |
228 | object_class->finalize = pango_opengl_font_finalize; |
238 | object_class->finalize = pango_opengl_font_finalize; |
229 | |
239 | |
230 | font_class->get_glyph_extents = pango_opengl_font_get_glyph_extents; |
240 | font_class->get_glyph_extents = pango_opengl_font_get_glyph_extents; |
231 | |
241 | |
… | |
… | |
238 | { |
248 | { |
239 | PangoOpenGLFont *font = (PangoOpenGLFont *)font_; |
249 | PangoOpenGLFont *font = (PangoOpenGLFont *)font_; |
240 | PangoFcFont *fcfont = (PangoFcFont *)font; |
250 | PangoFcFont *fcfont = (PangoFcFont *)font; |
241 | PangoOpenGLGlyphInfo *info; |
251 | PangoOpenGLGlyphInfo *info; |
242 | |
252 | |
243 | info = g_hash_table_lookup (font->glyph_info, GUINT_TO_POINTER (glyph)); |
253 | info = (PangoOpenGLGlyphInfo *)g_hash_table_lookup (font->glyph_info, GUINT_TO_POINTER (glyph)); |
244 | |
254 | |
245 | if ((info == NULL) && create) |
255 | if ((info == NULL) && create) |
246 | { |
256 | { |
247 | info = g_slice_new0 (PangoOpenGLGlyphInfo); |
257 | info = g_slice_new0 (PangoOpenGLGlyphInfo); |
248 | |
258 | |
… | |
… | |
378 | |
388 | |
379 | static gboolean |
389 | static gboolean |
380 | pango_opengl_free_glyph_info_callback (gpointer key, gpointer value, gpointer data) |
390 | pango_opengl_free_glyph_info_callback (gpointer key, gpointer value, gpointer data) |
381 | { |
391 | { |
382 | PangoOpenGLFont *font = PANGO_OPENGL_FONT (data); |
392 | PangoOpenGLFont *font = PANGO_OPENGL_FONT (data); |
383 | PangoOpenGLGlyphInfo *info = value; |
393 | PangoOpenGLGlyphInfo *info = (PangoOpenGLGlyphInfo *)value; |
384 | |
394 | |
385 | if (font->glyph_cache_destroy && info->cached_glyph) |
395 | if (font->glyph_cache_destroy && info->cached_glyph) |
386 | (*font->glyph_cache_destroy) (info->cached_glyph); |
396 | (*font->glyph_cache_destroy) (info->cached_glyph); |
387 | |
397 | |
388 | g_slice_free (PangoOpenGLGlyphInfo, info); |
398 | g_slice_free (PangoOpenGLGlyphInfo, info); |