… | |
… | |
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) |
75 | /* pango 1.24 is ABI-incompatible with 1.22, but distros */ |
76 | /* pango 1.24 is ABI-incompatible with 1.22, but distros */ |
76 | /* usually package it under the same name, so a runtime check */ |
77 | /* usually package it under the same name, so a runtime check */ |
77 | /* is required */ |
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 */ |
78 | if (pango_version () > PANGO_VERSION_ENCODE (1, 23, 0)) |
82 | if (pango_version () > PANGO_VERSION_ENCODE (1, 23, 0)) |
79 | PANGO_FC_FONT (font)->fontmap = fontmap; |
83 | PANGO_FC_FONT (font)->fontmap = fontmap; |
|
|
84 | #endif |
80 | |
85 | |
81 | return font; |
86 | return font; |
82 | } |
87 | } |
83 | |
88 | |
84 | static void |
89 | static void |
… | |
… | |
222 | font->size = 0; |
227 | font->size = 0; |
223 | font->glyph_info = g_hash_table_new (NULL, NULL); |
228 | font->glyph_info = g_hash_table_new (NULL, NULL); |
224 | } |
229 | } |
225 | |
230 | |
226 | static void |
231 | static void |
227 | pango_opengl_font_class_init (PangoOpenGLFontClass *class) |
232 | pango_opengl_font_class_init (PangoOpenGLFontClass *klass) |
228 | { |
233 | { |
229 | GObjectClass *object_class = G_OBJECT_CLASS (class); |
234 | GObjectClass *object_class = G_OBJECT_CLASS (klass); |
230 | PangoFontClass *font_class = PANGO_FONT_CLASS (class); |
235 | PangoFontClass *font_class = PANGO_FONT_CLASS (klass); |
231 | PangoFcFontClass *fc_font_class = PANGO_FC_FONT_CLASS (class); |
236 | PangoFcFontClass *fc_font_class = PANGO_FC_FONT_CLASS (klass); |
232 | |
237 | |
233 | object_class->finalize = pango_opengl_font_finalize; |
238 | object_class->finalize = pango_opengl_font_finalize; |
234 | |
239 | |
235 | font_class->get_glyph_extents = pango_opengl_font_get_glyph_extents; |
240 | font_class->get_glyph_extents = pango_opengl_font_get_glyph_extents; |
236 | |
241 | |
… | |
… | |
243 | { |
248 | { |
244 | PangoOpenGLFont *font = (PangoOpenGLFont *)font_; |
249 | PangoOpenGLFont *font = (PangoOpenGLFont *)font_; |
245 | PangoFcFont *fcfont = (PangoFcFont *)font; |
250 | PangoFcFont *fcfont = (PangoFcFont *)font; |
246 | PangoOpenGLGlyphInfo *info; |
251 | PangoOpenGLGlyphInfo *info; |
247 | |
252 | |
248 | 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)); |
249 | |
254 | |
250 | if ((info == NULL) && create) |
255 | if ((info == NULL) && create) |
251 | { |
256 | { |
252 | info = g_slice_new0 (PangoOpenGLGlyphInfo); |
257 | info = g_slice_new0 (PangoOpenGLGlyphInfo); |
253 | |
258 | |
… | |
… | |
383 | |
388 | |
384 | static gboolean |
389 | static gboolean |
385 | 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) |
386 | { |
391 | { |
387 | PangoOpenGLFont *font = PANGO_OPENGL_FONT (data); |
392 | PangoOpenGLFont *font = PANGO_OPENGL_FONT (data); |
388 | PangoOpenGLGlyphInfo *info = value; |
393 | PangoOpenGLGlyphInfo *info = (PangoOpenGLGlyphInfo *)value; |
389 | |
394 | |
390 | if (font->glyph_cache_destroy && info->cached_glyph) |
395 | if (font->glyph_cache_destroy && info->cached_glyph) |
391 | (*font->glyph_cache_destroy) (info->cached_glyph); |
396 | (*font->glyph_cache_destroy) (info->cached_glyph); |
392 | |
397 | |
393 | g_slice_free (PangoOpenGLGlyphInfo, info); |
398 | g_slice_free (PangoOpenGLGlyphInfo, info); |