[autofit] Use `global' HarfBuzz font object. We now use `hb_font' instead of `hb_face' since yet-to-come changes need this. * src/autofit/afglobal.h: Include `hbshim.h'. (AF_FaceGlobalsRec) [FT_CONFIG_OPTION_USE_HARFBUZZ]: New member `hb_font'. * src/autofit/afglobal.c (af_face_globals_new) [FT_CONFIG_OPTION_USE_HARFBUZZ]: Create `hb_font'. (af_face_globals_free) [FT_CONFIG_OPTION_USE_HARFBUZZ]: Destroy `hb_font'. * src/autofit/hbshim.h: Include HarfBuzz headers. * src/autofit/hbshim.c: Include `hbshim.h' instead of HarfBuzz headers. (af_get_coverage): Updated.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141
diff --git a/ChangeLog b/ChangeLog
index 112db7f..041ccf0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,25 @@
+2013-12-28 Werner Lemberg <wl@gnu.org>
+
+ [autofit] Use `global' HarfBuzz font object.
+
+ We now use `hb_font' instead of `hb_face' since yet-to-come changes
+ need this.
+
+ * src/autofit/afglobal.h: Include `hbshim.h'.
+ (AF_FaceGlobalsRec) [FT_CONFIG_OPTION_USE_HARFBUZZ]: New member
+ `hb_font'.
+
+ * src/autofit/afglobal.c (af_face_globals_new)
+ [FT_CONFIG_OPTION_USE_HARFBUZZ]: Create `hb_font'.
+ (af_face_globals_free) [FT_CONFIG_OPTION_USE_HARFBUZZ]: Destroy
+ `hb_font'.
+
+ * src/autofit/hbshim.h: Include HarfBuzz headers.
+
+ * src/autofit/hbshim.c: Include `hbshim.h' instead of HarfBuzz
+ headers.
+ (af_get_coverage): Updated.
+
2013-12-27 Werner Lemberg <wl@gnu.org>
[autofit] Handle `DFLT' OpenType script for coverages.
diff --git a/src/autofit/afglobal.c b/src/autofit/afglobal.c
index fa4017d..4c9ee1f 100644
--- a/src/autofit/afglobal.c
+++ b/src/autofit/afglobal.c
@@ -20,6 +20,7 @@
#include "afranges.h"
#include "hbshim.h"
+
/* get writing system specific header files */
#undef WRITING_SYSTEM
#define WRITING_SYSTEM( ws, WS ) /* empty */
@@ -254,6 +255,10 @@
globals->glyph_styles = (FT_Byte*)( globals + 1 );
globals->module = module;
+#ifdef FT_CONFIG_OPTION_USE_HARFBUZZ
+ globals->hb_font = hb_ft_font_create( face, NULL );
+#endif
+
error = af_face_globals_compute_style_coverage( globals );
if ( error )
{
@@ -295,6 +300,11 @@
}
}
+#ifdef FT_CONFIG_OPTION_USE_HARFBUZZ
+ hb_font_destroy( globals->hb_font );
+ globals->hb_font = NULL;
+#endif
+
globals->glyph_count = 0;
globals->glyph_styles = NULL; /* no need to free this one! */
globals->face = NULL;
diff --git a/src/autofit/afglobal.h b/src/autofit/afglobal.h
index 7785eea..b5a908d 100644
--- a/src/autofit/afglobal.h
+++ b/src/autofit/afglobal.h
@@ -23,6 +23,7 @@
#include "aftypes.h"
#include "afmodule.h"
+#include "hbshim.h"
FT_BEGIN_HEADER
@@ -101,6 +102,10 @@ FT_BEGIN_HEADER
FT_Long glyph_count; /* same as face->num_glyphs */
FT_Byte* glyph_styles;
+#ifdef FT_CONFIG_OPTION_USE_HARFBUZZ
+ hb_font_t* hb_font;
+#endif
+
/* per-face auto-hinter properties */
FT_UInt increase_x_height;
diff --git a/src/autofit/hbshim.c b/src/autofit/hbshim.c
index 61a678b..22adcaf 100644
--- a/src/autofit/hbshim.c
+++ b/src/autofit/hbshim.c
@@ -18,14 +18,10 @@
#include <ft2build.h>
#include FT_FREETYPE_H
-
+#include "hbshim.h"
#ifdef FT_CONFIG_OPTION_USE_HARFBUZZ
-#include <hb.h>
-#include <hb-ot.h>
-#include <hb-ft.h>
-
/*************************************************************************/
/* */
@@ -160,7 +156,7 @@
if ( !globals || !style_class || !gstyles )
return FT_THROW( Invalid_Argument );
- face = hb_ft_face_create( globals->face, NULL );
+ face = hb_font_get_face( globals->hb_font );
lookups = hb_set_create();
glyphs = hb_set_create();
@@ -267,8 +263,6 @@
hb_set_destroy( lookups );
hb_set_destroy( glyphs );
- hb_face_destroy( face );
-
return FT_Err_Ok;
}
diff --git a/src/autofit/hbshim.h b/src/autofit/hbshim.h
index fdda2ac..09df680 100644
--- a/src/autofit/hbshim.h
+++ b/src/autofit/hbshim.h
@@ -26,6 +26,10 @@
#ifdef FT_CONFIG_OPTION_USE_HARFBUZZ
+#include <hb.h>
+#include <hb-ot.h>
+#include <hb-ft.h>
+
FT_BEGIN_HEADER