[hmtx] Specialize var_table
This commit is contained in:
parent
031fd20a5a
commit
eee29f7327
|
@ -151,7 +151,7 @@ hb_ot_get_glyph_h_advances (hb_font_t* font, void* font_data,
|
||||||
const OT::hmtx_accelerator_t &hmtx = *ot_face->hmtx;
|
const OT::hmtx_accelerator_t &hmtx = *ot_face->hmtx;
|
||||||
|
|
||||||
#ifndef HB_NO_VAR
|
#ifndef HB_NO_VAR
|
||||||
const OT::HVARVVAR &HVAR = *hmtx.var_table;
|
const OT::HVAR &HVAR = *hmtx.var_table;
|
||||||
const OT::VariationStore &varStore = &HVAR + HVAR.varStore;
|
const OT::VariationStore &varStore = &HVAR + HVAR.varStore;
|
||||||
OT::VariationStore::cache_t *varStore_cache = font->num_coords * count >= 128 ? varStore.create_cache () : nullptr;
|
OT::VariationStore::cache_t *varStore_cache = font->num_coords * count >= 128 ? varStore.create_cache () : nullptr;
|
||||||
|
|
||||||
|
@ -242,7 +242,7 @@ hb_ot_get_glyph_v_advances (hb_font_t* font, void* font_data,
|
||||||
if (vmtx.has_data ())
|
if (vmtx.has_data ())
|
||||||
{
|
{
|
||||||
#ifndef HB_NO_VAR
|
#ifndef HB_NO_VAR
|
||||||
const OT::HVARVVAR &VVAR = *vmtx.var_table;
|
const OT::VVAR &VVAR = *vmtx.var_table;
|
||||||
const OT::VariationStore &varStore = &VVAR + VVAR.varStore;
|
const OT::VariationStore &varStore = &VVAR + VVAR.varStore;
|
||||||
OT::VariationStore::cache_t *varStore_cache = font->num_coords ? varStore.create_cache () : nullptr;
|
OT::VariationStore::cache_t *varStore_cache = font->num_coords ? varStore.create_cache () : nullptr;
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -62,7 +62,7 @@ struct LongMetric
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
template <typename T, typename H>
|
template <typename T/*Data table type*/, typename H/*Header table type*/, typename V/*Var table type*/>
|
||||||
struct hmtxvmtx
|
struct hmtxvmtx
|
||||||
{
|
{
|
||||||
bool sanitize (hb_sanitize_context_t *c HB_UNUSED) const
|
bool sanitize (hb_sanitize_context_t *c HB_UNUSED) const
|
||||||
|
@ -173,7 +173,7 @@ struct hmtxvmtx
|
||||||
accelerator_t (hb_face_t *face)
|
accelerator_t (hb_face_t *face)
|
||||||
{
|
{
|
||||||
table = hb_sanitize_context_t ().reference_table<hmtxvmtx> (face, T::tableTag);
|
table = hb_sanitize_context_t ().reference_table<hmtxvmtx> (face, T::tableTag);
|
||||||
var_table = hb_sanitize_context_t ().reference_table<HVARVVAR> (face, T::variationsTag);
|
var_table = hb_sanitize_context_t ().reference_table<V> (face, T::variationsTag);
|
||||||
|
|
||||||
default_advance = T::is_horizontal ? hb_face_get_upem (face) / 2 : hb_face_get_upem (face);
|
default_advance = T::is_horizontal ? hb_face_get_upem (face) / 2 : hb_face_get_upem (face);
|
||||||
|
|
||||||
|
@ -313,7 +313,7 @@ struct hmtxvmtx
|
||||||
|
|
||||||
public:
|
public:
|
||||||
hb_blob_ptr_t<hmtxvmtx> table;
|
hb_blob_ptr_t<hmtxvmtx> table;
|
||||||
hb_blob_ptr_t<HVARVVAR> var_table;
|
hb_blob_ptr_t<V> var_table;
|
||||||
};
|
};
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@ -346,12 +346,12 @@ struct hmtxvmtx
|
||||||
DEFINE_SIZE_ARRAY (0, longMetricZ);
|
DEFINE_SIZE_ARRAY (0, longMetricZ);
|
||||||
};
|
};
|
||||||
|
|
||||||
struct hmtx : hmtxvmtx<hmtx, hhea> {
|
struct hmtx : hmtxvmtx<hmtx, hhea, HVAR> {
|
||||||
static constexpr hb_tag_t tableTag = HB_OT_TAG_hmtx;
|
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 variationsTag = HB_OT_TAG_HVAR;
|
||||||
static constexpr bool is_horizontal = true;
|
static constexpr bool is_horizontal = true;
|
||||||
};
|
};
|
||||||
struct vmtx : hmtxvmtx<vmtx, vhea> {
|
struct vmtx : hmtxvmtx<vmtx, vhea, VVAR> {
|
||||||
static constexpr hb_tag_t tableTag = HB_OT_TAG_vmtx;
|
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 variationsTag = HB_OT_TAG_VVAR;
|
||||||
static constexpr bool is_horizontal = false;
|
static constexpr bool is_horizontal = false;
|
||||||
|
|
Loading…
Reference in New Issue