[HarfBuzz] harfbuzz: Branch 'master'
Behdad Esfahbod
behdad at kemper.freedesktop.org
Tue Jul 8 15:10:40 PDT 2014
util/helper-cairo.cc | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)
New commits:
commit 8656408572c2685f278a3b742ee69c767c29788c
Author: Behdad Esfahbod <behdad at behdad.org>
Date: Tue Jul 8 18:10:20 2014 -0400
[util] Fix hb-view rendering with --font-funcs=ot
diff --git a/util/helper-cairo.cc b/util/helper-cairo.cc
index 0ecf7f4..ee940ae 100644
--- a/util/helper-cairo.cc
+++ b/util/helper-cairo.cc
@@ -60,6 +60,15 @@ _cairo_eps_surface_create_for_stream (cairo_write_func_t write_func,
# endif
#endif
+
+static FT_Library ft_library;
+
+static inline
+void free_ft_library (void)
+{
+ FT_Done_FreeType (ft_library);
+}
+
cairo_scaled_font_t *
helper_cairo_create_scaled_font (const font_options_t *font_opts,
double font_size)
@@ -69,10 +78,26 @@ helper_cairo_create_scaled_font (const font_options_t *font_opts,
cairo_font_face_t *cairo_face;
FT_Face ft_face = hb_ft_font_get_face (font);
if (!ft_face)
+ {
+ if (!ft_library)
+ {
+ FT_Init_FreeType (&ft_library);
+#ifdef HAVE_ATEXIT
+ atexit (free_ft_library);
+#endif
+ }
+ FT_New_Face (ft_library,
+ font_opts->font_file,
+ font_opts->face_index,
+ &ft_face);
+ }
+ if (!ft_face)
+ {
/* This allows us to get some boxes at least... */
cairo_face = cairo_toy_font_face_create ("@cairo:sans",
CAIRO_FONT_SLANT_NORMAL,
CAIRO_FONT_WEIGHT_NORMAL);
+ }
else
cairo_face = cairo_ft_font_face_create_for_ft_face (ft_face, 0);
cairo_matrix_t ctm, font_matrix;
More information about the HarfBuzz
mailing list