|
|
@ -54,7 +54,7 @@ hb_font_get_glyph_nil (hb_font_t *font, |
|
|
|
void *user_data HB_UNUSED) |
|
|
|
void *user_data HB_UNUSED) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (font->parent) |
|
|
|
if (font->parent) |
|
|
|
return hb_font_get_glyph (font->parent, unicode, variation_selector, glyph); |
|
|
|
return font->parent->get_glyph (unicode, variation_selector, glyph); |
|
|
|
|
|
|
|
|
|
|
|
*glyph = 0; |
|
|
|
*glyph = 0; |
|
|
|
return false; |
|
|
|
return false; |
|
|
@ -67,7 +67,7 @@ hb_font_get_glyph_h_advance_nil (hb_font_t *font, |
|
|
|
void *user_data HB_UNUSED) |
|
|
|
void *user_data HB_UNUSED) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (font->parent) |
|
|
|
if (font->parent) |
|
|
|
return font->parent_scale_x_distance (hb_font_get_glyph_h_advance (font->parent, glyph)); |
|
|
|
return font->parent_scale_x_distance (font->parent->get_glyph_h_advance (glyph)); |
|
|
|
|
|
|
|
|
|
|
|
return font->x_scale; |
|
|
|
return font->x_scale; |
|
|
|
} |
|
|
|
} |
|
|
@ -79,7 +79,7 @@ hb_font_get_glyph_v_advance_nil (hb_font_t *font, |
|
|
|
void *user_data HB_UNUSED) |
|
|
|
void *user_data HB_UNUSED) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (font->parent) |
|
|
|
if (font->parent) |
|
|
|
return font->parent_scale_y_distance (hb_font_get_glyph_v_advance (font->parent, glyph)); |
|
|
|
return font->parent_scale_y_distance (font->parent->get_glyph_v_advance (glyph)); |
|
|
|
|
|
|
|
|
|
|
|
return font->y_scale; |
|
|
|
return font->y_scale; |
|
|
|
} |
|
|
|
} |
|
|
@ -93,7 +93,7 @@ hb_font_get_glyph_h_origin_nil (hb_font_t *font, |
|
|
|
void *user_data HB_UNUSED) |
|
|
|
void *user_data HB_UNUSED) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (font->parent) { |
|
|
|
if (font->parent) { |
|
|
|
hb_bool_t ret = hb_font_get_glyph_h_origin (font->parent, glyph, x, y); |
|
|
|
hb_bool_t ret = font->parent->get_glyph_h_origin (glyph, x, y); |
|
|
|
if (ret) |
|
|
|
if (ret) |
|
|
|
font->parent_scale_position (x, y); |
|
|
|
font->parent_scale_position (x, y); |
|
|
|
return ret; |
|
|
|
return ret; |
|
|
@ -112,7 +112,7 @@ hb_font_get_glyph_v_origin_nil (hb_font_t *font, |
|
|
|
void *user_data HB_UNUSED) |
|
|
|
void *user_data HB_UNUSED) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (font->parent) { |
|
|
|
if (font->parent) { |
|
|
|
hb_bool_t ret = hb_font_get_glyph_v_origin (font->parent, glyph, x, y); |
|
|
|
hb_bool_t ret = font->parent->get_glyph_v_origin (glyph, x, y); |
|
|
|
if (ret) |
|
|
|
if (ret) |
|
|
|
font->parent_scale_position (x, y); |
|
|
|
font->parent_scale_position (x, y); |
|
|
|
return ret; |
|
|
|
return ret; |
|
|
@ -130,7 +130,7 @@ hb_font_get_glyph_h_kerning_nil (hb_font_t *font, |
|
|
|
void *user_data HB_UNUSED) |
|
|
|
void *user_data HB_UNUSED) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (font->parent) |
|
|
|
if (font->parent) |
|
|
|
return font->parent_scale_x_distance (hb_font_get_glyph_h_kerning (font->parent, left_glyph, right_glyph)); |
|
|
|
return font->parent_scale_x_distance (font->parent->get_glyph_h_kerning (left_glyph, right_glyph)); |
|
|
|
|
|
|
|
|
|
|
|
return 0; |
|
|
|
return 0; |
|
|
|
} |
|
|
|
} |
|
|
@ -143,7 +143,7 @@ hb_font_get_glyph_v_kerning_nil (hb_font_t *font, |
|
|
|
void *user_data HB_UNUSED) |
|
|
|
void *user_data HB_UNUSED) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (font->parent) |
|
|
|
if (font->parent) |
|
|
|
return font->parent_scale_y_distance (hb_font_get_glyph_v_kerning (font->parent, top_glyph, bottom_glyph)); |
|
|
|
return font->parent_scale_y_distance (font->parent->get_glyph_v_kerning (top_glyph, bottom_glyph)); |
|
|
|
|
|
|
|
|
|
|
|
return 0; |
|
|
|
return 0; |
|
|
|
} |
|
|
|
} |
|
|
@ -156,9 +156,7 @@ hb_font_get_glyph_extents_nil (hb_font_t *font, |
|
|
|
void *user_data HB_UNUSED) |
|
|
|
void *user_data HB_UNUSED) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (font->parent) { |
|
|
|
if (font->parent) { |
|
|
|
hb_bool_t ret = hb_font_get_glyph_extents (font->parent, |
|
|
|
hb_bool_t ret = font->parent->get_glyph_extents (glyph, extents); |
|
|
|
glyph, |
|
|
|
|
|
|
|
extents); |
|
|
|
|
|
|
|
if (ret) { |
|
|
|
if (ret) { |
|
|
|
font->parent_scale_position (&extents->x_bearing, &extents->y_bearing); |
|
|
|
font->parent_scale_position (&extents->x_bearing, &extents->y_bearing); |
|
|
|
font->parent_scale_distance (&extents->width, &extents->height); |
|
|
|
font->parent_scale_distance (&extents->width, &extents->height); |
|
|
@ -180,7 +178,7 @@ hb_font_get_glyph_contour_point_nil (hb_font_t *font, |
|
|
|
void *user_data HB_UNUSED) |
|
|
|
void *user_data HB_UNUSED) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (font->parent) { |
|
|
|
if (font->parent) { |
|
|
|
hb_bool_t ret = hb_font_get_glyph_contour_point (font->parent, glyph, point_index, x, y); |
|
|
|
hb_bool_t ret = font->parent->get_glyph_contour_point (glyph, point_index, x, y); |
|
|
|
if (ret) |
|
|
|
if (ret) |
|
|
|
font->parent_scale_position (x, y); |
|
|
|
font->parent_scale_position (x, y); |
|
|
|
return ret; |
|
|
|
return ret; |
|
|
@ -198,7 +196,7 @@ hb_font_get_glyph_name_nil (hb_font_t *font, |
|
|
|
void *user_data HB_UNUSED) |
|
|
|
void *user_data HB_UNUSED) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (font->parent) |
|
|
|
if (font->parent) |
|
|
|
return hb_font_get_glyph_name (font->parent, glyph, name, size); |
|
|
|
return font->parent->get_glyph_name (glyph, name, size); |
|
|
|
|
|
|
|
|
|
|
|
if (size) *name = '\0'; |
|
|
|
if (size) *name = '\0'; |
|
|
|
return false; |
|
|
|
return false; |
|
|
@ -212,7 +210,7 @@ hb_font_get_glyph_from_name_nil (hb_font_t *font, |
|
|
|
void *user_data HB_UNUSED) |
|
|
|
void *user_data HB_UNUSED) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (font->parent) |
|
|
|
if (font->parent) |
|
|
|
return hb_font_get_glyph_from_name (font->parent, name, len, glyph); |
|
|
|
return font->parent->get_glyph_from_name (name, len, glyph); |
|
|
|
|
|
|
|
|
|
|
|
*glyph = 0; |
|
|
|
*glyph = 0; |
|
|
|
return false; |
|
|
|
return false; |
|
|
@ -516,7 +514,7 @@ static const hb_face_t _hb_face_nil = { |
|
|
|
|
|
|
|
|
|
|
|
true, /* immutable */ |
|
|
|
true, /* immutable */ |
|
|
|
|
|
|
|
|
|
|
|
NULL, /* reference_table */ |
|
|
|
NULL, /* reference_table_func */ |
|
|
|
NULL, /* user_data */ |
|
|
|
NULL, /* user_data */ |
|
|
|
NULL, /* destroy */ |
|
|
|
NULL, /* destroy */ |
|
|
|
|
|
|
|
|
|
|
@ -534,19 +532,19 @@ static const hb_face_t _hb_face_nil = { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
hb_face_t * |
|
|
|
hb_face_t * |
|
|
|
hb_face_create_for_tables (hb_reference_table_func_t reference_table, |
|
|
|
hb_face_create_for_tables (hb_reference_table_func_t reference_table_func, |
|
|
|
void *user_data, |
|
|
|
void *user_data, |
|
|
|
hb_destroy_func_t destroy) |
|
|
|
hb_destroy_func_t destroy) |
|
|
|
{ |
|
|
|
{ |
|
|
|
hb_face_t *face; |
|
|
|
hb_face_t *face; |
|
|
|
|
|
|
|
|
|
|
|
if (!reference_table || !(face = hb_object_create<hb_face_t> ())) { |
|
|
|
if (!reference_table_func || !(face = hb_object_create<hb_face_t> ())) { |
|
|
|
if (destroy) |
|
|
|
if (destroy) |
|
|
|
destroy (user_data); |
|
|
|
destroy (user_data); |
|
|
|
return hb_face_get_empty (); |
|
|
|
return hb_face_get_empty (); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
face->reference_table = reference_table; |
|
|
|
face->reference_table_func = reference_table_func; |
|
|
|
face->user_data = user_data; |
|
|
|
face->user_data = user_data; |
|
|
|
face->destroy = destroy; |
|
|
|
face->destroy = destroy; |
|
|
|
|
|
|
|
|
|
|
@ -697,22 +695,13 @@ hb_blob_t * |
|
|
|
hb_face_reference_table (hb_face_t *face, |
|
|
|
hb_face_reference_table (hb_face_t *face, |
|
|
|
hb_tag_t tag) |
|
|
|
hb_tag_t tag) |
|
|
|
{ |
|
|
|
{ |
|
|
|
hb_blob_t *blob; |
|
|
|
return face->reference_table (tag); |
|
|
|
|
|
|
|
|
|
|
|
if (unlikely (!face || !face->reference_table)) |
|
|
|
|
|
|
|
return hb_blob_get_empty (); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
blob = face->reference_table (face, tag, face->user_data); |
|
|
|
|
|
|
|
if (unlikely (!blob)) |
|
|
|
|
|
|
|
return hb_blob_get_empty (); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return blob; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
hb_blob_t * |
|
|
|
hb_blob_t * |
|
|
|
hb_face_reference_blob (hb_face_t *face) |
|
|
|
hb_face_reference_blob (hb_face_t *face) |
|
|
|
{ |
|
|
|
{ |
|
|
|
return hb_face_reference_table (face, HB_TAG_NONE); |
|
|
|
return face->reference_table (HB_TAG_NONE); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void |
|
|
|
void |
|
|
@ -744,13 +733,17 @@ hb_face_set_upem (hb_face_t *face, |
|
|
|
unsigned int |
|
|
|
unsigned int |
|
|
|
hb_face_get_upem (hb_face_t *face) |
|
|
|
hb_face_get_upem (hb_face_t *face) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (unlikely (!face->upem)) { |
|
|
|
return face->get_upem (); |
|
|
|
hb_blob_t *head_blob = Sanitizer<head>::sanitize (hb_face_reference_table (face, HB_OT_TAG_head)); |
|
|
|
} |
|
|
|
const head *head_table = Sanitizer<head>::lock_instance (head_blob); |
|
|
|
|
|
|
|
face->upem = head_table->get_upem (); |
|
|
|
|
|
|
|
hb_blob_destroy (head_blob); |
|
|
|
void |
|
|
|
} |
|
|
|
hb_face_t::load_upem (void) const |
|
|
|
return face->upem; |
|
|
|
{ |
|
|
|
|
|
|
|
hb_blob_t *head_blob = Sanitizer<head>::sanitize (reference_table (HB_OT_TAG_head)); |
|
|
|
|
|
|
|
const head *head_table = Sanitizer<head>::lock_instance (head_blob); |
|
|
|
|
|
|
|
upem = head_table->get_upem (); |
|
|
|
|
|
|
|
hb_blob_destroy (head_blob); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|