namespace OT { namespace Layout { namespace GPOS_impl {
typedef HBUINT16 Value;
struct ValueBase {}; // Dummy base class tag for OffsetTo<Value> bases.
typedef UnsizedArrayOf<Value> ValueRecord;
struct ValueFormat : HBUINT16
{ enum Flags {
xPlacement = 0x0001u, /* Includes horizontal adjustment for placement */
yPlacement = 0x0002u, /* Includes vertical adjustment for placement */
xAdvance = 0x0004u, /* Includes horizontal adjustment for advance */
yAdvance = 0x0008u, /* Includes vertical adjustment for advance */
xPlaDevice = 0x0010u, /* Includes horizontal Device table for placement */
yPlaDevice = 0x0020u, /* Includes vertical Device table for placement */
xAdvDevice = 0x0040u, /* Includes horizontal Device table for advance */
yAdvDevice = 0x0080u, /* Includes vertical Device table for advance */
ignored = 0x0F00u, /* Was used in TrueType Open for MM fonts */
reserved = 0xF000u, /* For future use */
devices = 0x00F0u /* Mask for having any Device table */
};
/* All fields are options. Only those available advance the value pointer. */ #if0
HBINT16 xPlacement; /* Horizontal adjustment for
* placement--in design units */
HBINT16 yPlacement; /* Vertical adjustment for
* placement--in design units */
HBINT16 xAdvance; /* Horizontal adjustment for *advance--indesignunits(onlyused
* for horizontal writing) */
HBINT16 yAdvance; /* Vertical adjustment for advance--in *designunits(onlyusedforvertical
* writing) */
Offset16To<Device> xPlaDevice; /* Offset to Device table for *horizontalplacement--measuredfrom
* beginning of PosTable (may be NULL) */
Offset16To<Device> yPlaDevice; /* Offset to Device table for vertical *placement--measuredfrombeginning
* of PosTable (may be NULL) */
Offset16To<Device> xAdvDevice; /* Offset to Device table for *horizontaladvance--measuredfrom
* beginning of PosTable (may be NULL) */
Offset16To<Device> yAdvDevice; /* Offset to Device table for vertical *advance--measuredfrombeginningof
* PosTable (may be NULL) */ #endif
// Note: spec says skip 2 bytes per bit in the valueformat. But reports // from Microsoft developers indicate that only the fields that are // currently defined are counted. We don't expect any new fields to // be added to ValueFormat. As such, we use the faster hb_popcount8 // that only processes the lowest 8 bits. unsignedint get_len () const { return hb_popcount8 ((uint8_t) *this); }
size_t get_size () const { return get_len () * Value::static_size; }
hb_vector_t<unsigned> get_device_table_indices () const { unsigned i = 0;
hb_vector_t<unsigned> result; unsigned format = *this;
if (format & xPlacement) i++; if (format & yPlacement) i++; if (format & xAdvance) i++; if (format & yAdvance) i++;
if (format & xPlaDevice) result.push (i++); if (format & yPlaDevice) result.push (i++); if (format & xAdvDevice) result.push (i++); if (format & yAdvDevice) result.push (i++);
return result;
}
bool apply_value (hb_ot_apply_context_t *c, const ValueBase *base, const Value *values,
hb_glyph_position_t &glyph_pos) const
{ bool ret = false; unsignedint format = *this; if (!format) return ret;
unsignedint get_effective_format (const Value *values, bool strip_hints, bool strip_empty, const ValueBase *base, const hb_hashmap_t<unsigned, hb_pair_t<unsigned, int>> *varidx_delta_map) const
{ unsignedint format = *this; for (unsigned flag = xPlacement; flag <= yAdvDevice; flag = flag << 1) { if (format & flag)
{ if (strip_hints && flag >= xPlaDevice)
{
format = format & ~flag;
values++; continue;
} if (varidx_delta_map && flag >= xPlaDevice)
{
update_var_flag (values++, (Flags) flag, &format, base, varidx_delta_map); continue;
} /* do not strip empty when instancing, cause we don't know whether the new
* default value is 0 or not */ if (strip_empty) should_drop (*values, (Flags) flag, &format);
values++;
}
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.