[graphite] Rewrite properly

This commit is contained in:
Behdad Esfahbod 2011-08-24 03:22:49 +02:00
parent 5072934c35
commit a3bd8a0e18
2 changed files with 291 additions and 380 deletions

View File

@ -1,6 +1,7 @@
/* /*
* Copyright (C) 2011 Martin Hosken * Copyright © 2011 Martin Hosken
* Copyright (C) 2011 SIL International * Copyright © 2011 SIL International
* Copyright © 2011 Google, Inc.
* *
* This is part of HarfBuzz, a text shaping library. * This is part of HarfBuzz, a text shaping library.
* *
@ -21,6 +22,8 @@
* FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
* ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
* PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
*
* Google Author(s): Behdad Esfahbod
*/ */
#include "hb-private.hh" #include "hb-private.hh"
@ -35,353 +38,259 @@
#include <graphite2/Segment.h> #include <graphite2/Segment.h>
typedef struct hbgr_tablelist_t { struct hb_gr_cluster_t {
hb_blob_t *blob;
struct hbgr_tablelist_t *next;
unsigned int tag;
} hbgr_tablelist_t;
typedef struct hbgr_face_t {
gr_face *grface;
hbgr_tablelist_t *tlist;
hb_destroy_func_t destroy;
hb_reference_table_func_t get_table;
hb_face_t *face;
void *data;
} hbgr_face_t;
typedef struct hbgr_font_t {
gr_font *grfont;
hb_face_t *face;
hb_font_t *font;
hb_destroy_func_t destroy;
hb_font_funcs_t *klass;
void *data;
} hbgr_font_t;
typedef struct hbgr_cluster_t {
unsigned int base_char; unsigned int base_char;
unsigned int num_chars; unsigned int num_chars;
unsigned int base_glyph; unsigned int base_glyph;
unsigned int num_glyphs; unsigned int num_glyphs;
} hbgr_cluster_t; };
static const void *hbgr_get_table(const void *face, unsigned int tag, size_t *len);
static float hbgr_get_advance(const void *font, unsigned short gid);
static void hbgr_face_destroy(void *data);
static hb_blob_t *hbgr_face_get_table(hb_face_t *face, hb_tag_t tag, void *data);
static void hbgr_font_destroy(void *data);
/* static hb_codepoint_t hbgr_font_get_glyph (hb_font_t *font, hb_face_t *face, const void *user_data, hb_codepoint_t unicode, hb_codepoint_t variation_selector);
static void hbgr_font_get_glyph_advance (hb_font_t *font, hb_face_t *face, const void *user_data, hb_codepoint_t glyph, hb_position_t *x_advance, hb_position_t *y_advance);
static void hbgr_font_get_glyph_extents (hb_font_t *font, hb_face_t *face, const void *user_data, hb_codepoint_t glyph, hb_glyph_extents_t *extents);
static hb_bool_t hbgr_font_get_contour_point (hb_font_t *font, hb_face_t *face, const void *user_data, unsigned int point_index, hb_codepoint_t glyph, hb_position_t *x, hb_position_t *y);
static hb_position_t hbgr_font_get_kerning (hb_font_t *font, hb_face_t *face, const void *user_data, hb_codepoint_t first_glyph, hb_codepoint_t second_glyph);
*/
static const void *hbgr_get_table(const void *data, unsigned int tag, size_t *len) typedef struct hb_gr_tablelist_t {
hb_blob_t *blob;
struct hb_gr_tablelist_t *next;
unsigned int tag;
} hb_gr_tablelist_t;
static struct hb_gr_face_data_t {
hb_face_t *face;
gr_face *grface;
hb_gr_tablelist_t *tlist;
} _hb_gr_face_data_nil = {NULL, NULL};
static struct hb_gr_font_data_t {
hb_font_t *font;
gr_font *grfont;
gr_face *grface;
} _hb_gr_font_data_nil = {NULL, NULL, NULL};
static const void *hb_gr_get_table (const void *data, unsigned int tag, size_t *len)
{ {
const void *res; hb_gr_tablelist_t *pl = NULL, *p;
hbgr_tablelist_t *pl, *p; hb_gr_face_data_t *face = (hb_gr_face_data_t *) data;
hbgr_face_t *face = (hbgr_face_t *)data; hb_gr_tablelist_t *tlist = face->tlist;
hbgr_tablelist_t *tlist = face->tlist;
for (p = tlist; p; p = p->next) for (p = tlist; p; p = p->next)
if (p->tag == tag) if (p->tag == tag ) {
return hb_blob_get_data(p->blob, (unsigned int *)len); unsigned int tlen;
else const char *d = hb_blob_get_data (p->blob, &tlen);
*len = tlen;
return d;
} else
pl = p; pl = p;
hb_blob_t *blob = face->get_table(face->face, tag, face->data); if (!face->face)
if (pl->blob) return NULL;
{ hb_blob_t *blob = hb_face_reference_table (face->face, tag);
p = (hbgr_tablelist_t *)malloc(sizeof(hbgr_tablelist_t));
if (!p) if (!pl || pl->blob)
{ {
p = (hb_gr_tablelist_t *) malloc (sizeof (hb_gr_tablelist_t));
if (!p) {
hb_blob_destroy(blob); hb_blob_destroy(blob);
return NULL; return NULL;
} }
p->next = NULL; p->next = NULL;
if (pl)
pl->next = p; pl->next = p;
else
face->tlist = p;
pl = p; pl = p;
} }
pl->blob = blob; pl->blob = blob;
pl->tag = tag; pl->tag = tag;
return hb_blob_get_data(blob, (unsigned int *)len);
unsigned int tlen;
const char *d = hb_blob_get_data (blob, &tlen);
*len = tlen;
return d;
} }
static float hbgr_get_advance(const void *dat, unsigned short gid) static float hb_gr_get_advance (const void *data, unsigned short gid)
{ {
hbgr_font_t *font = (hbgr_font_t *)dat; hb_gr_font_data_t *font = (hb_gr_font_data_t *) data;
return (float)(font->klass->get.glyph_h_advance(font->font, font->data, gid, font->klass->user_data.glyph_h_advance)); if (!font->font)
return 0;
return (float) hb_font_get_glyph_h_advance (font->font, gid);
} }
static void hbgr_face_destroy(void *data) static void _hb_gr_face_data_destroy (void *data)
{ {
hbgr_face_t *fcomp = (hbgr_face_t *)data; hb_gr_face_data_t *f = (hb_gr_face_data_t *) data;
hbgr_tablelist_t *tlist = fcomp->tlist; hb_gr_tablelist_t *tlist = f->tlist;
while (tlist) while (tlist)
{ {
hbgr_tablelist_t *old = tlist; hb_gr_tablelist_t *old = tlist;
hb_blob_destroy (tlist->blob); hb_blob_destroy (tlist->blob);
tlist = tlist->next; tlist = tlist->next;
free(old); free(old);
} }
fcomp->destroy(fcomp->data); gr_face_destroy (f->grface);
gr_face_destroy(fcomp->grface);
} }
static hb_blob_t *hbgr_face_get_table(hb_face_t *face, hb_tag_t tag, void *data) static void _hb_gr_font_data_destroy (void *data)
{ {
hbgr_face_t *fcomp = (hbgr_face_t *)data; hb_gr_font_data_t *f = (hb_gr_font_data_t *) data;
return fcomp->get_table(fcomp->face, tag, fcomp->data);
gr_font_destroy (f->grfont);
} }
static void hbgr_font_destroy(void *data) static hb_user_data_key_t hb_gr_data_key;
{
hbgr_font_t *fcomp = (hbgr_font_t *)data;
fcomp->destroy(fcomp->data);
gr_font_destroy(fcomp->grfont);
}
static hb_bool_t hbgr_font_get_glyph (hb_font_t *font, static hb_gr_face_data_t *
void *font_data, _hb_gr_face_get_data (hb_face_t *face)
hb_codepoint_t unicode,
hb_codepoint_t variation_selector,
hb_codepoint_t *glyph,
void *user_data)
{ {
return ((hbgr_font_t *)font)->klass->get.glyph(((hbgr_font_t *)font)->font, font_data, unicode, variation_selector, glyph, user_data); hb_gr_face_data_t *data = (hb_gr_face_data_t *) hb_face_get_user_data (face, &hb_gr_data_key);
} if (likely (data)) return data;
static hb_bool_t hbgr_font_get_glyph_h_advance (hb_font_t *font, data = (hb_gr_face_data_t *) calloc (1, sizeof (hb_gr_face_data_t));
void *font_data, if (unlikely (!data))
hb_codepoint_t glyph, return &_hb_gr_face_data_nil;
void *user_data)
{
return ((hbgr_font_t *)font)->klass->get.glyph_h_advance(((hbgr_font_t *)font)->font, font_data, glyph, user_data);
}
static hb_position_t hbgr_font_get_glyph_v_advance (hb_font_t *font,
void *font_data,
hb_codepoint_t glyph,
void *user_data)
{
return ((hbgr_font_t *)font)->klass->get.glyph_v_advance(((hbgr_font_t *)font)->font, font_data, glyph, user_data);
}
static hb_bool_t hbgr_font_get_glyph_h_origin (hb_font_t *font, hb_blob_t *silf_blob = hb_face_reference_table (face, HB_GRAPHITE_TAG_Silf);
void *font_data, if (!hb_blob_get_length(silf_blob))
hb_codepoint_t glyph,
hb_position_t *x,
hb_position_t *y,
void *user_data)
{
return ((hbgr_font_t *)font)->klass->get.glyph_h_origin(((hbgr_font_t *)font)->font, font_data, glyph, x, y, user_data);
}
static hb_bool_t hbgr_font_get_glyph_v_origin (hb_font_t *font,
void *font_data,
hb_codepoint_t glyph,
hb_position_t *x,
hb_position_t *y,
void *user_data)
{
return ((hbgr_font_t *)font)->klass->get.glyph_v_origin(((hbgr_font_t *)font)->font, font_data, glyph, x, y, user_data);
}
static hb_position_t hbgr_font_get_glyph_h_kerning (hb_font_t *font,
void *font_data,
hb_codepoint_t first_glyph,
hb_codepoint_t second_glyph,
void *user_data)
{
return ((hbgr_font_t *)font)->klass->get.glyph_h_kerning(((hbgr_font_t *)font)->font, font_data, first_glyph, second_glyph, user_data);
}
static hb_position_t hbgr_font_get_glyph_v_kerning (hb_font_t *font,
void *font_data,
hb_codepoint_t first_glyph,
hb_codepoint_t second_glyph,
void *user_data)
{
return ((hbgr_font_t *)font)->klass->get.glyph_v_kerning(((hbgr_font_t *)font)->font, font_data, first_glyph, second_glyph, user_data);
}
static hb_bool_t hbgr_font_get_glyph_extents (hb_font_t *font,
void *font_data,
hb_codepoint_t glyph,
hb_glyph_extents_t *extents,
void *user_data)
{
return ((hbgr_font_t *)font)->klass->get.glyph_extents(((hbgr_font_t *)font)->font, font_data, glyph, extents, user_data);
}
static hb_bool_t hbgr_font_get_glyph_contour_point (hb_font_t *font,
void *font_data,
hb_codepoint_t glyph,
unsigned int point_index,
hb_position_t *x,
hb_position_t *y,
void *user_data)
{
return ((hbgr_font_t *)font)->klass->get.glyph_contour_point(((hbgr_font_t *)font)->font, font_data, glyph, point_index, x, y, user_data);
}
hb_font_funcs_t hbgr_klass = {
HB_OBJECT_HEADER_STATIC,
TRUE,
{
hbgr_font_get_glyph,
hbgr_font_get_glyph_h_advance,
hbgr_font_get_glyph_v_advance,
hbgr_font_get_glyph_h_origin,
hbgr_font_get_glyph_v_origin,
hbgr_font_get_glyph_h_kerning,
hbgr_font_get_glyph_v_kerning,
hbgr_font_get_glyph_extents,
hbgr_font_get_glyph_contour_point
}
};
// returns 0 = success, 1 = fallback
static int hbgr_make_fonts(hb_font_t *font, hb_face_t *face)
{
// check face for having already added gr_face (based on destroy fn)
if (face->destroy != &hbgr_face_destroy)
{
hb_blob_t *silf_blob;
silf_blob = hb_face_reference_table (font->face, HB_GRAPHITE_TAG_Silf);
if (!hb_blob_get_length(silf_blob)) // return as early as possible if no Silf table
{ {
hb_blob_destroy(silf_blob); hb_blob_destroy(silf_blob);
return 1; return &_hb_gr_face_data_nil;
} }
hbgr_tablelist_t *flist = (hbgr_tablelist_t *)malloc(sizeof(hbgr_tablelist_t));
hbgr_face_t *fcomp = (hbgr_face_t *)malloc(sizeof(hbgr_face_t)); data->face = face;
if (!flist || !fcomp) return 1; data->grface = gr_make_face (data, &hb_gr_get_table, gr_face_preloadGlyphs);
flist->next = NULL;
flist->tag = 0;
flist->blob = NULL; if (unlikely (!hb_face_set_user_data (face, &hb_gr_data_key, data,
fcomp->tlist = flist; (hb_destroy_func_t) _hb_gr_face_data_destroy,
fcomp->get_table = face->reference_table; FALSE)))
fcomp->destroy = face->destroy;
fcomp->data = face->user_data;
fcomp->grface = gr_make_face(fcomp, &hbgr_get_table, gr_face_preloadGlyphs);
if (fcomp->grface)
{ {
face->user_data = fcomp; _hb_gr_face_data_destroy (data);
face->reference_table = &hbgr_face_get_table; data = (hb_gr_face_data_t *) hb_face_get_user_data (face, &hb_gr_data_key);
face->destroy = &hbgr_face_destroy; if (data)
} return data;
else else
{ return &_hb_gr_face_data_nil;
free(flist);
free(fcomp);
return 1;
}
} }
// check font for having already added gr_font (based on destroy fn) return data;
if (font->destroy != &hbgr_font_destroy) }
static hb_gr_font_data_t *
_hb_gr_font_get_data (hb_font_t *font)
{ {
hbgr_font_t *fcomp = (hbgr_font_t *)malloc(sizeof(hbgr_font_t)); hb_gr_font_data_t *data = (hb_gr_font_data_t *) hb_font_get_user_data (font, &hb_gr_data_key);
if (fcomp) if (likely (data)) return data;
data = (hb_gr_font_data_t *) calloc (1, sizeof (hb_gr_font_data_t));
if (unlikely (!data))
return &_hb_gr_font_data_nil;
hb_blob_t *silf_blob = hb_face_reference_table (font->face, HB_GRAPHITE_TAG_Silf);
if (!hb_blob_get_length (silf_blob))
{ {
hb_blob_destroy(silf_blob);
return &_hb_gr_font_data_nil;
}
data->font = font;
data->grface = _hb_gr_face_get_data (font->face)->grface;
int scale; int scale;
gr_face *grface = ((hbgr_face_t *)(face->user_data))->grface;
hb_font_get_scale (font, &scale, NULL); hb_font_get_scale (font, &scale, NULL);
fcomp->face = face; data->grfont = gr_make_font_with_advance_fn (scale, data, &hb_gr_get_advance, data->grface);
fcomp->font = font;
fcomp->destroy = font->destroy;
fcomp->klass = font->klass; if (unlikely (!hb_font_set_user_data (font, &hb_gr_data_key, data,
fcomp->data = font->user_data; (hb_destroy_func_t) _hb_gr_font_data_destroy,
fcomp->grfont = gr_make_font_with_advance_fn(scale, fcomp, &hbgr_get_advance, grface); FALSE)))
if (fcomp->grfont)
{ {
font->destroy = &hbgr_font_destroy; _hb_gr_font_data_destroy (data);
font->klass = &hbgr_klass; data = (hb_gr_font_data_t *) hb_font_get_user_data (font, &hb_gr_data_key);
font->user_data = fcomp; if (data)
return 0; return data;
} else
} return &_hb_gr_font_data_nil;
// something went wrong, back out of the whole thing
hbgr_face_t *facecomp = (hbgr_face_t *)(face->user_data);
free(facecomp->tlist);
face->reference_table = facecomp->get_table;
face->destroy = facecomp->destroy;
face->user_data = facecomp->data;
free(facecomp);
if (fcomp) free(fcomp);
return 1;
// create gr_font and put into struct along with stuff in font
// replace font component with struct and fns
}
return 0;
} }
hb_bool_t hb_graphite_shape (hb_font_t *font, return data;
}
hb_bool_t
hb_graphite_shape (hb_font_t *font,
hb_buffer_t *buffer, hb_buffer_t *buffer,
const hb_feature_t *features, const hb_feature_t *features,
unsigned int num_features, unsigned int num_features,
const char * const *shaper_options) const char * const *shaper_options)
{ {
hb_face_t *face = font->face;
gr_face *grface = NULL; buffer->guess_properties ();
gr_font *grfont = NULL;
gr_segment *seg = NULL; hb_gr_font_data_t *data = _hb_gr_font_get_data (font);
unsigned int *text = NULL;
hbgr_cluster_t *clusters = NULL;
unsigned short *gids = NULL;
unsigned int charlen; unsigned int charlen;
hb_glyph_info_t *bufferi = hb_buffer_get_glyph_infos (buffer, &charlen); hb_glyph_info_t *bufferi = hb_buffer_get_glyph_infos (buffer, &charlen);
int success = 0; int success = 0;
unsigned int *p;
const gr_slot *is;
unsigned int glyphlen;
unsigned short *pg;
unsigned int ci = 0, ic = 0;
float curradvx = 0., curradvy = 0.;
if (!charlen || hbgr_make_fonts(font, face)) return 0; if (!charlen) return TRUE;
grface = ((hbgr_face_t *)face->user_data)->grface;
grfont = ((hbgr_font_t *)font->user_data)->grfont;
/* XXX(behdad): Do we need OT lang tag here? */
const char *lang = hb_language_to_string (hb_buffer_get_language (buffer)); const char *lang = hb_language_to_string (hb_buffer_get_language (buffer));
gr_feature_val *feats = gr_face_featureval_for_lang(grface, lang ? hb_tag_from_string(lang) : 0); gr_feature_val *feats = gr_face_featureval_for_lang (data->grface, lang ? hb_tag_from_string (lang) : 0);
while (num_features--) while (num_features--)
{ {
const gr_feature_ref *fref = gr_face_find_fref(grface, features->tag); const gr_feature_ref *fref = gr_face_find_fref (data->grface, features->tag);
if (fref) if (fref)
gr_fref_set_feature_value (fref, features->value, feats); gr_fref_set_feature_value (fref, features->value, feats);
features++; features++;
} }
text = (unsigned int *)malloc((charlen + 1) * sizeof(unsigned int));
unsigned short *gids = NULL;
hb_gr_cluster_t *clusters = NULL;
gr_segment *seg = NULL;
uint32_t *text = NULL;
unsigned short *pg;
const gr_slot *is;
unsigned int ci = 0, ic = 0;
float curradvx = 0., curradvy = 0.;
unsigned int glyphlen = 0;
unsigned int *p;
text = (uint32_t *) malloc ((charlen + 1) * sizeof (uint32_t));
if (!text) goto dieout; if (!text) goto dieout;
p = text; p = text;
for (unsigned int i = 0; i < charlen; ++i) for (unsigned int i = 0; i < charlen; ++i)
*p++ = bufferi++->codepoint; *p++ = bufferi++->codepoint;
*p = 0; *p = 0;
hb_tag_t script_tag_1, script_tag_2; hb_tag_t script_tag[2];
hb_ot_tags_from_script(hb_buffer_get_script(buffer), &script_tag_1, &script_tag_2); hb_ot_tags_from_script (hb_buffer_get_script(buffer), &script_tag[0], &script_tag[1]);
seg = gr_make_seg(grfont, grface, script_tag_2 == HB_TAG_NONE ? script_tag_1 : script_tag_2,
feats, gr_utf32, text, charlen, hb_buffer_get_direction(buffer) == HB_DIRECTION_RTL ? 3 : 0); seg = gr_make_seg (data->grfont, data->grface,
script_tag[1] == HB_TAG_NONE ? script_tag[0] : script_tag[1],
feats,
gr_utf32, text, charlen,
2 | (hb_buffer_get_direction(buffer) == HB_DIRECTION_RTL ? 1 : 0));
if (!seg) goto dieout; if (!seg) goto dieout;
glyphlen = gr_seg_n_slots (seg); glyphlen = gr_seg_n_slots (seg);
clusters = (hbgr_cluster_t *)malloc(charlen * sizeof(hbgr_cluster_t)); clusters = (hb_gr_cluster_t *) calloc (charlen, sizeof (hb_gr_cluster_t));
if (!glyphlen || !clusters) goto dieout; if (!glyphlen || !clusters) goto dieout;
memset(clusters, 0, charlen * sizeof(hbgr_cluster_t));
gids = (unsigned short *) malloc (glyphlen * sizeof (unsigned short)); gids = (unsigned short *) malloc (glyphlen * sizeof (unsigned short));
if (!gids) goto dieout; if (!gids) goto dieout;
pg = gids; pg = gids;
for (is = gr_seg_first_slot (seg), ic = 0; is; is = gr_slot_next_in_segment (is), ic++) for (is = gr_seg_first_slot (seg), ic = 0; is; is = gr_slot_next_in_segment (is), ic++)
{ {
unsigned int before = gr_slot_before (is); unsigned int before = gr_slot_before (is);
unsigned int after = gr_slot_after (is); unsigned int after = gr_slot_after (is);
*pg = gr_slot_gid (is); *pg = gr_slot_gid (is);
*pg++ = hb_be_uint16(*pg); // insane: swap bytes so be16 can swap them back *pg = hb_be_uint16 (*pg); // XXX insane: swap bytes so be16 can swap them back
pg++;
while (clusters[ci].base_char > before && ci) while (clusters[ci].base_char > before && ci)
{ {
clusters[ci-1].num_chars += clusters[ci].num_chars; clusters[ci-1].num_chars += clusters[ci].num_chars;
@ -391,7 +300,7 @@ hb_bool_t hb_graphite_shape (hb_font_t *font,
if (gr_slot_can_insert_before (is) && clusters[ci].num_chars && before >= clusters[ci].base_char + clusters[ci].num_chars) if (gr_slot_can_insert_before (is) && clusters[ci].num_chars && before >= clusters[ci].base_char + clusters[ci].num_chars)
{ {
hbgr_cluster_t *c = clusters + ci + 1; hb_gr_cluster_t *c = clusters + ci + 1;
c->base_char = clusters[ci].base_char + clusters[ci].num_chars; c->base_char = clusters[ci].base_char + clusters[ci].num_chars;
c->num_chars = before - c->base_char; c->num_chars = before - c->base_char;
c->base_glyph = ic; c->base_glyph = ic;
@ -415,8 +324,8 @@ hb_bool_t hb_graphite_shape (hb_font_t *font,
{ {
pPos->x_offset = gr_slot_origin_X(is) - curradvx; pPos->x_offset = gr_slot_origin_X(is) - curradvx;
pPos->y_offset = gr_slot_origin_Y(is) - curradvy; pPos->y_offset = gr_slot_origin_Y(is) - curradvy;
pPos->x_advance = gr_slot_advance_X(is, grface, grfont); pPos->x_advance = gr_slot_advance_X(is, data->grface, data->grfont);
pPos->y_advance = gr_slot_advance_Y(is, grface, grfont); pPos->y_advance = gr_slot_advance_Y(is, data->grface, data->grfont);
// if (pPos->x_advance < 0 && gr_slot_attached_to(is)) // if (pPos->x_advance < 0 && gr_slot_attached_to(is))
// pPos->x_advance = 0; // pPos->x_advance = 0;
curradvx += pPos->x_advance; curradvx += pPos->x_advance;

View File

@ -117,6 +117,7 @@ _hb_uniscribe_face_get_data (hb_face_t *face)
if (unlikely (!data)) if (unlikely (!data))
return &_hb_uniscribe_face_data_nil; return &_hb_uniscribe_face_data_nil;
hb_blob_t *blob = hb_face_reference_blob (face); hb_blob_t *blob = hb_face_reference_blob (face);
unsigned int blob_length; unsigned int blob_length;
const char *blob_data = hb_blob_get_data (blob, &blob_length); const char *blob_data = hb_blob_get_data (blob, &blob_length);
@ -129,6 +130,7 @@ _hb_uniscribe_face_get_data (hb_face_t *face)
if (unlikely (!data->fh)) if (unlikely (!data->fh))
DEBUG_MSG (UNISCRIBE, face, "Face AddFontMemResourceEx() failed"); DEBUG_MSG (UNISCRIBE, face, "Face AddFontMemResourceEx() failed");
if (unlikely (!hb_face_set_user_data (face, &hb_uniscribe_data_key, data, if (unlikely (!hb_face_set_user_data (face, &hb_uniscribe_data_key, data,
(hb_destroy_func_t) _hb_uniscribe_face_data_destroy, (hb_destroy_func_t) _hb_uniscribe_face_data_destroy,
FALSE))) FALSE)))