summaryrefslogtreecommitdiff
path: root/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-hmtx-table.hh
diff options
context:
space:
mode:
Diffstat (limited to 'Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-hmtx-table.hh')
-rw-r--r--Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-hmtx-table.hh51
1 files changed, 12 insertions, 39 deletions
diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-hmtx-table.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-hmtx-table.hh
index 754a3762832..11a588e3814 100644
--- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-hmtx-table.hh
+++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-hmtx-table.hh
@@ -29,8 +29,8 @@
#include "hb-open-type.hh"
#include "hb-ot-hhea-table.hh"
-#include "hb-ot-os2-table.hh"
#include "hb-ot-var-hvar-table.hh"
+#include "hb-ot-metrics.hh"
/*
* hmtx -- Horizontal Metrics
@@ -88,22 +88,22 @@ struct hmtxvmtx
template<typename Iterator,
hb_requires (hb_is_iterator (Iterator))>
- void serialize (hb_serialize_context_t *c,
- Iterator it,
+ void serialize (hb_serialize_context_t *c,
+ Iterator it,
unsigned num_advances)
{
unsigned idx = 0;
+ it
| hb_apply ([c, &idx, num_advances] (const hb_item_type<Iterator>& _)
{
- if (idx < num_advances)
+ if (idx < num_advances)
{
LongMetric lm;
lm.advance = _.first;
lm.sb = _.second;
if (unlikely (!c->embed<LongMetric> (&lm))) return;
- }
- else
+ }
+ else
{
FWORD *sb = c->allocate_size<FWORD> (FWORD::static_size);
if (unlikely (!sb)) return;
@@ -120,12 +120,12 @@ struct hmtxvmtx
T *table_prime = c->serializer->start_embed <T> ();
if (unlikely (!table_prime)) return_trace (false);
-
+
accelerator_t _mtx;
_mtx.init (c->plan->source);
unsigned num_advances = _mtx.num_advances_for_subset (c->plan);
-
- auto it =
+
+ auto it =
+ hb_range (c->plan->num_output_glyphs ())
| hb_map ([c, &_mtx] (unsigned _)
{
@@ -162,28 +162,7 @@ struct hmtxvmtx
{
default_advance = default_advance_ ? default_advance_ : hb_face_get_upem (face);
- bool got_font_extents = false;
- if (T::os2Tag != HB_TAG_NONE && face->table.OS2->is_typo_metrics ())
- {
- 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_t *_hea_blob = hb_sanitize_context_t().reference_table<H> (face);
- const H *_hea_table = _hea_blob->as<H> ();
- num_advances = _hea_table->numberOfLongMetrics;
- if (!got_font_extents)
- {
- ascender = abs (_hea_table->ascender);
- descender = -abs (_hea_table->descender);
- line_gap = _hea_table->lineGap;
- got_font_extents = (ascender | descender) != 0;
- }
- hb_blob_destroy (_hea_blob);
-
- has_font_extents = got_font_extents;
+ num_advances = T::is_horizontal ? face->table.hhea->numberOfLongMetrics : face->table.vhea->numberOfLongMetrics;
table = hb_sanitize_context_t().reference_table<hmtxvmtx> (face, T::tableTag);
@@ -277,12 +256,6 @@ struct hmtxvmtx
return get_advance (old_gid);
}
- public:
- bool has_font_extents;
- int ascender;
- int descender;
- int line_gap;
-
protected:
unsigned int num_metrics;
unsigned int num_advances;
@@ -322,12 +295,12 @@ struct hmtxvmtx
struct hmtx : hmtxvmtx<hmtx, hhea> {
static constexpr hb_tag_t tableTag = HB_OT_TAG_hmtx;
static constexpr hb_tag_t variationsTag = HB_OT_TAG_HVAR;
- static constexpr hb_tag_t os2Tag = HB_OT_TAG_OS2;
+ static constexpr bool is_horizontal = true;
};
struct vmtx : hmtxvmtx<vmtx, vhea> {
static constexpr hb_tag_t tableTag = HB_OT_TAG_vmtx;
static constexpr hb_tag_t variationsTag = HB_OT_TAG_VVAR;
- static constexpr hb_tag_t os2Tag = HB_TAG_NONE;
+ static constexpr bool is_horizontal = false;
};
struct hmtx_accelerator_t : hmtx::accelerator_t {};