From 3fbf2dece7f2a0b5820e01846da76114babe5a2f Mon Sep 17 00:00:00 2001 From: Garret Rieger Date: Tue, 28 Jun 2022 23:55:32 +0000 Subject: [PATCH] [reorg] Move OT::Layout::GPOS_impl::GPOS to OT::Layout::GPOS. --- src/Makefile.sources | 29 ++++++++++++++++++++++ src/OT/Layout/{GPOS => }/GPOS.hh | 42 +++++++++++++++----------------- src/OT/Layout/GPOS/PosLookup.hh | 2 +- src/hb-ot-layout-gpos-table.hh | 2 +- src/hb-ot-layout.cc | 2 +- src/hb-subset-plan.cc | 2 +- src/hb-subset.cc | 2 +- src/meson.build | 29 ++++++++++++++++++++++ 8 files changed, 82 insertions(+), 28 deletions(-) rename src/OT/Layout/{GPOS => }/GPOS.hh (79%) diff --git a/src/Makefile.sources b/src/Makefile.sources index 02c7a46a1..7211fb0d5 100644 --- a/src/Makefile.sources +++ b/src/Makefile.sources @@ -119,6 +119,35 @@ HB_BASE_sources = \ OT/Layout/GSUB/SubstLookupSubTable.hh \ OT/Layout/GSUB/SubstLookup.hh \ OT/Layout/GSUB/GSUB.hh \ + OT/Layout/GPOS.hh \ + OT/Layout/GPOS/CursivePosFormat1.hh \ + OT/Layout/GPOS/MarkLigPos.hh \ + OT/Layout/GPOS/PairPos.hh \ + OT/Layout/GPOS/Anchor.hh \ + OT/Layout/GPOS/AnchorFormat1.hh \ + OT/Layout/GPOS/MarkLigPosFormat1.hh \ + OT/Layout/GPOS/PairPosFormat1.hh \ + OT/Layout/GPOS/ExtensionPos.hh \ + OT/Layout/GPOS/ChainContextPos.hh \ + OT/Layout/GPOS/Common.hh \ + OT/Layout/GPOS/ValueFormat.hh \ + OT/Layout/GPOS/AnchorMatrix.hh \ + OT/Layout/GPOS/MarkBasePosFormat1.hh \ + OT/Layout/GPOS/AnchorFormat3.hh \ + OT/Layout/GPOS/PosLookup.hh \ + OT/Layout/GPOS/MarkMarkPos.hh \ + OT/Layout/GPOS/PairPosFormat2.hh \ + OT/Layout/GPOS/MarkBasePos.hh \ + OT/Layout/GPOS/MarkMarkPosFormat1.hh \ + OT/Layout/GPOS/SinglePos.hh \ + OT/Layout/GPOS/MarkArray.hh \ + OT/Layout/GPOS/CursivePos.hh \ + OT/Layout/GPOS/PosLookupSubTable.hh \ + OT/Layout/GPOS/MarkRecord.hh \ + OT/Layout/GPOS/AnchorFormat2.hh \ + OT/Layout/GPOS/ContextPos.hh \ + OT/Layout/GPOS/SinglePosFormat2.hh \ + OT/Layout/GPOS/SinglePosFormat1.hh \ hb-ot-layout-gsubgpos.hh \ hb-ot-layout-jstf-table.hh \ hb-ot-layout.cc \ diff --git a/src/OT/Layout/GPOS/GPOS.hh b/src/OT/Layout/GPOS.hh similarity index 79% rename from src/OT/Layout/GPOS/GPOS.hh rename to src/OT/Layout/GPOS.hh index f2673e9aa..91ca3e520 100644 --- a/src/OT/Layout/GPOS/GPOS.hh +++ b/src/OT/Layout/GPOS.hh @@ -1,14 +1,13 @@ -#ifndef OT_LAYOUT_GPOS_GPOS_HH -#define OT_LAYOUT_GPOS_GPOS_HH +#ifndef OT_LAYOUT_GPOS_HH +#define OT_LAYOUT_GPOS_HH -#include "../../../hb-ot-layout-common.hh" -#include "../../../hb-ot-layout-gsubgpos.hh" -#include "Common.hh" -#include "PosLookup.hh" +#include "../../hb-ot-layout-common.hh" +#include "../../hb-ot-layout-gsubgpos.hh" +#include "GPOS/Common.hh" +#include "GPOS/PosLookup.hh" namespace OT { namespace Layout { -namespace GPOS_impl { static void propagate_attachment_offsets (hb_glyph_position_t *pos, @@ -26,10 +25,10 @@ struct GPOS : GSUBGPOS { static constexpr hb_tag_t tableTag = HB_OT_TAG_GPOS; - using Lookup = PosLookup; + using Lookup = GPOS_impl::PosLookup; - const PosLookup& get_lookup (unsigned int i) const - { return static_cast (GSUBGPOS::get_lookup (i)); } + const GPOS_impl::PosLookup& get_lookup (unsigned int i) const + { return static_cast (GSUBGPOS::get_lookup (i)); } static inline void position_start (hb_font_t *font, hb_buffer_t *buffer); static inline void position_finish_advances (hb_font_t *font, hb_buffer_t *buffer); @@ -38,11 +37,11 @@ struct GPOS : GSUBGPOS bool subset (hb_subset_context_t *c) const { hb_subset_layout_context_t l (c, tableTag, c->plan->gpos_lookups, c->plan->gpos_langsys, c->plan->gpos_features); - return GSUBGPOS::subset (&l); + return GSUBGPOS::subset (&l); } bool sanitize (hb_sanitize_context_t *c) const - { return GSUBGPOS::sanitize (c); } + { return GSUBGPOS::sanitize (c); } HB_INTERNAL bool is_blocklisted (hb_blob_t *blob, hb_face_t *face) const; @@ -52,7 +51,7 @@ struct GPOS : GSUBGPOS for (unsigned i = 0; i < GSUBGPOS::get_lookup_count (); i++) { if (!c->gpos_lookups->has (i)) continue; - const PosLookup &l = get_lookup (i); + const GPOS_impl::PosLookup &l = get_lookup (i); l.dispatch (c); } } @@ -60,7 +59,7 @@ struct GPOS : GSUBGPOS void closure_lookups (hb_face_t *face, const hb_set_t *glyphs, hb_set_t *lookup_indexes /* IN/OUT */) const - { GSUBGPOS::closure_lookups (face, glyphs, lookup_indexes); } + { GSUBGPOS::closure_lookups (face, glyphs, lookup_indexes); } typedef GSUBGPOS::accelerator_t accelerator_t; }; @@ -90,16 +89,16 @@ propagate_attachment_offsets (hb_glyph_position_t *pos, propagate_attachment_offsets (pos, len, j, direction, nesting_level - 1); - assert (!!(type & ATTACH_TYPE_MARK) ^ !!(type & ATTACH_TYPE_CURSIVE)); + assert (!!(type & GPOS_impl::ATTACH_TYPE_MARK) ^ !!(type & GPOS_impl::ATTACH_TYPE_CURSIVE)); - if (type & ATTACH_TYPE_CURSIVE) + if (type & GPOS_impl::ATTACH_TYPE_CURSIVE) { if (HB_DIRECTION_IS_HORIZONTAL (direction)) pos[i].y_offset += pos[j].y_offset; else pos[i].x_offset += pos[j].x_offset; } - else /*if (type & ATTACH_TYPE_MARK)*/ + else /*if (type & GPOS_impl::ATTACH_TYPE_MARK)*/ { pos[i].x_offset += pos[j].x_offset; pos[i].y_offset += pos[j].y_offset; @@ -154,15 +153,12 @@ GPOS::position_finish_offsets (hb_font_t *font, hb_buffer_t *buffer) } } -} } -struct GPOS_accelerator_t : Layout::GPOS_impl::GPOS::accelerator_t { - GPOS_accelerator_t (hb_face_t *face) : Layout::GPOS_impl::GPOS::accelerator_t (face) {} +struct GPOS_accelerator_t : Layout::GPOS::accelerator_t { + GPOS_accelerator_t (hb_face_t *face) : Layout::GPOS::accelerator_t (face) {} }; } - - -#endif /* OT_LAYOUT_GSUB_GSUB_HH */ +#endif /* OT_LAYOUT_GPOS_HH */ diff --git a/src/OT/Layout/GPOS/PosLookup.hh b/src/OT/Layout/GPOS/PosLookup.hh index f2f3efa15..c4e57bb54 100644 --- a/src/OT/Layout/GPOS/PosLookup.hh +++ b/src/OT/Layout/GPOS/PosLookup.hh @@ -76,4 +76,4 @@ struct PosLookup : Lookup } } -#endif /* OT_LAYOUT_GPOS_SUBSTLOOKUP_HH */ +#endif /* OT_LAYOUT_GPOS_POSLOOKUP_HH */ diff --git a/src/hb-ot-layout-gpos-table.hh b/src/hb-ot-layout-gpos-table.hh index 5e847e0cb..9dcf96434 100644 --- a/src/hb-ot-layout-gpos-table.hh +++ b/src/hb-ot-layout-gpos-table.hh @@ -29,7 +29,7 @@ #ifndef HB_OT_LAYOUT_GPOS_TABLE_HH #define HB_OT_LAYOUT_GPOS_TABLE_HH -#include "OT/Layout/GPOS/GPOS.hh" +#include "OT/Layout/GPOS.hh" namespace OT { diff --git a/src/hb-ot-layout.cc b/src/hb-ot-layout.cc index 5dee07eb4..142c843da 100644 --- a/src/hb-ot-layout.cc +++ b/src/hb-ot-layout.cc @@ -55,7 +55,7 @@ #include "hb-aat-layout-opbd-table.hh" // Just so we compile it; unused otherwise. using OT::Layout::GSUB::GSUB; -using OT::Layout::GPOS_impl::GPOS; +using OT::Layout::GPOS; /** * SECTION:hb-ot-layout diff --git a/src/hb-subset-plan.cc b/src/hb-subset-plan.cc index 38175fa61..4e3bb1d47 100644 --- a/src/hb-subset-plan.cc +++ b/src/hb-subset-plan.cc @@ -41,7 +41,7 @@ #include "hb-ot-math-table.hh" using OT::Layout::GSUB::GSUB; -using OT::Layout::GPOS_impl::GPOS; +using OT::Layout::GPOS; typedef hb_hashmap_t> script_langsys_map; #ifndef HB_NO_SUBSET_CFF diff --git a/src/hb-subset.cc b/src/hb-subset.cc index bcd00c9bf..10c572c2f 100644 --- a/src/hb-subset.cc +++ b/src/hb-subset.cc @@ -56,7 +56,7 @@ #include "hb-repacker.hh" using OT::Layout::GSUB::GSUB; -using OT::Layout::GPOS_impl::GPOS; +using OT::Layout::GPOS; /** * SECTION:hb-subset diff --git a/src/meson.build b/src/meson.build index 6d7666fd7..b4fc6d408 100644 --- a/src/meson.build +++ b/src/meson.build @@ -123,6 +123,35 @@ hb_base_sources = files( 'OT/Layout/GSUB/SubstLookupSubTable.hh', 'OT/Layout/GSUB/SubstLookup.hh', 'OT/Layout/GSUB/GSUB.hh', + 'OT/Layout/GPOS.hh', + 'OT/Layout/GPOS/CursivePosFormat1.hh', + 'OT/Layout/GPOS/MarkLigPos.hh', + 'OT/Layout/GPOS/PairPos.hh', + 'OT/Layout/GPOS/Anchor.hh', + 'OT/Layout/GPOS/AnchorFormat1.hh', + 'OT/Layout/GPOS/MarkLigPosFormat1.hh', + 'OT/Layout/GPOS/PairPosFormat1.hh', + 'OT/Layout/GPOS/ExtensionPos.hh', + 'OT/Layout/GPOS/ChainContextPos.hh', + 'OT/Layout/GPOS/Common.hh', + 'OT/Layout/GPOS/ValueFormat.hh', + 'OT/Layout/GPOS/AnchorMatrix.hh', + 'OT/Layout/GPOS/MarkBasePosFormat1.hh', + 'OT/Layout/GPOS/AnchorFormat3.hh', + 'OT/Layout/GPOS/PosLookup.hh', + 'OT/Layout/GPOS/MarkMarkPos.hh', + 'OT/Layout/GPOS/PairPosFormat2.hh', + 'OT/Layout/GPOS/MarkBasePos.hh', + 'OT/Layout/GPOS/MarkMarkPosFormat1.hh', + 'OT/Layout/GPOS/SinglePos.hh', + 'OT/Layout/GPOS/MarkArray.hh', + 'OT/Layout/GPOS/CursivePos.hh', + 'OT/Layout/GPOS/PosLookupSubTable.hh', + 'OT/Layout/GPOS/MarkRecord.hh', + 'OT/Layout/GPOS/AnchorFormat2.hh', + 'OT/Layout/GPOS/ContextPos.hh', + 'OT/Layout/GPOS/SinglePosFormat2.hh', + 'OT/Layout/GPOS/SinglePosFormat1.hh', 'hb-ot-layout-gsubgpos.hh', 'hb-ot-layout-jstf-table.hh', 'hb-ot-layout.cc',