From 852985da0fb4686a2eb81b33f79f305fe4104425 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sat, 25 Jun 2022 14:41:51 -0600 Subject: [PATCH] [glyf] Split loca.hh --- src/Makefile.sources | 1 + src/OT/glyf/glyf.hh | 30 ++---------------------------- src/OT/glyf/loca.hh | 42 ++++++++++++++++++++++++++++++++++++++++++ src/meson.build | 1 + 4 files changed, 46 insertions(+), 28 deletions(-) create mode 100644 src/OT/glyf/loca.hh diff --git a/src/Makefile.sources b/src/Makefile.sources index c35a81623..07e8c1c00 100644 --- a/src/Makefile.sources +++ b/src/Makefile.sources @@ -89,6 +89,7 @@ HB_BASE_sources = \ hb-ot-layout-gpos-table.hh \ hb-ot-layout-gsub-table.hh \ OT/glyf/glyf.hh \ + OT/glyf/loca.hh \ OT/Layout/GSUB/Common.hh \ OT/Layout/GSUB/Sequence.hh \ OT/Layout/GSUB/SingleSubstFormat1.hh \ diff --git a/src/OT/glyf/glyf.hh b/src/OT/glyf/glyf.hh index 80adfaa51..11e7a614a 100644 --- a/src/OT/glyf/glyf.hh +++ b/src/OT/glyf/glyf.hh @@ -8,43 +8,17 @@ #include "hb-ot-var-gvar-table.hh" #include "hb-draw.hh" +#include "OT/glyf/loca.hh" -namespace OT { +namespace OT { -/* - * loca -- Index to Location - * https://docs.microsoft.com/en-us/typography/opentype/spec/loca - */ -#define HB_OT_TAG_loca HB_TAG('l','o','c','a') #ifndef HB_MAX_COMPOSITE_OPERATIONS #define HB_MAX_COMPOSITE_OPERATIONS 100000 #endif -struct loca -{ - friend struct glyf; - - static constexpr hb_tag_t tableTag = HB_OT_TAG_loca; - - bool sanitize (hb_sanitize_context_t *c HB_UNUSED) const - { - TRACE_SANITIZE (this); - return_trace (true); - } - - protected: - UnsizedArrayOf - dataZ; /* Location data. */ - public: - DEFINE_SIZE_MIN (0); /* In reality, this is UNBOUNDED() type; but since we always - * check the size externally, allow Null() object of it by - * defining it _MIN instead. */ -}; - - /* * glyf -- TrueType Glyph Data * https://docs.microsoft.com/en-us/typography/opentype/spec/glyf diff --git a/src/OT/glyf/loca.hh b/src/OT/glyf/loca.hh new file mode 100644 index 000000000..33f07d02c --- /dev/null +++ b/src/OT/glyf/loca.hh @@ -0,0 +1,42 @@ +#ifndef OT_GLYF_LOCA_HH +#define OT_GLYF_LOCA_HH + + +#include "hb-open-type.hh" + + +namespace OT { + + +/* + * loca -- Index to Location + * https://docs.microsoft.com/en-us/typography/opentype/spec/loca + */ +#define HB_OT_TAG_loca HB_TAG('l','o','c','a') + +struct loca +{ + friend struct glyf; + + static constexpr hb_tag_t tableTag = HB_OT_TAG_loca; + + bool sanitize (hb_sanitize_context_t *c HB_UNUSED) const + { + TRACE_SANITIZE (this); + return_trace (true); + } + + protected: + UnsizedArrayOf + dataZ; /* Location data. */ + public: + DEFINE_SIZE_MIN (0); /* In reality, this is UNBOUNDED() type; but since we always + * check the size externally, allow Null() object of it by + * defining it _MIN instead. */ +}; + + +} /* namespace OT */ + + +#endif /* OT_GLYF_LOCA_HH */ diff --git a/src/meson.build b/src/meson.build index 55bb45ed2..bb77699f5 100644 --- a/src/meson.build +++ b/src/meson.build @@ -93,6 +93,7 @@ hb_base_sources = files( 'hb-ot-layout-gpos-table.hh', 'hb-ot-layout-gsub-table.hh', 'OT/glyf/glyf.hh', + 'OT/glyf/loca.hh', 'OT/Layout/GSUB/Common.hh', 'OT/Layout/GSUB/Sequence.hh', 'OT/Layout/GSUB/SingleSubstFormat1.hh',