]> git.eshelyaron.com Git - emacs.git/commitdiff
Simplify mainline Harfbuzz-using code
authorPaul Eggert <eggert@cs.ucla.edu>
Thu, 13 Dec 2018 19:58:09 +0000 (11:58 -0800)
committerPaul Eggert <eggert@cs.ucla.edu>
Thu, 13 Dec 2018 19:58:09 +0000 (11:58 -0800)
* src/ftfont.c (ft_face_destroy): Omit unnecessary cast.
(hb_ft_font_create_referenced) [!HAVE_HB_FT_FONT_CREATE_REFERENCED]:
New function.
(ftfont_get_hb_font): Use it.

src/ftfont.c

index a645bbf029496cbee1091c4c6a255d71895c4728..47442df0e5ad5b7393097c008ae4aeef7ba6a4be 100644 (file)
@@ -478,28 +478,27 @@ ftfont_get_otf (struct ftfont_info *ftfont_info)
 
 #ifdef HAVE_HARFBUZZ
 
-#ifndef HAVE_HB_FT_FONT_CREATE_REFERENCED
+# ifndef HAVE_HB_FT_FONT_CREATE_REFERENCED
 static void
 ft_face_destroy (void *data)
 {
-  FT_Done_Face ((FT_Face) data);
+  FT_Done_Face (data);
 }
-#endif
+
+static hb_font_t *
+hb_ft_font_create_referenced (FT_Face face)
+{
+  FT_Reference_Face (face);
+  return hb_ft_font_create (face, ft_face_destroy);
+}
+# endif
 
 static hb_font_t *
 ftfont_get_hb_font (struct ftfont_info *ftfont_info)
 {
   if (! ftfont_info->hb_font)
-    {
-      hb_font_t *hb_font;
-#ifdef HAVE_HB_FT_FONT_CREATE_REFERENCED
-      hb_font = hb_ft_font_create_referenced (ftfont_info->ft_size->face);
-#else
-      FT_Reference_Face (ftfont_info->ft_size->face);
-      hb_font = hb_ft_font_create (ftfont_info->ft_size->face, ft_face_destroy);
-#endif
-      ftfont_info->hb_font = hb_font;
-    }
+    ftfont_info->hb_font
+      = hb_ft_font_create_referenced (ftfont_info->ft_size->face);
   return ftfont_info->hb_font;
 }