[HarfBuzz] harfbuzz: Branch 'master' - 4 commits
Behdad Esfahbod
behdad at kemper.freedesktop.org
Thu Nov 15 07:49:34 UTC 2018
src/Makefile.sources | 1
src/hb-aat-layout-common.hh | 4
src/hb-aat-layout.cc | 8 -
src/hb-aat-layout.hh | 6
src/hb-ot-face.hh | 2
src/hb-ot-font.cc | 4
src/hb-ot-hmtx-table.hh | 11 -
src/hb-ot-layout-base-table.hh | 9 -
src/hb-ot-layout.cc | 2
src/hb-ot-layout.hh | 2
src/hb-ot-shape.cc | 44 ++++--
src/hb-ot-shape.hh | 6
src/hb-ot-stat-table.hh | 280 +++++++++++++++++++++++++++++++++++++++++
src/hb-shape-plan.cc | 2
src/hb-shape.cc | 2
src/hb-shaper.cc | 16 +-
src/hb-shaper.hh | 4
17 files changed, 351 insertions(+), 52 deletions(-)
New commits:
commit cabe433fbb81d314ad9e3cbed768dd13983a4477
Author: Behdad Esfahbod <behdad at behdad.org>
Date: Thu Nov 15 02:48:50 2018 -0500
[base] Add TODO items
diff --git a/src/hb-ot-layout-base-table.hh b/src/hb-ot-layout-base-table.hh
index 582e6015..fb57e762 100644
--- a/src/hb-ot-layout-base-table.hh
+++ b/src/hb-ot-layout-base-table.hh
@@ -198,6 +198,7 @@ struct MinMax
const BaseCoord **min,
const BaseCoord **max) const
{
+ /* TODO Replace hb_bsearch() with .bsearch(). */
const FeatMinMaxRecord *minMaxCoord = (const FeatMinMaxRecord *)
hb_bsearch (&feature_tag, featMinMaxRecords.arrayZ,
featMinMaxRecords.len,
@@ -230,7 +231,7 @@ struct MinMax
maxCoord; /* Offset to BaseCoord table that defines
* maximum extent value, from the beginning
* of MinMax table (may be NULL) */
- ArrayOf<FeatMinMaxRecord>
+ SortedArrayOf<FeatMinMaxRecord>
featMinMaxRecords;
/* Array of FeatMinMaxRecords, in alphabetical
* order by featureTableTag */
@@ -302,6 +303,7 @@ struct BaseScript
{
inline const MinMax &get_min_max (hb_tag_t language_tag) const
{
+ /* TODO Replace hb_bsearch() with .bsearch(). */
const BaseLangSysRecord* record = (const BaseLangSysRecord *)
hb_bsearch (&language_tag, baseLangSysRecords.arrayZ,
baseLangSysRecords.len,
@@ -332,7 +334,7 @@ struct BaseScript
OffsetTo<MinMax>
defaultMinMax; /* Offset to MinMax table, from beginning of
* BaseScript table (may be NULL) */
- ArrayOf<BaseLangSysRecord>
+ SortedArrayOf<BaseLangSysRecord>
baseLangSysRecords;
/* Number of BaseLangSysRecords
* defined — may be zero (0) */
@@ -377,6 +379,7 @@ struct BaseScriptList
{
inline const BaseScriptRecord *find_record (hb_tag_t script) const
{
+ /* TODO Replace hb_bsearch() with .bsearch(). */
return (const BaseScriptRecord *) hb_bsearch (&script, baseScriptRecords.arrayZ,
baseScriptRecords.len,
BaseScriptRecord::static_size,
@@ -400,7 +403,7 @@ struct BaseScriptList
}
protected:
- ArrayOf<BaseScriptRecord>
+ SortedArrayOf<BaseScriptRecord>
baseScriptRecords;
public:
commit 3bf1ce748fa89316dd32de28bfdc636495e657fb
Author: Behdad Esfahbod <behdad at behdad.org>
Date: Wed Nov 14 21:08:54 2018 -0500
[shaper] Rename
diff --git a/src/hb-shape-plan.cc b/src/hb-shape-plan.cc
index acb589ad..460d77b5 100644
--- a/src/hb-shape-plan.cc
+++ b/src/hb-shape-plan.cc
@@ -108,7 +108,7 @@ hb_shape_plan_key_t::init (bool copy,
}
else
{
- const hb_shaper_pair_static_t *shapers = _hb_shapers_get ();
+ const hb_shaper_entry_t *shapers = _hb_shapers_get ();
for (unsigned int i = 0; i < HB_SHAPERS_COUNT; i++)
if (false)
;
diff --git a/src/hb-shape.cc b/src/hb-shape.cc
index 325be0f1..270da3d7 100644
--- a/src/hb-shape.cc
+++ b/src/hb-shape.cc
@@ -63,7 +63,7 @@ static struct hb_shaper_list_lazy_loader_t : hb_lazy_loader_t<const char *,
if (unlikely (!shaper_list))
return nullptr;
- const hb_shaper_pair_static_t *shapers = _hb_shapers_get ();
+ const hb_shaper_entry_t *shapers = _hb_shapers_get ();
unsigned int i;
for (i = 0; i < HB_SHAPERS_COUNT; i++)
shaper_list[i] = shapers[i].name;
diff --git a/src/hb-shaper.cc b/src/hb-shaper.cc
index 58a5e497..abea544f 100644
--- a/src/hb-shaper.cc
+++ b/src/hb-shaper.cc
@@ -29,7 +29,7 @@
#include "hb-machinery.hh"
-static const hb_shaper_pair_static_t all_shapers[] = {
+static const hb_shaper_entry_t all_shapers[] = {
#define HB_SHAPER_IMPLEMENT(name) {#name, _hb_##name##_shape},
#include "hb-shaper-list.hh"
#undef HB_SHAPER_IMPLEMENT
@@ -39,16 +39,16 @@ static const hb_shaper_pair_static_t all_shapers[] = {
static void free_static_shapers (void);
#endif
-static struct hb_shapers_lazy_loader_t : hb_lazy_loader_t<const hb_shaper_pair_static_t,
+static struct hb_shapers_lazy_loader_t : hb_lazy_loader_t<const hb_shaper_entry_t,
hb_shapers_lazy_loader_t>
{
- static inline hb_shaper_pair_static_t *create (void)
+ static inline hb_shaper_entry_t *create (void)
{
char *env = getenv ("HB_SHAPER_LIST");
if (!env || !*env)
return nullptr;
- hb_shaper_pair_static_t *shapers = (hb_shaper_pair_static_t *) calloc (1, sizeof (all_shapers));
+ hb_shaper_entry_t *shapers = (hb_shaper_entry_t *) calloc (1, sizeof (all_shapers));
if (unlikely (!shapers))
return nullptr;
@@ -68,7 +68,7 @@ static struct hb_shapers_lazy_loader_t : hb_lazy_loader_t<const hb_shaper_pair_s
0 == strncmp (shapers[j].name, p, end - p))
{
/* Reorder this shaper to position i */
- struct hb_shaper_pair_static_t t = shapers[j];
+ struct hb_shaper_entry_t t = shapers[j];
memmove (&shapers[i + 1], &shapers[i], sizeof (shapers[i]) * (j - i));
shapers[i] = t;
i++;
@@ -86,11 +86,11 @@ static struct hb_shapers_lazy_loader_t : hb_lazy_loader_t<const hb_shaper_pair_s
return shapers;
}
- static inline void destroy (const hb_shaper_pair_static_t *p)
+ static inline void destroy (const hb_shaper_entry_t *p)
{
free ((void *) p);
}
- static inline const hb_shaper_pair_static_t *get_null (void)
+ static inline const hb_shaper_entry_t *get_null (void)
{
return all_shapers;
}
@@ -104,7 +104,7 @@ void free_static_shapers (void)
}
#endif
-const hb_shaper_pair_static_t *
+const hb_shaper_entry_t *
_hb_shapers_get (void)
{
return static_shapers.get_unconst ();
diff --git a/src/hb-shaper.hh b/src/hb-shaper.hh
index f29b29f9..07e88b00 100644
--- a/src/hb-shaper.hh
+++ b/src/hb-shaper.hh
@@ -40,12 +40,12 @@ typedef hb_bool_t hb_shape_func_t (hb_shape_plan_t *shape_plan,
#include "hb-shaper-list.hh"
#undef HB_SHAPER_IMPLEMENT
-struct hb_shaper_pair_static_t {
+struct hb_shaper_entry_t {
char name[16];
hb_shape_func_t *func;
};
-HB_INTERNAL const hb_shaper_pair_static_t *
+HB_INTERNAL const hb_shaper_entry_t *
_hb_shapers_get (void);
commit c221dc0ba70fd4af94d8f735a9cef1ab92cc6ede
Author: Behdad Esfahbod <behdad at behdad.org>
Date: Wed Nov 14 14:49:34 2018 -0500
[ot-shape] Move code around
diff --git a/src/hb-aat-layout-common.hh b/src/hb-aat-layout-common.hh
index adc7538c..6572b26d 100644
--- a/src/hb-aat-layout-common.hh
+++ b/src/hb-aat-layout-common.hh
@@ -801,7 +801,7 @@ struct hb_aat_apply_context_t :
static return_t default_return_value (void) { return false; }
bool stop_sublookup_iteration (return_t r) const { return r; }
- hb_ot_shape_plan_t *plan;
+ const hb_ot_shape_plan_t *plan;
hb_font_t *font;
hb_face_t *face;
hb_buffer_t *buffer;
@@ -813,7 +813,7 @@ struct hb_aat_apply_context_t :
unsigned int lookup_index;
unsigned int debug_depth;
- HB_INTERNAL hb_aat_apply_context_t (hb_ot_shape_plan_t *plan_,
+ HB_INTERNAL hb_aat_apply_context_t (const hb_ot_shape_plan_t *plan_,
hb_font_t *font_,
hb_buffer_t *buffer_,
hb_blob_t *blob = const_cast<hb_blob_t *> (&Null(hb_blob_t)));
diff --git a/src/hb-aat-layout.cc b/src/hb-aat-layout.cc
index 2e655ec1..da6908a4 100644
--- a/src/hb-aat-layout.cc
+++ b/src/hb-aat-layout.cc
@@ -135,7 +135,7 @@ hb_aat_layout_find_feature_mapping (hb_tag_t tag)
* hb_aat_apply_context_t
*/
-AAT::hb_aat_apply_context_t::hb_aat_apply_context_t (hb_ot_shape_plan_t *plan_,
+AAT::hb_aat_apply_context_t::hb_aat_apply_context_t (const hb_ot_shape_plan_t *plan_,
hb_font_t *font_,
hb_buffer_t *buffer_,
hb_blob_t *blob) :
@@ -202,7 +202,7 @@ hb_aat_layout_has_substitution (hb_face_t *face)
}
void
-hb_aat_layout_substitute (hb_ot_shape_plan_t *plan,
+hb_aat_layout_substitute (const hb_ot_shape_plan_t *plan,
hb_font_t *font,
hb_buffer_t *buffer)
{
@@ -257,7 +257,7 @@ hb_aat_layout_has_positioning (hb_face_t *face)
}
void
-hb_aat_layout_position (hb_ot_shape_plan_t *plan,
+hb_aat_layout_position (const hb_ot_shape_plan_t *plan,
hb_font_t *font,
hb_buffer_t *buffer)
{
@@ -280,7 +280,7 @@ hb_aat_layout_has_tracking (hb_face_t *face)
}
void
-hb_aat_layout_track (hb_ot_shape_plan_t *plan,
+hb_aat_layout_track (const hb_ot_shape_plan_t *plan,
hb_font_t *font,
hb_buffer_t *buffer)
{
diff --git a/src/hb-aat-layout.hh b/src/hb-aat-layout.hh
index 97935a02..1d340797 100644
--- a/src/hb-aat-layout.hh
+++ b/src/hb-aat-layout.hh
@@ -60,7 +60,7 @@ HB_INTERNAL bool
hb_aat_layout_has_substitution (hb_face_t *face);
HB_INTERNAL void
-hb_aat_layout_substitute (hb_ot_shape_plan_t *plan,
+hb_aat_layout_substitute (const hb_ot_shape_plan_t *plan,
hb_font_t *font,
hb_buffer_t *buffer);
@@ -74,7 +74,7 @@ HB_INTERNAL bool
hb_aat_layout_has_positioning (hb_face_t *face);
HB_INTERNAL void
-hb_aat_layout_position (hb_ot_shape_plan_t *plan,
+hb_aat_layout_position (const hb_ot_shape_plan_t *plan,
hb_font_t *font,
hb_buffer_t *buffer);
@@ -82,7 +82,7 @@ HB_INTERNAL bool
hb_aat_layout_has_tracking (hb_face_t *face);
HB_INTERNAL void
-hb_aat_layout_track (hb_ot_shape_plan_t *plan,
+hb_aat_layout_track (const hb_ot_shape_plan_t *plan,
hb_font_t *font,
hb_buffer_t *buffer);
diff --git a/src/hb-ot-layout.cc b/src/hb-ot-layout.cc
index ec2421e3..092633c5 100644
--- a/src/hb-ot-layout.cc
+++ b/src/hb-ot-layout.cc
@@ -72,7 +72,7 @@ hb_ot_layout_has_cross_kerning (hb_face_t *face)
}
void
-hb_ot_layout_kern (hb_ot_shape_plan_t *plan,
+hb_ot_layout_kern (const hb_ot_shape_plan_t *plan,
hb_font_t *font,
hb_buffer_t *buffer)
{
diff --git a/src/hb-ot-layout.hh b/src/hb-ot-layout.hh
index b2182531..db85508d 100644
--- a/src/hb-ot-layout.hh
+++ b/src/hb-ot-layout.hh
@@ -52,7 +52,7 @@ HB_INTERNAL bool
hb_ot_layout_has_cross_kerning (hb_face_t *face);
HB_INTERNAL void
-hb_ot_layout_kern (hb_ot_shape_plan_t *plan,
+hb_ot_layout_kern (const hb_ot_shape_plan_t *plan,
hb_font_t *font,
hb_buffer_t *buffer);
diff --git a/src/hb-ot-shape.cc b/src/hb-ot-shape.cc
index a383b782..ba65e761 100644
--- a/src/hb-ot-shape.cc
+++ b/src/hb-ot-shape.cc
@@ -181,6 +181,33 @@ hb_ot_shape_plan_t::fini (void)
aat_map.fini ();
}
+void
+hb_ot_shape_plan_t::substitute (hb_font_t *font,
+ hb_buffer_t *buffer) const
+{
+ if (unlikely (apply_morx))
+ hb_aat_layout_substitute (this, font, buffer);
+ else
+ map.substitute (this, font, buffer);
+}
+
+void
+hb_ot_shape_plan_t::position (hb_font_t *font,
+ hb_buffer_t *buffer) const
+{
+ if (this->apply_gpos)
+ map.position (this, font, buffer);
+ else if (this->apply_kerx)
+ hb_aat_layout_position (this, font, buffer);
+ else if (this->apply_kern)
+ hb_ot_layout_kern (this, font, buffer);
+ else
+ _hb_ot_shape_fallback_kern (this, font, buffer);
+
+ if (this->apply_trak)
+ hb_aat_layout_track (this, font, buffer);
+}
+
static const hb_ot_map_feature_t
common_features[] =
@@ -687,10 +714,7 @@ hb_ot_substitute_complex (const hb_ot_shape_context_t *c)
if (c->plan->fallback_glyph_classes)
hb_synthesize_glyph_classes (c->buffer);
- if (unlikely (c->plan->apply_morx))
- hb_aat_layout_substitute (c->plan, c->font, c->buffer);
- else
- c->plan->substitute (c->font, buffer);
+ c->plan->substitute (c->font, buffer);
}
static inline void
@@ -825,17 +849,7 @@ hb_ot_position_complex (const hb_ot_shape_context_t *c)
break;
}
- if (c->plan->apply_gpos)
- c->plan->position (c->font, c->buffer);
- else if (c->plan->apply_kerx)
- hb_aat_layout_position (c->plan, c->font, c->buffer);
- else if (c->plan->apply_kern)
- hb_ot_layout_kern (c->plan, c->font, c->buffer);
- else
- _hb_ot_shape_fallback_kern (c->plan, c->font, c->buffer);
-
- if (c->plan->apply_trak)
- hb_aat_layout_track (c->plan, c->font, c->buffer);
+ c->plan->position (c->font, c->buffer);
if (c->plan->zero_marks)
switch (c->plan->shaper->zero_width_marks)
diff --git a/src/hb-ot-shape.hh b/src/hb-ot-shape.hh
index b35f243e..397634c2 100644
--- a/src/hb-ot-shape.hh
+++ b/src/hb-ot-shape.hh
@@ -84,7 +84,6 @@ struct hb_ot_shape_plan_t
bool apply_morx : 1;
bool apply_trak : 1;
-
inline void collect_lookups (hb_tag_t table_tag, hb_set_t *lookups) const
{
unsigned int table_index;
@@ -95,12 +94,13 @@ struct hb_ot_shape_plan_t
}
map.collect_lookups (table_index, lookups);
}
- inline void substitute (hb_font_t *font, hb_buffer_t *buffer) const { map.substitute (this, font, buffer); }
- inline void position (hb_font_t *font, hb_buffer_t *buffer) const { map.position (this, font, buffer); }
HB_INTERNAL bool init0 (hb_face_t *face,
const hb_shape_plan_key_t *key);
HB_INTERNAL void fini (void);
+
+ HB_INTERNAL void substitute (hb_font_t *font, hb_buffer_t *buffer) const;
+ HB_INTERNAL void position (hb_font_t *font, hb_buffer_t *buffer) const;
};
struct hb_shape_plan_t;
commit 7867c2bad05fe48f9e4a1b776fb7da67b747fb4e
Author: Ebrahim Byagowi <ebrahim at gnu.org>
Date: Wed Nov 14 22:13:50 2018 +0330
[STAT] Add table parsing (#1384)
diff --git a/src/Makefile.sources b/src/Makefile.sources
index f83d6dcc..3dcd771f 100644
--- a/src/Makefile.sources
+++ b/src/Makefile.sources
@@ -158,6 +158,7 @@ HB_OT_sources = \
hb-ot-shape-fallback.hh \
hb-ot-shape-fallback.cc \
hb-ot-shape.hh \
+ hb-ot-stat-table.hh \
hb-ot-var.cc \
hb-ot-var-avar-table.hh \
hb-ot-var-fvar-table.hh \
diff --git a/src/hb-ot-face.hh b/src/hb-ot-face.hh
index 13c3a96d..3ca875e7 100644
--- a/src/hb-ot-face.hh
+++ b/src/hb-ot-face.hh
@@ -49,6 +49,8 @@
HB_OT_ACCELERATOR(OT, glyf) \
HB_OT_TABLE(OT, VORG) \
HB_OT_ACCELERATOR(OT, name) \
+ HB_OT_TABLE(OT, OS2) \
+ HB_OT_TABLE(OT, STAT) \
/* OpenType shaping. */ \
HB_OT_ACCELERATOR(OT, GDEF) \
HB_OT_ACCELERATOR(OT, GSUB) \
diff --git a/src/hb-ot-font.cc b/src/hb-ot-font.cc
index cf8cbd35..b19b25a3 100644
--- a/src/hb-ot-font.cc
+++ b/src/hb-ot-font.cc
@@ -33,10 +33,12 @@
#include "hb-ot-face.hh"
#include "hb-ot-cmap-table.hh"
+#include "hb-ot-glyf-table.hh"
#include "hb-ot-hmtx-table.hh"
#include "hb-ot-kern-table.hh"
+#include "hb-ot-os2-table.hh"
#include "hb-ot-post-table.hh"
-#include "hb-ot-glyf-table.hh"
+#include "hb-ot-stat-table.hh" // Just so we compile it; unused otherwise.
#include "hb-ot-vorg-table.hh"
#include "hb-ot-color-cbdt-table.hh"
#include "hb-ot-color-sbix-table.hh"
diff --git a/src/hb-ot-hmtx-table.hh b/src/hb-ot-hmtx-table.hh
index 80994c15..e2f55579 100644
--- a/src/hb-ot-hmtx-table.hh
+++ b/src/hb-ot-hmtx-table.hh
@@ -194,17 +194,14 @@ struct hmtxvmtx
bool got_font_extents = false;
if (T::os2Tag)
{
- hb_blob_t *os2_blob = hb_sanitize_context_t().reference_table<OS2> (face);
- const OS2 *os2_table = os2_blob->as<OS2> ();
#define USE_TYPO_METRICS (1u<<7)
- if (0 != (os2_table->fsSelection & USE_TYPO_METRICS))
+ if (0 != (face->table.OS2->fsSelection & USE_TYPO_METRICS))
{
- ascender = abs (os2_table->sTypoAscender);
- descender = -abs (os2_table->sTypoDescender);
- line_gap = os2_table->sTypoLineGap;
+ ascender = abs (face->table.OS2->sTypoAscender);
+ descender = -abs (face->table.OS2->sTypoDescender);
+ line_gap = face->table.OS2->sTypoLineGap;
got_font_extents = (ascender | descender) != 0;
}
- hb_blob_destroy (os2_blob);
}
hb_blob_t *_hea_blob = hb_sanitize_context_t().reference_table<H> (face);
diff --git a/src/hb-ot-stat-table.hh b/src/hb-ot-stat-table.hh
new file mode 100644
index 00000000..02c376e5
--- /dev/null
+++ b/src/hb-ot-stat-table.hh
@@ -0,0 +1,280 @@
+/*
+ * Copyright © 2018 Ebrahim Byagowi
+ *
+ * This is part of HarfBuzz, a text shaping library.
+ *
+ * Permission is hereby granted, without written agreement and without
+ * license or royalty fees, to use, copy, modify, and distribute this
+ * software and its documentation for any purpose, provided that the
+ * above copyright notice and the following two paragraphs appear in
+ * all copies of this software.
+ *
+ * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
+ * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
+ * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
+ * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ * DAMAGE.
+ *
+ * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
+ * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
+ * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
+ * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
+ */
+
+#ifndef HB_OT_STAT_TABLE_HH
+#define HB_OT_STAT_TABLE_HH
+
+#include "hb-open-type.hh"
+#include "hb-ot-layout-common.hh"
+
+/*
+ * STAT -- Style Attributes
+ * https://docs.microsoft.com/en-us/typography/opentype/spec/stat
+ */
+#define HB_OT_TAG_STAT HB_TAG('S','T','A','T')
+
+
+namespace OT {
+
+enum
+{
+ OLDER_SIBLING_FONT_ATTRIBUTE = 0x0001, /* If set, this axis value table
+ * provides axis value information
+ * that is applicable to other fonts
+ * within the same font family. This
+ * is used if the other fonts were
+ * released earlier and did not include
+ * information about values for some axis.
+ * If newer versions of the other
+ * fonts include the information
+ * themselves and are present,
+ * then this record is ignored. */
+ ELIDABLE_AXIS_VALUE_NAME = 0x0002 /* If set, it indicates that the axis
+ * value represents the “normal” value
+ * for the axis and may be omitted when
+ * composing name strings. */
+ // Reserved = 0xFFFC /* Reserved for future use — set to zero. */
+};
+
+struct StatAxisRecord
+{
+ inline bool sanitize (hb_sanitize_context_t *c) const
+ {
+ TRACE_SANITIZE (this);
+ return_trace (likely (c->check_struct (this)));
+ }
+
+ protected:
+ Tag axisTag; /* A tag identifying the axis of design variation. */
+ NameID axisNameID; /* The name ID for entries in the 'name' table that
+ * provide a display string for this axis. */
+ HBUINT16 axisOrdering; /* A value that applications can use to determine
+ * primary sorting of face names, or for ordering
+ * of descriptors when composing family or face names. */
+ public:
+ DEFINE_SIZE_STATIC (8);
+};
+
+struct AxisValueFormat1
+{
+ inline bool sanitize (hb_sanitize_context_t *c) const
+ {
+ TRACE_SANITIZE (this);
+ return_trace (likely (c->check_struct (this)));
+ }
+
+ protected:
+ HBUINT16 format; /* Format identifier — set to 1. */
+ HBUINT16 axisIndex; /* Zero-base index into the axis record array
+ * identifying the axis of design variation
+ * to which the axis value record applies.
+ * Must be less than designAxisCount. */
+ HBUINT16 flags; /* Flags — see below for details. */
+ NameID valueNameID; /* The name ID for entries in the 'name' table
+ * that provide a display string for this
+ * attribute value. */
+ Fixed value; /* A numeric value for this attribute value. */
+ public:
+ DEFINE_SIZE_STATIC (12);
+};
+
+struct AxisValueFormat2
+{
+ inline bool sanitize (hb_sanitize_context_t *c) const
+ {
+ TRACE_SANITIZE (this);
+ return_trace (likely (c->check_struct (this)));
+ }
+
+ protected:
+ HBUINT16 format; /* Format identifier — set to 2. */
+ HBUINT16 axisIndex; /* Zero-base index into the axis record array
+ * identifying the axis of design variation
+ * to which the axis value record applies.
+ * Must be less than designAxisCount. */
+ HBUINT16 flags; /* Flags — see below for details. */
+ NameID valueNameID; /* The name ID for entries in the 'name' table
+ * that provide a display string for this
+ * attribute value. */
+ Fixed nominalValue; /* A numeric value for this attribute value. */
+ Fixed rangeMinValue; /* The minimum value for a range associated
+ * with the specified name ID. */
+ Fixed rangeMaxValue; /* The maximum value for a range associated
+ * with the specified name ID. */
+ public:
+ DEFINE_SIZE_STATIC (20);
+};
+
+struct AxisValueFormat3
+{
+ inline bool sanitize (hb_sanitize_context_t *c) const
+ {
+ TRACE_SANITIZE (this);
+ return_trace (likely (c->check_struct (this)));
+ }
+
+ protected:
+ HBUINT16 format; /* Format identifier — set to 3. */
+ HBUINT16 axisIndex; /* Zero-base index into the axis record array
+ * identifying the axis of design variation
+ * to which the axis value record applies.
+ * Must be less than designAxisCount. */
+ HBUINT16 flags; /* Flags — see below for details. */
+ NameID valueNameID; /* The name ID for entries in the 'name' table
+ * that provide a display string for this
+ * attribute value. */
+ Fixed value; /* A numeric value for this attribute value. */
+ Fixed linkedValue; /* The numeric value for a style-linked mapping
+ * from this value. */
+ public:
+ DEFINE_SIZE_STATIC (16);
+};
+
+struct AxisValueRecord
+{
+ inline bool sanitize (hb_sanitize_context_t *c) const
+ {
+ TRACE_SANITIZE (this);
+ return_trace (likely (c->check_struct (this)));
+ }
+
+ protected:
+ HBUINT16 axisIndex; /* Zero-base index into the axis record array
+ * identifying the axis to which this value
+ * applies. Must be less than designAxisCount. */
+ Fixed value; /* A numeric value for this attribute value. */
+ public:
+ DEFINE_SIZE_STATIC (6);
+};
+
+struct AxisValueFormat4
+{
+ inline bool sanitize (hb_sanitize_context_t *c) const
+ {
+ TRACE_SANITIZE (this);
+ return_trace (likely (c->check_struct (this)));
+ }
+
+ protected:
+ HBUINT16 format; /* Format identifier — set to 4. */
+ HBUINT16 axisCount; /* The total number of axes contributing to
+ * this axis-values combination. */
+ HBUINT16 flags; /* Flags — see below for details. */
+ NameID valueNameID; /* The name ID for entries in the 'name' table
+ * that provide a display string for this
+ * attribute value. */
+ UnsizedArrayOf<AxisValueRecord>
+ axisValues; /* Array of AxisValue records that provide the
+ * combination of axis values, one for each
+ * contributing axis. */
+ public:
+ DEFINE_SIZE_ARRAY (8, axisValues);
+};
+
+struct AxisValue
+{
+ inline bool sanitize (hb_sanitize_context_t *c) const
+ {
+ TRACE_SANITIZE (this);
+ if (unlikely (c->check_struct (this)))
+ return_trace (false);
+
+ switch (u.format)
+ {
+ case 1: return_trace (likely (u.format1.sanitize (c)));
+ case 2: return_trace (likely (u.format2.sanitize (c)));
+ case 3: return_trace (likely (u.format3.sanitize (c)));
+ case 4: return_trace (likely (u.format4.sanitize (c)));
+ default: return_trace (true);
+ }
+ }
+
+ protected:
+ union
+ {
+ HBUINT16 format;
+ AxisValueFormat1 format1;
+ AxisValueFormat2 format2;
+ AxisValueFormat3 format3;
+ AxisValueFormat4 format4;
+ } u;
+ public:
+ DEFINE_SIZE_UNION (2, format);
+};
+
+struct STAT
+{
+ static const hb_tag_t tableTag = HB_OT_TAG_STAT;
+
+ inline bool sanitize (hb_sanitize_context_t *c) const
+ {
+ TRACE_SANITIZE (this);
+ return_trace (likely (c->check_struct (this) &&
+ majorVersion == 1 &&
+ minorVersion > 0 &&
+ designAxesOffset.sanitize (c, this, designAxisCount) &&
+ offsetToAxisValueOffsets.sanitize (c, this, axisValueCount, &(this+offsetToAxisValueOffsets))));
+ }
+
+ protected:
+ HBUINT16 majorVersion; /* Major version number of the style attributes
+ * table — set to 1. */
+ HBUINT16 minorVersion; /* Minor version number of the style attributes
+ * table — set to 2. */
+ HBUINT16 designAxisSize; /* The size in bytes of each axis record. */
+ HBUINT16 designAxisCount;/* The number of design axis records. In a
+ * font with an 'fvar' table, this value must be
+ * greater than or equal to the axisCount value
+ * in the 'fvar' table. In all fonts, must
+ * be greater than zero if axisValueCount
+ * is greater than zero. */
+ LOffsetTo<UnsizedArrayOf<StatAxisRecord>, false>
+ designAxesOffset;
+ /* Offset in bytes from the beginning of
+ * the STAT table to the start of the design
+ * axes array. If designAxisCount is zero,
+ * set to zero; if designAxisCount is greater
+ * than zero, must be greater than zero. */
+ HBUINT16 axisValueCount; /* The number of axis value tables. */
+ LOffsetTo<UnsizedArrayOf<OffsetTo<AxisValue> >, false>
+ offsetToAxisValueOffsets;
+ /* Offset in bytes from the beginning of
+ * the STAT table to the start of the design
+ * axes value offsets array. If axisValueCount
+ * is zero, set to zero; if axisValueCount is
+ * greater than zero, must be greater than zero. */
+ NameID elidedFallbackNameID;
+ /* Name ID used as fallback when projection of
+ * names into a particular font model produces
+ * a subfamily name containing only elidable
+ * elements. */
+ public:
+ DEFINE_SIZE_STATIC (20);
+};
+
+
+} /* namespace OT */
+
+
+#endif /* HB_OT_STAT_TABLE_HH */
More information about the HarfBuzz
mailing list