From: Behdad Esfahbod Date: Sun, 26 Aug 2018 22:18:46 +0000 (-0700) Subject: [ot-face] Remove tables_t. The face_data_t is what tables_t was X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a26806801005c28115ae9e48bdcf3bbbc1bcd767;p=platform%2Fupstream%2FlibHarfBuzzSharp.git [ot-face] Remove tables_t. The face_data_t is what tables_t was --- diff --git a/src/hb-aat-layout.cc b/src/hb-aat-layout.cc index c481e6a..a5e36a4 100644 --- a/src/hb-aat-layout.cc +++ b/src/hb-aat-layout.cc @@ -49,9 +49,9 @@ _get_morx (hb_face_t *face, hb_blob_t **blob = nullptr) *blob = hb_blob_get_empty (); return Null(AAT::morx); } - const AAT::morx& morx = *(hb_ot_face_data (face)->table.morx.get ()); + const AAT::morx& morx = *(hb_ot_face_data (face)->morx.get ()); if (blob) - *blob = hb_ot_face_data (face)->table.morx.get_blob (); + *blob = hb_ot_face_data (face)->morx.get_blob (); return morx; } diff --git a/src/hb-face.cc b/src/hb-face.cc index ddf8e48..2fb5a0a 100644 --- a/src/hb-face.cc +++ b/src/hb-face.cc @@ -533,7 +533,7 @@ hb_face_collect_unicodes (hb_face_t *face, hb_set_t *out) { if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return; - hb_ot_face_data (face)->table.cmap->collect_unicodes (out); + hb_ot_face_data (face)->cmap->collect_unicodes (out); } /** @@ -550,7 +550,7 @@ hb_face_collect_variation_selectors (hb_face_t *face, hb_set_t *out) { if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return; - hb_ot_face_data (face)->table.cmap->collect_variation_selectors (out); + hb_ot_face_data (face)->cmap->collect_variation_selectors (out); } /** @@ -568,7 +568,7 @@ hb_face_collect_variation_unicodes (hb_face_t *face, hb_set_t *out) { if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return; - hb_ot_face_data (face)->table.cmap->collect_variation_unicodes (variation_selector, out); + hb_ot_face_data (face)->cmap->collect_variation_unicodes (variation_selector, out); } diff --git a/src/hb-ot-face.cc b/src/hb-ot-face.cc index c6c4ff9..388a597 100644 --- a/src/hb-ot-face.cc +++ b/src/hb-ot-face.cc @@ -37,7 +37,7 @@ #include "hb-ot-layout-gpos-table.hh" -void hb_ot_face_data_t::tables_t::init0 (hb_face_t *face) +void hb_ot_face_data_t::init0 (hb_face_t *face) { this->face = face; #define HB_OT_LAYOUT_TABLE(Namespace, Type) Type.init0 (); @@ -46,7 +46,7 @@ void hb_ot_face_data_t::tables_t::init0 (hb_face_t *face) #undef HB_OT_LAYOUT_ACCELERATOR #undef HB_OT_LAYOUT_TABLE } -void hb_ot_face_data_t::tables_t::fini (void) +void hb_ot_face_data_t::fini (void) { #define HB_OT_LAYOUT_TABLE(Namespace, Type) Type.fini (); #define HB_OT_LAYOUT_ACCELERATOR(Namespace, Type) HB_OT_LAYOUT_TABLE (Namespace, Type) @@ -62,7 +62,7 @@ _hb_ot_face_data_create (hb_face_t *face) if (unlikely (!data)) return nullptr; - data->table.init0 (face); + data->init0 (face); return data; } @@ -70,7 +70,7 @@ _hb_ot_face_data_create (hb_face_t *face) void _hb_ot_face_data_destroy (hb_ot_face_data_t *data) { - data->table.fini (); + data->fini (); free (data); } diff --git a/src/hb-ot-face.hh b/src/hb-ot-face.hh index 765627d..5ac3538 100644 --- a/src/hb-ot-face.hh +++ b/src/hb-ot-face.hh @@ -80,33 +80,29 @@ HB_OT_LAYOUT_TABLES struct hb_ot_face_data_t { - /* All the president's tables. */ - struct tables_t - { - HB_INTERNAL void init0 (hb_face_t *face); - HB_INTERNAL void fini (void); + HB_INTERNAL void init0 (hb_face_t *face); + HB_INTERNAL void fini (void); #define HB_OT_LAYOUT_TABLE_ORDER(Namespace, Type) \ - HB_PASTE (ORDER_, HB_PASTE (Namespace, HB_PASTE (_, Type))) - enum order_t - { - ORDER_ZERO, + HB_PASTE (ORDER_, HB_PASTE (Namespace, HB_PASTE (_, Type))) + enum order_t + { + ORDER_ZERO, #define HB_OT_LAYOUT_TABLE(Namespace, Type) HB_OT_LAYOUT_TABLE_ORDER (Namespace, Type), #define HB_OT_LAYOUT_ACCELERATOR(Namespace, Type) HB_OT_LAYOUT_TABLE (Namespace, Type) - HB_OT_LAYOUT_TABLES + HB_OT_LAYOUT_TABLES #undef HB_OT_LAYOUT_ACCELERATOR #undef HB_OT_LAYOUT_TABLE - }; + }; - hb_face_t *face; /* MUST be JUST before the lazy loaders. */ + hb_face_t *face; /* MUST be JUST before the lazy loaders. */ #define HB_OT_LAYOUT_TABLE(Namespace, Type) \ - hb_table_lazy_loader_t Type; + hb_table_lazy_loader_t Type; #define HB_OT_LAYOUT_ACCELERATOR(Namespace, Type) \ - hb_face_lazy_loader_t Type; - HB_OT_LAYOUT_TABLES + hb_face_lazy_loader_t Type; + HB_OT_LAYOUT_TABLES #undef HB_OT_LAYOUT_ACCELERATOR #undef HB_OT_LAYOUT_TABLE - } table; }; diff --git a/src/hb-ot-font.cc b/src/hb-ot-font.cc index e441aad..a4c5584 100644 --- a/src/hb-ot-font.cc +++ b/src/hb-ot-font.cc @@ -40,9 +40,6 @@ #include "hb-ot-color-cbdt-table.hh" -typedef hb_ot_face_data_t::tables_t hb_ot_font_t; - - static hb_bool_t hb_ot_get_nominal_glyph (hb_font_t *font HB_UNUSED, void *font_data, @@ -51,7 +48,7 @@ hb_ot_get_nominal_glyph (hb_font_t *font HB_UNUSED, void *user_data HB_UNUSED) { - const hb_ot_font_t *ot_font = (const hb_ot_font_t *) font_data; + const hb_ot_face_data_t *ot_font = (const hb_ot_face_data_t *) font_data; return ot_font->cmap.get_relaxed()->get_nominal_glyph (unicode, glyph); } @@ -63,7 +60,7 @@ hb_ot_get_variation_glyph (hb_font_t *font HB_UNUSED, hb_codepoint_t *glyph, void *user_data HB_UNUSED) { - const hb_ot_font_t *ot_font = (const hb_ot_font_t *) font_data; + const hb_ot_face_data_t *ot_font = (const hb_ot_face_data_t *) font_data; return ot_font->cmap.get_relaxed ()->get_variation_glyph (unicode, variation_selector, glyph); } @@ -73,7 +70,7 @@ hb_ot_get_glyph_h_advance (hb_font_t *font, hb_codepoint_t glyph, void *user_data HB_UNUSED) { - const hb_ot_font_t *ot_font = (const hb_ot_font_t *) font_data; + const hb_ot_face_data_t *ot_font = (const hb_ot_face_data_t *) font_data; return font->em_scale_x (ot_font->hmtx.get_relaxed ()->get_advance (glyph, font)); } @@ -83,7 +80,7 @@ hb_ot_get_glyph_v_advance (hb_font_t *font, hb_codepoint_t glyph, void *user_data HB_UNUSED) { - const hb_ot_font_t *ot_font = (const hb_ot_font_t *) font_data; + const hb_ot_face_data_t *ot_font = (const hb_ot_face_data_t *) font_data; return font->em_scale_y (-(int) ot_font->vmtx.get_relaxed ()->get_advance (glyph, font)); } @@ -94,7 +91,7 @@ hb_ot_get_glyph_h_kerning (hb_font_t *font, hb_codepoint_t right_glyph, void *user_data HB_UNUSED) { - const hb_ot_font_t *ot_font = (const hb_ot_font_t *) font_data; + const hb_ot_face_data_t *ot_font = (const hb_ot_face_data_t *) font_data; return font->em_scale_x (ot_font->kern->get_h_kerning (left_glyph, right_glyph)); } @@ -105,7 +102,7 @@ hb_ot_get_glyph_extents (hb_font_t *font, hb_glyph_extents_t *extents, void *user_data HB_UNUSED) { - const hb_ot_font_t *ot_font = (const hb_ot_font_t *) font_data; + const hb_ot_face_data_t *ot_font = (const hb_ot_face_data_t *) font_data; bool ret = ot_font->glyf->get_extents (glyph, extents); if (!ret) ret = ot_font->CBDT->get_extents (glyph, extents); @@ -124,7 +121,7 @@ hb_ot_get_glyph_name (hb_font_t *font HB_UNUSED, char *name, unsigned int size, void *user_data HB_UNUSED) { - const hb_ot_font_t *ot_font = (const hb_ot_font_t *) font_data; + const hb_ot_face_data_t *ot_font = (const hb_ot_face_data_t *) font_data; return ot_font->post->get_glyph_name (glyph, name, size); } @@ -135,7 +132,7 @@ hb_ot_get_glyph_from_name (hb_font_t *font HB_UNUSED, hb_codepoint_t *glyph, void *user_data HB_UNUSED) { - const hb_ot_font_t *ot_font = (const hb_ot_font_t *) font_data; + const hb_ot_face_data_t *ot_font = (const hb_ot_face_data_t *) font_data; return ot_font->post->get_glyph_from_name (name, len, glyph); } @@ -145,7 +142,7 @@ hb_ot_get_font_h_extents (hb_font_t *font, hb_font_extents_t *metrics, void *user_data HB_UNUSED) { - const hb_ot_font_t *ot_font = (const hb_ot_font_t *) font_data; + const hb_ot_face_data_t *ot_font = (const hb_ot_face_data_t *) font_data; metrics->ascender = font->em_scale_y (ot_font->hmtx.get_relaxed ()->ascender); metrics->descender = font->em_scale_y (ot_font->hmtx.get_relaxed ()->descender); metrics->line_gap = font->em_scale_y (ot_font->hmtx.get_relaxed ()->line_gap); @@ -159,7 +156,7 @@ hb_ot_get_font_v_extents (hb_font_t *font, hb_font_extents_t *metrics, void *user_data HB_UNUSED) { - const hb_ot_font_t *ot_font = (const hb_ot_font_t *) font_data; + const hb_ot_face_data_t *ot_font = (const hb_ot_face_data_t *) font_data; metrics->ascender = font->em_scale_x (ot_font->vmtx.get_relaxed ()->ascender); metrics->descender = font->em_scale_x (ot_font->vmtx.get_relaxed ()->descender); metrics->line_gap = font->em_scale_x (ot_font->vmtx.get_relaxed ()->line_gap); @@ -226,7 +223,7 @@ void hb_ot_font_set_funcs (hb_font_t *font) { if (unlikely (!hb_ot_shaper_face_data_ensure (font->face))) return; - hb_ot_font_t *ot_font = &hb_ot_face_data (font->face)->table; + hb_ot_face_data_t *ot_font = hb_ot_face_data (font->face); /* Load them lazies. We access them with get_relaxed() for performance. */ ot_font->cmap.get (); diff --git a/src/hb-ot-layout.cc b/src/hb-ot-layout.cc index 2763532..8b24770 100644 --- a/src/hb-ot-layout.cc +++ b/src/hb-ot-layout.cc @@ -59,35 +59,35 @@ inline const OT::GDEF& _get_gdef (hb_face_t *face) { if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return Null(OT::GDEF); - return *hb_ot_face_data (face)->table.GDEF->table; + return *hb_ot_face_data (face)->GDEF->table; } static hb_blob_t * _get_gsub_blob (hb_face_t *face) { if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return hb_blob_get_empty (); - return hb_ot_face_data (face)->table.GSUB->blob; + return hb_ot_face_data (face)->GSUB->blob; } static inline const OT::GSUB& _get_gsub (hb_face_t *face) { if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return Null(OT::GSUB); - return *hb_ot_face_data (face)->table.GSUB->table; + return *hb_ot_face_data (face)->GSUB->table; } inline const OT::GSUB& _get_gsub_relaxed (hb_face_t *face) { - return *hb_ot_face_data (face)->table.GSUB.get_relaxed ()->table; + return *hb_ot_face_data (face)->GSUB.get_relaxed ()->table; } static hb_blob_t * _get_gpos_blob (hb_face_t *face) { if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return hb_blob_get_empty (); - return hb_ot_face_data (face)->table.GPOS->blob; + return hb_ot_face_data (face)->GPOS->blob; } static inline const OT::GPOS& _get_gpos (hb_face_t *face) { if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return Null(OT::GPOS); - return *hb_ot_face_data (face)->table.GPOS->table; + return *hb_ot_face_data (face)->GPOS->table; } inline const OT::GPOS& _get_gpos_relaxed (hb_face_t *face) { - return *hb_ot_face_data (face)->table.GPOS.get_relaxed ()->table; + return *hb_ot_face_data (face)->GPOS.get_relaxed ()->table; } @@ -614,11 +614,11 @@ hb_ot_layout_table_get_lookup_count (hb_face_t *face, { case HB_OT_TAG_GSUB: { - return hb_ot_face_data (face)->table.GSUB->lookup_count; + return hb_ot_face_data (face)->GSUB->lookup_count; } case HB_OT_TAG_GPOS: { - return hb_ot_face_data (face)->table.GPOS->lookup_count; + return hb_ot_face_data (face)->GPOS->lookup_count; } } return 0; @@ -832,13 +832,13 @@ hb_ot_layout_lookup_collect_glyphs (hb_face_t *face, { case HB_OT_TAG_GSUB: { - const OT::SubstLookup& l = hb_ot_face_data (face)->table.GSUB->table->get_lookup (lookup_index); + const OT::SubstLookup& l = hb_ot_face_data (face)->GSUB->table->get_lookup (lookup_index); l.collect_glyphs (&c); return; } case HB_OT_TAG_GPOS: { - const OT::PosLookup& l = hb_ot_face_data (face)->table.GPOS->table->get_lookup (lookup_index); + const OT::PosLookup& l = hb_ot_face_data (face)->GPOS->table->get_lookup (lookup_index); l.collect_glyphs (&c); return; } @@ -911,12 +911,12 @@ hb_ot_layout_lookup_would_substitute_fast (hb_face_t *face, unsigned int glyphs_length, hb_bool_t zero_context) { - if (unlikely (lookup_index >= hb_ot_face_data (face)->table.GSUB->lookup_count)) return false; + if (unlikely (lookup_index >= hb_ot_face_data (face)->GSUB->lookup_count)) return false; OT::hb_would_apply_context_t c (face, glyphs, glyphs_length, (bool) zero_context); - const OT::SubstLookup& l = hb_ot_face_data (face)->table.GSUB->table->get_lookup (lookup_index); + const OT::SubstLookup& l = hb_ot_face_data (face)->GSUB->table->get_lookup (lookup_index); - return l.would_apply (&c, &hb_ot_face_data (face)->table.GSUB->accels[lookup_index]); + return l.would_apply (&c, &hb_ot_face_data (face)->GSUB->accels[lookup_index]); } void @@ -1073,8 +1073,8 @@ struct GSUBProxy typedef OT::SubstLookup Lookup; GSUBProxy (hb_face_t *face) : - table (*hb_ot_face_data (face)->table.GSUB->table), - accels (hb_ot_face_data (face)->table.GSUB->accels) {} + table (*hb_ot_face_data (face)->GSUB->table), + accels (hb_ot_face_data (face)->GSUB->accels) {} const OT::GSUB &table; const hb_ot_layout_lookup_accelerator_t *accels; @@ -1087,8 +1087,8 @@ struct GPOSProxy typedef OT::PosLookup Lookup; GPOSProxy (hb_face_t *face) : - table (*hb_ot_face_data (face)->table.GPOS->table), - accels (hb_ot_face_data (face)->table.GPOS->accels) {} + table (*hb_ot_face_data (face)->GPOS->table), + accels (hb_ot_face_data (face)->GPOS->accels) {} const OT::GPOS &table; const hb_ot_layout_lookup_accelerator_t *accels; diff --git a/src/hb-ot-math.cc b/src/hb-ot-math.cc index 645c3d6..c693f48 100644 --- a/src/hb-ot-math.cc +++ b/src/hb-ot-math.cc @@ -33,8 +33,8 @@ static inline const OT::MATH& _get_math (hb_face_t *face) { if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return Null(OT::MATH); - hb_ot_face_data_t * layout = hb_ot_face_data (face); - return *(layout->table.MATH.get ()); + hb_ot_face_data_t * data = hb_ot_face_data (face); + return *(data->MATH.get ()); } /* diff --git a/src/hb-ot-var.cc b/src/hb-ot-var.cc index a2f2d3e..472ee84 100644 --- a/src/hb-ot-var.cc +++ b/src/hb-ot-var.cc @@ -41,14 +41,14 @@ _get_fvar (hb_face_t *face) { if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return Null(OT::fvar); hb_ot_face_data_t *layout = hb_ot_face_data (face); - return *(layout->table.fvar.get ()); + return *(layout->fvar.get ()); } static inline const OT::avar& _get_avar (hb_face_t *face) { if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return Null(OT::avar); hb_ot_face_data_t *layout = hb_ot_face_data (face); - return *(layout->table.avar.get ()); + return *(layout->avar.get ()); } /**