… | |
… | |
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) |
… | |
… | |
216 | font->size = 0; |
227 | font->size = 0; |
217 | font->glyph_info = g_hash_table_new (NULL, NULL); |
228 | font->glyph_info = g_hash_table_new (NULL, NULL); |
218 | } |
229 | } |
219 | |
230 | |
220 | static void |
231 | static void |
221 | pango_opengl_font_class_init (PangoOpenGLFontClass *class) |
232 | pango_opengl_font_class_init (PangoOpenGLFontClass *klass) |
222 | { |
233 | { |
223 | GObjectClass *object_class = G_OBJECT_CLASS (class); |
234 | GObjectClass *object_class = G_OBJECT_CLASS (klass); |
224 | PangoFontClass *font_class = PANGO_FONT_CLASS (class); |
235 | PangoFontClass *font_class = PANGO_FONT_CLASS (klass); |
225 | PangoFcFontClass *fc_font_class = PANGO_FC_FONT_CLASS (class); |
236 | PangoFcFontClass *fc_font_class = PANGO_FC_FONT_CLASS (klass); |
226 | |
237 | |
227 | object_class->finalize = pango_opengl_font_finalize; |
238 | object_class->finalize = pango_opengl_font_finalize; |
228 | |
239 | |
229 | font_class->get_glyph_extents = pango_opengl_font_get_glyph_extents; |
240 | font_class->get_glyph_extents = pango_opengl_font_get_glyph_extents; |
230 | |
241 | |
… | |
… | |
237 | { |
248 | { |
238 | PangoOpenGLFont *font = (PangoOpenGLFont *)font_; |
249 | PangoOpenGLFont *font = (PangoOpenGLFont *)font_; |
239 | PangoFcFont *fcfont = (PangoFcFont *)font; |
250 | PangoFcFont *fcfont = (PangoFcFont *)font; |
240 | PangoOpenGLGlyphInfo *info; |
251 | PangoOpenGLGlyphInfo *info; |
241 | |
252 | |
242 | 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)); |
243 | |
254 | |
244 | if ((info == NULL) && create) |
255 | if ((info == NULL) && create) |
245 | { |
256 | { |
246 | info = g_slice_new0 (PangoOpenGLGlyphInfo); |
257 | info = g_slice_new0 (PangoOpenGLGlyphInfo); |
247 | |
258 | |
… | |
… | |
377 | |
388 | |
378 | static gboolean |
389 | static gboolean |
379 | 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) |
380 | { |
391 | { |
381 | PangoOpenGLFont *font = PANGO_OPENGL_FONT (data); |
392 | PangoOpenGLFont *font = PANGO_OPENGL_FONT (data); |
382 | PangoOpenGLGlyphInfo *info = value; |
393 | PangoOpenGLGlyphInfo *info = (PangoOpenGLGlyphInfo *)value; |
383 | |
394 | |
384 | if (font->glyph_cache_destroy && info->cached_glyph) |
395 | if (font->glyph_cache_destroy && info->cached_glyph) |
385 | (*font->glyph_cache_destroy) (info->cached_glyph); |
396 | (*font->glyph_cache_destroy) (info->cached_glyph); |
386 | |
397 | |
387 | g_slice_free (PangoOpenGLGlyphInfo, info); |
398 | g_slice_free (PangoOpenGLGlyphInfo, info); |