minor, tweak spacing

turn 8 spaces to tab, add space before Null/Crap
This commit is contained in:
Ebrahim Byagowi 2020-04-20 14:12:45 +04:30
parent ac26f19c9e
commit 2dda6dd744
48 changed files with 315 additions and 314 deletions

View File

@ -66,7 +66,7 @@ struct ankr
{ {
const NNOffsetTo<GlyphAnchors> *offset = (this+lookupTable).get_value (glyph_id, num_glyphs); const NNOffsetTo<GlyphAnchors> *offset = (this+lookupTable).get_value (glyph_id, num_glyphs);
if (!offset) if (!offset)
return Null(Anchor); return Null (Anchor);
const GlyphAnchors &anchors = &(this+anchorData) + *offset; const GlyphAnchors &anchors = &(this+anchorData) + *offset;
return anchors[i]; return anchors[i];
} }

View File

@ -303,7 +303,7 @@ struct LookupFormat10
const typename T::type get_value_or_null (hb_codepoint_t glyph_id) const const typename T::type get_value_or_null (hb_codepoint_t glyph_id) const
{ {
if (!(firstGlyph <= glyph_id && glyph_id - firstGlyph < glyphCount)) if (!(firstGlyph <= glyph_id && glyph_id - firstGlyph < glyphCount))
return Null(T); return Null (T);
const HBUINT8 *p = &valueArrayZ[(glyph_id - firstGlyph) * valueSize]; const HBUINT8 *p = &valueArrayZ[(glyph_id - firstGlyph) * valueSize];
@ -358,7 +358,7 @@ struct Lookup
case 10: return u.format10.get_value_or_null (glyph_id); case 10: return u.format10.get_value_or_null (glyph_id);
default: default:
const T *v = get_value (glyph_id, num_glyphs); const T *v = get_value (glyph_id, num_glyphs);
return v ? *v : Null(T); return v ? *v : Null (T);
} }
} }
@ -825,7 +825,7 @@ struct hb_aat_apply_context_t :
HB_INTERNAL hb_aat_apply_context_t (const 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_font_t *font_,
hb_buffer_t *buffer_, hb_buffer_t *buffer_,
hb_blob_t *blob = const_cast<hb_blob_t *> (&Null(hb_blob_t))); hb_blob_t *blob = const_cast<hb_blob_t *> (&Null (hb_blob_t)));
HB_INTERNAL ~hb_aat_apply_context_t (); HB_INTERNAL ~hb_aat_apply_context_t ();

View File

@ -948,9 +948,9 @@ struct Chain
hb_aat_layout_feature_type_t type = (hb_aat_layout_feature_type_t) (unsigned int) feature.featureType; hb_aat_layout_feature_type_t type = (hb_aat_layout_feature_type_t) (unsigned int) feature.featureType;
hb_aat_layout_feature_selector_t setting = (hb_aat_layout_feature_selector_t) (unsigned int) feature.featureSetting; hb_aat_layout_feature_selector_t setting = (hb_aat_layout_feature_selector_t) (unsigned int) feature.featureSetting;
retry: retry:
// Check whether this type/setting pair was requested in the map, and if so, apply its flags. // Check whether this type/setting pair was requested in the map, and if so, apply its flags.
// (The search here only looks at the type and setting fields of feature_info_t.) // (The search here only looks at the type and setting fields of feature_info_t.)
hb_aat_map_builder_t::feature_info_t info = { type, setting, false, 0 }; hb_aat_map_builder_t::feature_info_t info = { type, setting, false, 0 };
if (map->features.bsearch (info)) if (map->features.bsearch (info))
{ {
flags &= feature.disableFlags; flags &= feature.disableFlags;

View File

@ -55,7 +55,7 @@ AAT::hb_aat_apply_context_t::hb_aat_apply_context_t (const hb_ot_shape_plan_t *p
face (font->face), face (font->face),
buffer (buffer_), buffer (buffer_),
sanitizer (), sanitizer (),
ankr_table (&Null(AAT::ankr)), ankr_table (&Null (AAT::ankr)),
lookup_index (0), lookup_index (0),
debug_depth (0) debug_depth (0)
{ {

View File

@ -62,7 +62,7 @@ void hb_aat_map_builder_t::add_feature (hb_tag_t tag, unsigned value)
* small-caps if necessary, so we need to check for that possibility. * small-caps if necessary, so we need to check for that possibility.
* https://github.com/harfbuzz/harfbuzz/issues/2307 */ * https://github.com/harfbuzz/harfbuzz/issues/2307 */
if (mapping->aatFeatureType == HB_AAT_LAYOUT_FEATURE_TYPE_LOWER_CASE && if (mapping->aatFeatureType == HB_AAT_LAYOUT_FEATURE_TYPE_LOWER_CASE &&
mapping->selectorToEnable == HB_AAT_LAYOUT_FEATURE_SELECTOR_LOWER_CASE_SMALL_CAPS) mapping->selectorToEnable == HB_AAT_LAYOUT_FEATURE_SELECTOR_LOWER_CASE_SMALL_CAPS)
{ {
feature = &face->table.feat->get_feature (HB_AAT_LAYOUT_FEATURE_TYPE_LETTER_CASE); feature = &face->table.feat->get_feature (HB_AAT_LAYOUT_FEATURE_TYPE_LETTER_CASE);
if (!feature->has_data ()) return; if (!feature->has_data ()) return;
@ -87,10 +87,10 @@ hb_aat_map_builder_t::compile (hb_aat_map_t &m)
unsigned int j = 0; unsigned int j = 0;
for (unsigned int i = 1; i < features.length; i++) for (unsigned int i = 1; i < features.length; i++)
if (features[i].type != features[j].type || if (features[i].type != features[j].type ||
/* Nonexclusive feature selectors come in even/odd pairs to turn a setting on/off /* Nonexclusive feature selectors come in even/odd pairs to turn a setting on/off
* respectively, so we mask out the low-order bit when checking for "duplicates" * respectively, so we mask out the low-order bit when checking for "duplicates"
* (selectors referring to the same feature setting) here. */ * (selectors referring to the same feature setting) here. */
(!features[i].is_exclusive && ((features[i].setting & ~1) != (features[j].setting & ~1)))) (!features[i].is_exclusive && ((features[i].setting & ~1) != (features[j].setting & ~1))))
features[++j] = features[i]; features[++j] = features[i];
features.shrink (j + 1); features.shrink (j + 1);
} }

View File

@ -73,7 +73,7 @@ struct hb_aat_map_builder_t
const feature_info_t *b = (const feature_info_t *) pb; const feature_info_t *b = (const feature_info_t *) pb;
if (a->type != b->type) return (a->type < b->type ? -1 : 1); if (a->type != b->type) return (a->type < b->type ? -1 : 1);
if (!a->is_exclusive && if (!a->is_exclusive &&
(a->setting & ~1) != (b->setting & ~1)) return (a->setting < b->setting ? -1 : 1); (a->setting & ~1) != (b->setting & ~1)) return (a->setting < b->setting ? -1 : 1);
return (a->seq < b->seq ? -1 : a->seq > b->seq ? 1 : 0); return (a->seq < b->seq ? -1 : a->seq > b->seq ? 1 : 0);
} }
@ -81,7 +81,7 @@ struct hb_aat_map_builder_t
int cmp (const feature_info_t& f) const int cmp (const feature_info_t& f) const
{ {
return (f.type != type) ? (f.type < type ? -1 : 1) : return (f.type != type) ? (f.type < type ? -1 : 1) :
(f.setting != setting) ? (f.setting < setting ? -1 : 1) : 0; (f.setting != setting) ? (f.setting < setting ? -1 : 1) : 0;
} }
}; };

View File

@ -189,7 +189,7 @@ hb_blob_copy_writable_or_fail (hb_blob_t *blob)
hb_blob_t * hb_blob_t *
hb_blob_get_empty () hb_blob_get_empty ()
{ {
return const_cast<hb_blob_t *> (&Null(hb_blob_t)); return const_cast<hb_blob_t *> (&Null (hb_blob_t));
} }
/** /**

View File

@ -715,7 +715,7 @@ hb_buffer_create ()
hb_buffer_t * hb_buffer_t *
hb_buffer_get_empty () hb_buffer_get_empty ()
{ {
return const_cast<hb_buffer_t *> (&Null(hb_buffer_t)); return const_cast<hb_buffer_t *> (&Null (hb_buffer_t));
} }
/** /**

View File

@ -365,7 +365,7 @@ hb_buffer_clear_contents (hb_buffer_t *buffer);
HB_EXTERN hb_bool_t HB_EXTERN hb_bool_t
hb_buffer_pre_allocate (hb_buffer_t *buffer, hb_buffer_pre_allocate (hb_buffer_t *buffer,
unsigned int size); unsigned int size);
HB_EXTERN hb_bool_t HB_EXTERN hb_bool_t

View File

@ -228,10 +228,10 @@ struct hb_buffer_t
/* Makes a copy of the glyph at idx to output and replace glyph_index */ /* Makes a copy of the glyph at idx to output and replace glyph_index */
hb_glyph_info_t & output_glyph (hb_codepoint_t glyph_index) hb_glyph_info_t & output_glyph (hb_codepoint_t glyph_index)
{ {
if (unlikely (!make_room_for (0, 1))) return Crap(hb_glyph_info_t); if (unlikely (!make_room_for (0, 1))) return Crap (hb_glyph_info_t);
if (unlikely (idx == len && !out_len)) if (unlikely (idx == len && !out_len))
return Crap(hb_glyph_info_t); return Crap (hb_glyph_info_t);
out_info[out_len] = idx < len ? info[idx] : out_info[out_len - 1]; out_info[out_len] = idx < len ? info[idx] : out_info[out_len - 1];
out_info[out_len].codepoint = glyph_index; out_info[out_len].codepoint = glyph_index;

View File

@ -405,7 +405,7 @@ struct cff_stack_t
else else
{ {
set_error (); set_error ();
return Crap(ELEM); return Crap (ELEM);
} }
} }
@ -416,7 +416,7 @@ struct cff_stack_t
else else
{ {
set_error (); set_error ();
return Crap(ELEM); return Crap (ELEM);
} }
} }
void pop (unsigned int n) void pop (unsigned int n)
@ -432,7 +432,7 @@ struct cff_stack_t
if (unlikely (count < 0)) if (unlikely (count < 0))
{ {
set_error (); set_error ();
return Null(ELEM); return Null (ELEM);
} }
return elements[count - 1]; return elements[count - 1];
} }

View File

@ -82,7 +82,7 @@ struct biased_subrs_t
byte_str_t operator [] (unsigned int index) const byte_str_t operator [] (unsigned int index) const
{ {
if (unlikely ((subrs == nullptr) || index >= subrs->count)) if (unlikely ((subrs == nullptr) || index >= subrs->count))
return Null(byte_str_t); return Null (byte_str_t);
else else
return (*subrs)[index]; return (*subrs)[index];
} }

View File

@ -90,7 +90,7 @@ struct cff2_cs_interp_env_t : cs_interp_env_t<blend_arg_t, CFF2Subrs>
seen_blend = false; seen_blend = false;
seen_vsindex_ = false; seen_vsindex_ = false;
scalars.init (); scalars.init ();
do_blend = (coords != nullptr) && num_coords && (varStore != &Null(CFF2VariationStore)); do_blend = (coords != nullptr) && num_coords && (varStore != &Null (CFF2VariationStore));
set_ivs (acc.privateDicts[fd].ivs); set_ivs (acc.privateDicts[fd].ivs);
} }

View File

@ -92,7 +92,7 @@ struct draw_helper_t
hb_position_t to_x, hb_position_t to_y) hb_position_t to_x, hb_position_t to_y)
{ {
if (equal_to_current (control1_x, control1_y) && if (equal_to_current (control1_x, control1_y) &&
equal_to_current (control2_x, control2_y) && equal_to_current (control2_x, control2_y) &&
equal_to_current (to_x, to_y)) equal_to_current (to_x, to_y))
return; return;
if (!path_open) start_path (); if (!path_open) start_path ();

View File

@ -226,7 +226,7 @@ hb_face_create (hb_blob_t *blob,
hb_face_t * hb_face_t *
hb_face_get_empty () hb_face_get_empty ()
{ {
return const_cast<hb_face_t *> (&Null(hb_face_t)); return const_cast<hb_face_t *> (&Null (hb_face_t));
} }

View File

@ -1465,7 +1465,7 @@ hb_font_create_sub_font (hb_font_t *parent)
hb_font_t * hb_font_t *
hb_font_get_empty () hb_font_get_empty ()
{ {
return const_cast<hb_font_t *> (&Null(hb_font_t)); return const_cast<hb_font_t *> (&Null (hb_font_t));
} }
/** /**

View File

@ -287,7 +287,7 @@ struct hb_font_t
} }
hb_bool_t get_glyph_h_origin (hb_codepoint_t glyph, hb_bool_t get_glyph_h_origin (hb_codepoint_t glyph,
hb_position_t *x, hb_position_t *y) hb_position_t *x, hb_position_t *y)
{ {
*x = *y = 0; *x = *y = 0;
return klass->get.f.glyph_h_origin (this, user_data, return klass->get.f.glyph_h_origin (this, user_data,

View File

@ -234,7 +234,7 @@ struct hb_lazy_loader_t : hb_data_wrapper_t<Data, WheresData>
static Returned* convert (Stored *p) { return p; } static Returned* convert (Stored *p) { return p; }
/* By default null/init/fini the object. */ /* By default null/init/fini the object. */
static const Stored* get_null () { return &Null(Stored); } static const Stored* get_null () { return &Null (Stored); }
static Stored *create (Data *data) static Stored *create (Data *data)
{ {
Stored *p = (Stored *) calloc (1, sizeof (Stored)); Stored *p = (Stored *) calloc (1, sizeof (Stored));

View File

@ -69,7 +69,7 @@ hb_map_create ()
hb_map_t * hb_map_t *
hb_map_get_empty () hb_map_get_empty ()
{ {
return const_cast<hb_map_t *> (&Null(hb_map_t)); return const_cast<hb_map_t *> (&Null (hb_map_t));
} }
/** /**

View File

@ -135,8 +135,8 @@ struct hb_hashmap_t
for (unsigned int i = 0; i < old_size; i++) for (unsigned int i = 0; i < old_size; i++)
if (old_items[i].is_real ()) if (old_items[i].is_real ())
set_with_hash (old_items[i].key, set_with_hash (old_items[i].key,
old_items[i].hash, old_items[i].hash,
old_items[i].value); old_items[i].value);
free (old_items); free (old_items);

View File

@ -135,7 +135,7 @@ template <typename Type>
static inline Type& Crap () { static inline Type& Crap () {
static_assert (hb_null_size (Type) <= HB_NULL_POOL_SIZE, "Increase HB_NULL_POOL_SIZE."); static_assert (hb_null_size (Type) <= HB_NULL_POOL_SIZE, "Increase HB_NULL_POOL_SIZE.");
Type *obj = reinterpret_cast<Type *> (_hb_CrapPool); Type *obj = reinterpret_cast<Type *> (_hb_CrapPool);
memcpy (obj, &Null(Type), sizeof (*obj)); memcpy (obj, &Null (Type), sizeof (*obj));
return *obj; return *obj;
} }
template <typename QType> template <typename QType>
@ -148,11 +148,11 @@ struct CrapHelper
template <typename Type> template <typename Type>
struct CrapOrNullHelper { struct CrapOrNullHelper {
static Type & get () { return Crap(Type); } static Type & get () { return Crap (Type); }
}; };
template <typename Type> template <typename Type>
struct CrapOrNullHelper<const Type> { struct CrapOrNullHelper<const Type> {
static const Type & get () { return Null(Type); } static const Type & get () { return Null (Type); }
}; };
#define CrapOrNull(Type) CrapOrNullHelper<Type>::get () #define CrapOrNull(Type) CrapOrNullHelper<Type>::get ()
@ -174,7 +174,7 @@ struct hb_nonnull_ptr_t
/* Only auto-cast to const types. */ /* Only auto-cast to const types. */
template <typename C> operator const C * () const { return get (); } template <typename C> operator const C * () const { return get (); }
operator const char * () const { return (const char *) get (); } operator const char * () const { return (const char *) get (); }
T * get () const { return v ? v : const_cast<T *> (&Null(T)); } T * get () const { return v ? v : const_cast<T *> (&Null (T)); }
T * get_raw () const { return v; } T * get_raw () const { return v; }
T *v; T *v;

View File

@ -249,7 +249,7 @@ struct TTCHeader
switch (u.header.version.major) { switch (u.header.version.major) {
case 2: /* version 2 is compatible with version 1 */ case 2: /* version 2 is compatible with version 1 */
case 1: return u.version1.get_face (i); case 1: return u.version1.get_face (i);
default:return Null(OpenTypeFontFace); default:return Null (OpenTypeFontFace);
} }
} }
@ -478,7 +478,7 @@ struct OpenTypeFontFile
case TrueTypeTag: return u.fontFace; case TrueTypeTag: return u.fontFace;
case TTCTag: return u.ttcHeader.get_face (i); case TTCTag: return u.ttcHeader.get_face (i);
case DFontTag: return u.rfHeader.get_face (i, base_offset); case DFontTag: return u.rfHeader.get_face (i, base_offset);
default: return Null(OpenTypeFontFace); default: return Null (OpenTypeFontFace);
} }
} }

View File

@ -260,7 +260,7 @@ struct CFFIndex
unsigned int length_at (unsigned int index) const unsigned int length_at (unsigned int index) const
{ {
if (unlikely ((offset_at (index + 1) < offset_at (index)) || if (unlikely ((offset_at (index + 1) < offset_at (index)) ||
(offset_at (index + 1) > offset_at (count)))) (offset_at (index + 1) > offset_at (count))))
return 0; return 0;
return offset_at (index + 1) - offset_at (index); return offset_at (index + 1) - offset_at (index);
} }
@ -321,7 +321,7 @@ struct CFFIndexOf : CFFIndex<COUNT>
{ {
if (likely (index < CFFIndex<COUNT>::count)) if (likely (index < CFFIndex<COUNT>::count))
return byte_str_t (CFFIndex<COUNT>::data_base () + CFFIndex<COUNT>::offset_at (index) - 1, CFFIndex<COUNT>::length_at (index)); return byte_str_t (CFFIndex<COUNT>::data_base () + CFFIndex<COUNT>::offset_at (index) - 1, CFFIndex<COUNT>::length_at (index));
return Null(byte_str_t); return Null (byte_str_t);
} }
template <typename DATA, typename PARAM1, typename PARAM2> template <typename DATA, typename PARAM1, typename PARAM2>

View File

@ -570,13 +570,13 @@ struct Charset
struct CFF1StringIndex : CFF1Index struct CFF1StringIndex : CFF1Index
{ {
bool serialize (hb_serialize_context_t *c, const CFF1StringIndex &strings, bool serialize (hb_serialize_context_t *c, const CFF1StringIndex &strings,
const hb_inc_bimap_t &sidmap) const hb_inc_bimap_t &sidmap)
{ {
TRACE_SERIALIZE (this); TRACE_SERIALIZE (this);
if (unlikely ((strings.count == 0) || (sidmap.get_population () == 0))) if (unlikely ((strings.count == 0) || (sidmap.get_population () == 0)))
{ {
if (unlikely (!c->extend_min (this->count))) if (unlikely (!c->extend_min (this->count)))
return_trace (false); return_trace (false);
count = 0; count = 0;
return_trace (true); return_trace (true);
} }
@ -589,7 +589,7 @@ struct CFF1StringIndex : CFF1Index
{ {
hb_codepoint_t j = sidmap[i]; hb_codepoint_t j = sidmap[i];
if (j != HB_MAP_VALUE_INVALID) if (j != HB_MAP_VALUE_INVALID)
bytesArray[j] = strings[i]; bytesArray[j] = strings[i];
} }
bool result = CFF1Index::serialize (c, bytesArray); bool result = CFF1Index::serialize (c, bytesArray);
@ -840,7 +840,7 @@ struct cff1_private_dict_values_base_t : dict_values_t<VAL>
{ {
dict_values_t<VAL>::init (); dict_values_t<VAL>::init ();
subrsOffset = 0; subrsOffset = 0;
localSubrs = &Null(CFF1Subrs); localSubrs = &Null (CFF1Subrs);
} }
void fini () { dict_values_t<VAL>::fini (); } void fini () { dict_values_t<VAL>::fini (); }
@ -950,7 +950,7 @@ struct cff1_font_dict_values_mod_t
{ {
cff1_font_dict_values_mod_t() { init (); } cff1_font_dict_values_mod_t() { init (); }
void init () { init ( &Null(cff1_font_dict_values_t), CFF_UNDEF_SID ); } void init () { init ( &Null (cff1_font_dict_values_t), CFF_UNDEF_SID ); }
void init (const cff1_font_dict_values_t *base_, void init (const cff1_font_dict_values_t *base_,
unsigned int fontName_) unsigned int fontName_)
@ -1011,7 +1011,7 @@ struct cff1
const OT::cff1 *cff = this->blob->template as<OT::cff1> (); const OT::cff1 *cff = this->blob->template as<OT::cff1> ();
if (cff == &Null(OT::cff1)) if (cff == &Null (OT::cff1))
{ fini (); return; } { fini (); return; }
nameIndex = &cff->nameIndex (cff); nameIndex = &cff->nameIndex (cff);
@ -1032,7 +1032,7 @@ struct cff1
} }
if (is_predef_charset ()) if (is_predef_charset ())
charset = &Null(Charset); charset = &Null (Charset);
else else
{ {
charset = &StructAtOffsetOrNull<Charset> (cff, topDict.CharsetOffset); charset = &StructAtOffsetOrNull<Charset> (cff, topDict.CharsetOffset);
@ -1044,22 +1044,22 @@ struct cff1
{ {
fdArray = &StructAtOffsetOrNull<CFF1FDArray> (cff, topDict.FDArrayOffset); fdArray = &StructAtOffsetOrNull<CFF1FDArray> (cff, topDict.FDArrayOffset);
fdSelect = &StructAtOffsetOrNull<CFF1FDSelect> (cff, topDict.FDSelectOffset); fdSelect = &StructAtOffsetOrNull<CFF1FDSelect> (cff, topDict.FDSelectOffset);
if (unlikely ((fdArray == &Null(CFF1FDArray)) || !fdArray->sanitize (&sc) || if (unlikely ((fdArray == &Null (CFF1FDArray)) || !fdArray->sanitize (&sc) ||
(fdSelect == &Null(CFF1FDSelect)) || !fdSelect->sanitize (&sc, fdArray->count))) (fdSelect == &Null (CFF1FDSelect)) || !fdSelect->sanitize (&sc, fdArray->count)))
{ fini (); return; } { fini (); return; }
fdCount = fdArray->count; fdCount = fdArray->count;
} }
else else
{ {
fdArray = &Null(CFF1FDArray); fdArray = &Null (CFF1FDArray);
fdSelect = &Null(CFF1FDSelect); fdSelect = &Null (CFF1FDSelect);
} }
encoding = &Null(Encoding); encoding = &Null (Encoding);
if (is_CID ()) if (is_CID ())
{ {
if (unlikely (charset == &Null(Charset))) { fini (); return; } if (unlikely (charset == &Null (Charset))) { fini (); return; }
} }
else else
{ {
@ -1080,7 +1080,7 @@ struct cff1
charStrings = &StructAtOffsetOrNull<CFF1CharStrings> (cff, topDict.charStringsOffset); charStrings = &StructAtOffsetOrNull<CFF1CharStrings> (cff, topDict.charStringsOffset);
if ((charStrings == &Null(CFF1CharStrings)) || unlikely (!charStrings->sanitize (&sc))) if ((charStrings == &Null (CFF1CharStrings)) || unlikely (!charStrings->sanitize (&sc)))
{ fini (); return; } { fini (); return; }
num_glyphs = charStrings->count; num_glyphs = charStrings->count;
@ -1098,14 +1098,14 @@ struct cff1
{ {
byte_str_t fontDictStr = (*fdArray)[i]; byte_str_t fontDictStr = (*fdArray)[i];
if (unlikely (!fontDictStr.sanitize (&sc))) { fini (); return; } if (unlikely (!fontDictStr.sanitize (&sc))) { fini (); return; }
cff1_font_dict_values_t *font; cff1_font_dict_values_t *font;
cff1_font_dict_interpreter_t font_interp; cff1_font_dict_interpreter_t font_interp;
font_interp.env.init (fontDictStr); font_interp.env.init (fontDictStr);
font = fontDicts.push (); font = fontDicts.push ();
if (unlikely (font == &Crap(cff1_font_dict_values_t))) { fini (); return; } if (unlikely (font == &Crap (cff1_font_dict_values_t))) { fini (); return; }
font->init (); font->init ();
if (unlikely (!font_interp.interpret (*font))) { fini (); return; } if (unlikely (!font_interp.interpret (*font))) { fini (); return; }
PRIVDICTVAL *priv = &privateDicts[i]; PRIVDICTVAL *priv = &privateDicts[i];
const byte_str_t privDictStr (StructAtOffset<UnsizedByteStr> (cff, font->privateDictInfo.offset), font->privateDictInfo.size); const byte_str_t privDictStr (StructAtOffset<UnsizedByteStr> (cff, font->privateDictInfo.offset), font->privateDictInfo.size);
if (unlikely (!privDictStr.sanitize (&sc))) { fini (); return; } if (unlikely (!privDictStr.sanitize (&sc))) { fini (); return; }
dict_interpreter_t<PRIVOPSET, PRIVDICTVAL> priv_interp; dict_interpreter_t<PRIVOPSET, PRIVDICTVAL> priv_interp;
@ -1114,15 +1114,15 @@ struct cff1
if (unlikely (!priv_interp.interpret (*priv))) { fini (); return; } if (unlikely (!priv_interp.interpret (*priv))) { fini (); return; }
priv->localSubrs = &StructAtOffsetOrNull<CFF1Subrs> (&privDictStr, priv->subrsOffset); priv->localSubrs = &StructAtOffsetOrNull<CFF1Subrs> (&privDictStr, priv->subrsOffset);
if (priv->localSubrs != &Null(CFF1Subrs) && if (priv->localSubrs != &Null (CFF1Subrs) &&
unlikely (!priv->localSubrs->sanitize (&sc))) unlikely (!priv->localSubrs->sanitize (&sc)))
{ fini (); return; } { fini (); return; }
} }
} }
else /* non-CID */ else /* non-CID */
{ {
cff1_top_dict_values_t *font = &topDict; cff1_top_dict_values_t *font = &topDict;
PRIVDICTVAL *priv = &privateDicts[0]; PRIVDICTVAL *priv = &privateDicts[0];
const byte_str_t privDictStr (StructAtOffset<UnsizedByteStr> (cff, font->privateDictInfo.offset), font->privateDictInfo.size); const byte_str_t privDictStr (StructAtOffset<UnsizedByteStr> (cff, font->privateDictInfo.offset), font->privateDictInfo.size);
if (unlikely (!privDictStr.sanitize (&sc))) { fini (); return; } if (unlikely (!privDictStr.sanitize (&sc))) { fini (); return; }
@ -1132,7 +1132,7 @@ struct cff1
if (unlikely (!priv_interp.interpret (*priv))) { fini (); return; } if (unlikely (!priv_interp.interpret (*priv))) { fini (); return; }
priv->localSubrs = &StructAtOffsetOrNull<CFF1Subrs> (&privDictStr, priv->subrsOffset); priv->localSubrs = &StructAtOffsetOrNull<CFF1Subrs> (&privDictStr, priv->subrsOffset);
if (priv->localSubrs != &Null(CFF1Subrs) && if (priv->localSubrs != &Null (CFF1Subrs) &&
unlikely (!priv->localSubrs->sanitize (&sc))) unlikely (!priv->localSubrs->sanitize (&sc)))
{ fini (); return; } { fini (); return; }
} }
@ -1159,7 +1159,7 @@ struct cff1
if (unlikely (sid == CFF_UNDEF_SID)) if (unlikely (sid == CFF_UNDEF_SID))
return 0; return 0;
if (charset != &Null(Charset)) if (charset != &Null (Charset))
return charset->get_glyph (sid, num_glyphs); return charset->get_glyph (sid, num_glyphs);
else if ((topDict.CharsetOffset == ISOAdobeCharset) else if ((topDict.CharsetOffset == ISOAdobeCharset)
&& (code <= 228 /*zcaron*/)) return sid; && (code <= 228 /*zcaron*/)) return sid;
@ -1170,7 +1170,7 @@ struct cff1
hb_codepoint_t glyph_to_code (hb_codepoint_t glyph) const hb_codepoint_t glyph_to_code (hb_codepoint_t glyph) const
{ {
if (encoding != &Null(Encoding)) if (encoding != &Null (Encoding))
return encoding->get_code (glyph); return encoding->get_code (glyph);
else else
{ {
@ -1194,20 +1194,20 @@ struct cff1
hb_codepoint_t glyph_to_sid (hb_codepoint_t glyph) const hb_codepoint_t glyph_to_sid (hb_codepoint_t glyph) const
{ {
if (charset != &Null(Charset)) if (charset != &Null (Charset))
return charset->get_sid (glyph, num_glyphs); return charset->get_sid (glyph, num_glyphs);
else else
{ {
hb_codepoint_t sid = 0; hb_codepoint_t sid = 0;
switch (topDict.CharsetOffset) switch (topDict.CharsetOffset)
{ {
case ISOAdobeCharset: case ISOAdobeCharset:
if (glyph <= 228 /*zcaron*/) sid = glyph; if (glyph <= 228 /*zcaron*/) sid = glyph;
break; break;
case ExpertCharset: case ExpertCharset:
sid = lookup_expert_charset_for_sid (glyph); sid = lookup_expert_charset_for_sid (glyph);
break; break;
case ExpertSubsetCharset: case ExpertSubsetCharset:
sid = lookup_expert_subset_charset_for_sid (glyph); sid = lookup_expert_subset_charset_for_sid (glyph);
break; break;
default: default:
@ -1219,31 +1219,31 @@ struct cff1
hb_codepoint_t sid_to_glyph (hb_codepoint_t sid) const hb_codepoint_t sid_to_glyph (hb_codepoint_t sid) const
{ {
if (charset != &Null(Charset)) if (charset != &Null (Charset))
return charset->get_glyph (sid, num_glyphs); return charset->get_glyph (sid, num_glyphs);
else else
{ {
hb_codepoint_t glyph = 0; hb_codepoint_t glyph = 0;
switch (topDict.CharsetOffset) switch (topDict.CharsetOffset)
{ {
case ISOAdobeCharset: case ISOAdobeCharset:
if (sid <= 228 /*zcaron*/) glyph = sid; if (sid <= 228 /*zcaron*/) glyph = sid;
break; break;
case ExpertCharset: case ExpertCharset:
glyph = lookup_expert_charset_for_glyph (sid); glyph = lookup_expert_charset_for_glyph (sid);
break; break;
case ExpertSubsetCharset: case ExpertSubsetCharset:
glyph = lookup_expert_subset_charset_for_glyph (sid); glyph = lookup_expert_subset_charset_for_glyph (sid);
break; break;
default: default:
break; break;
} }
return glyph; return glyph;
} }
} }
protected: protected:
hb_blob_t *blob; hb_blob_t *blob;
hb_sanitize_context_t sc; hb_sanitize_context_t sc;
public: public:
@ -1256,13 +1256,14 @@ struct cff1
const CFF1CharStrings *charStrings; const CFF1CharStrings *charStrings;
const CFF1FDArray *fdArray; const CFF1FDArray *fdArray;
const CFF1FDSelect *fdSelect; const CFF1FDSelect *fdSelect;
unsigned int fdCount; unsigned int fdCount;
cff1_top_dict_values_t topDict; cff1_top_dict_values_t topDict;
hb_vector_t<cff1_font_dict_values_t> fontDicts; hb_vector_t<cff1_font_dict_values_t>
hb_vector_t<PRIVDICTVAL> privateDicts; fontDicts;
hb_vector_t<PRIVDICTVAL> privateDicts;
unsigned int num_glyphs; unsigned int num_glyphs;
}; };
struct accelerator_t : accelerator_templ_t<cff1_private_dict_opset_t, cff1_private_dict_values_t> struct accelerator_t : accelerator_templ_t<cff1_private_dict_opset_t, cff1_private_dict_values_t>
@ -1301,7 +1302,7 @@ struct cff1
} }
bool get_glyph_name (hb_codepoint_t glyph, bool get_glyph_name (hb_codepoint_t glyph,
char *buf, unsigned int buf_len) const char *buf, unsigned int buf_len) const
{ {
if (!buf) return true; if (!buf) return true;
if (unlikely (!is_valid ())) return false; if (unlikely (!is_valid ())) return false;
@ -1334,7 +1335,7 @@ struct cff1
if (len < 0) len = strlen (name); if (len < 0) len = strlen (name);
if (unlikely (!len)) return false; if (unlikely (!len)) return false;
gname_t key = { hb_bytes_t (name, len), 0 }; gname_t key = { hb_bytes_t (name, len), 0 };
const gname_t *gname = glyph_names.bsearch (key); const gname_t *gname = glyph_names.bsearch (key);
if (gname == nullptr) return false; if (gname == nullptr) return false;
hb_codepoint_t gid = sid_to_glyph (gname->sid); hb_codepoint_t gid = sid_to_glyph (gname->sid);

View File

@ -232,7 +232,7 @@ struct cff2_private_dict_values_base_t : dict_values_t<VAL>
{ {
dict_values_t<VAL>::init (); dict_values_t<VAL>::init ();
subrsOffset = 0; subrsOffset = 0;
localSubrs = &Null(CFF2Subrs); localSubrs = &Null (CFF2Subrs);
ivs = 0; ivs = 0;
} }
void fini () { dict_values_t<VAL>::fini (); } void fini () { dict_values_t<VAL>::fini (); }
@ -411,7 +411,7 @@ struct cff2
const OT::cff2 *cff2 = this->blob->template as<OT::cff2> (); const OT::cff2 *cff2 = this->blob->template as<OT::cff2> ();
if (cff2 == &Null(OT::cff2)) if (cff2 == &Null (OT::cff2))
{ fini (); return; } { fini (); return; }
{ /* parse top dict */ { /* parse top dict */
@ -429,11 +429,11 @@ struct cff2
fdArray = &StructAtOffsetOrNull<CFF2FDArray> (cff2, topDict.FDArrayOffset); fdArray = &StructAtOffsetOrNull<CFF2FDArray> (cff2, topDict.FDArrayOffset);
fdSelect = &StructAtOffsetOrNull<CFF2FDSelect> (cff2, topDict.FDSelectOffset); fdSelect = &StructAtOffsetOrNull<CFF2FDSelect> (cff2, topDict.FDSelectOffset);
if (((varStore != &Null(CFF2VariationStore)) && unlikely (!varStore->sanitize (&sc))) || if (((varStore != &Null (CFF2VariationStore)) && unlikely (!varStore->sanitize (&sc))) ||
(charStrings == &Null(CFF2CharStrings)) || unlikely (!charStrings->sanitize (&sc)) || (charStrings == &Null (CFF2CharStrings)) || unlikely (!charStrings->sanitize (&sc)) ||
(globalSubrs == &Null(CFF2Subrs)) || unlikely (!globalSubrs->sanitize (&sc)) || (globalSubrs == &Null (CFF2Subrs)) || unlikely (!globalSubrs->sanitize (&sc)) ||
(fdArray == &Null(CFF2FDArray)) || unlikely (!fdArray->sanitize (&sc)) || (fdArray == &Null (CFF2FDArray)) || unlikely (!fdArray->sanitize (&sc)) ||
(((fdSelect != &Null(CFF2FDSelect)) && unlikely (!fdSelect->sanitize (&sc, fdArray->count))))) (((fdSelect != &Null (CFF2FDSelect)) && unlikely (!fdSelect->sanitize (&sc, fdArray->count)))))
{ fini (); return; } { fini (); return; }
num_glyphs = charStrings->count; num_glyphs = charStrings->count;
@ -452,7 +452,7 @@ struct cff2
cff2_font_dict_interpreter_t font_interp; cff2_font_dict_interpreter_t font_interp;
font_interp.env.init (fontDictStr); font_interp.env.init (fontDictStr);
font = fontDicts.push (); font = fontDicts.push ();
if (unlikely (font == &Crap(cff2_font_dict_values_t))) { fini (); return; } if (unlikely (font == &Crap (cff2_font_dict_values_t))) { fini (); return; }
font->init (); font->init ();
if (unlikely (!font_interp.interpret (*font))) { fini (); return; } if (unlikely (!font_interp.interpret (*font))) { fini (); return; }
@ -464,7 +464,7 @@ struct cff2
if (unlikely (!priv_interp.interpret (privateDicts[i]))) { fini (); return; } if (unlikely (!priv_interp.interpret (privateDicts[i]))) { fini (); return; }
privateDicts[i].localSubrs = &StructAtOffsetOrNull<CFF2Subrs> (&privDictStr[0], privateDicts[i].subrsOffset); privateDicts[i].localSubrs = &StructAtOffsetOrNull<CFF2Subrs> (&privDictStr[0], privateDicts[i].subrsOffset);
if (privateDicts[i].localSubrs != &Null(CFF2Subrs) && if (privateDicts[i].localSubrs != &Null (CFF2Subrs) &&
unlikely (!privateDicts[i].localSubrs->sanitize (&sc))) unlikely (!privateDicts[i].localSubrs->sanitize (&sc)))
{ fini (); return; } { fini (); return; }
} }

View File

@ -123,9 +123,9 @@ struct CmapSubtableFormat4
{ {
if (prev_cp == 0xFFFF || prev_cp + 1u != _.first) if (prev_cp == 0xFFFF || prev_cp + 1u != _.first)
{ {
HBUINT16 start_code; HBUINT16 start_code;
start_code = _.first; start_code = _.first;
c->copy<HBUINT16> (start_code); c->copy<HBUINT16> (start_code);
} }
prev_cp = _.first; prev_cp = _.first;
@ -302,7 +302,7 @@ struct CmapSubtableFormat4
if (k < (&last)[distance]) return -1; if (k < (&last)[distance]) return -1;
return 0; return 0;
} }
HBUINT16 last; HBUINT16 last;
}; };
const HBUINT16 *found =hb_bsearch (codepoint, const HBUINT16 *found =hb_bsearch (codepoint,
@ -312,7 +312,7 @@ struct CmapSubtableFormat4
_hb_cmp_method<hb_codepoint_t, CustomRange, unsigned>, _hb_cmp_method<hb_codepoint_t, CustomRange, unsigned>,
this->segCount + 1); this->segCount + 1);
if (!found) if (!found)
return false; return false;
unsigned int i = found - endCount; unsigned int i = found - endCount;
hb_codepoint_t gid; hb_codepoint_t gid;
@ -539,7 +539,7 @@ struct CmapSubtableLongSegmented
{ {
hb_codepoint_t start = this->groups[i].startCharCode; hb_codepoint_t start = this->groups[i].startCharCode;
hb_codepoint_t end = hb_min ((hb_codepoint_t) this->groups[i].endCharCode, hb_codepoint_t end = hb_min ((hb_codepoint_t) this->groups[i].endCharCode,
(hb_codepoint_t) HB_UNICODE_MAX); (hb_codepoint_t) HB_UNICODE_MAX);
hb_codepoint_t gid = this->groups[i].glyphID; hb_codepoint_t gid = this->groups[i].glyphID;
if (!gid) if (!gid)
{ {
@ -879,10 +879,10 @@ struct VariationSelectorRecord
hb_pair_t<unsigned, unsigned> hb_pair_t<unsigned, unsigned>
copy (hb_serialize_context_t *c, copy (hb_serialize_context_t *c,
const hb_set_t *unicodes, const hb_set_t *unicodes,
const hb_set_t *glyphs, const hb_set_t *glyphs,
const hb_map_t *glyph_map, const hb_map_t *glyph_map,
const void *base) const const void *base) const
{ {
auto snap = c->snapshot (); auto snap = c->snapshot ();
auto *out = c->embed<VariationSelectorRecord> (*this); auto *out = c->embed<VariationSelectorRecord> (*this);
@ -896,7 +896,7 @@ struct VariationSelectorRecord
{ {
c->push (); c->push ();
if (c->copy (base+nonDefaultUVS, unicodes, glyphs, glyph_map)) if (c->copy (base+nonDefaultUVS, unicodes, glyphs, glyph_map))
non_default_uvs_objidx = c->pop_pack (); non_default_uvs_objidx = c->pop_pack ();
else c->pop_discard (); else c->pop_discard ();
} }
@ -905,7 +905,7 @@ struct VariationSelectorRecord
{ {
c->push (); c->push ();
if (c->copy (base+defaultUVS, unicodes)) if (c->copy (base+defaultUVS, unicodes))
default_uvs_objidx = c->pop_pack (); default_uvs_objidx = c->pop_pack ();
else c->pop_discard (); else c->pop_discard ();
} }
@ -975,7 +975,7 @@ struct CmapSubtableFormat14
{ {
hb_pair_t<unsigned, unsigned> result = src_tbl->record[i].copy (c, unicodes, glyphs, glyph_map, base); hb_pair_t<unsigned, unsigned> result = src_tbl->record[i].copy (c, unicodes, glyphs, glyph_map, base);
if (result.first || result.second) if (result.first || result.second)
obj_indices.push (result); obj_indices.push (result);
} }
if (c->length () - table_initpos == CmapSubtableFormat14::min_size) if (c->length () - table_initpos == CmapSubtableFormat14::min_size)
@ -987,8 +987,8 @@ struct CmapSubtableFormat14
int tail_len = init_tail - c->tail; int tail_len = init_tail - c->tail;
c->check_assign (this->length, c->length () - table_initpos + tail_len); c->check_assign (this->length, c->length () - table_initpos + tail_len);
c->check_assign (this->record.len, c->check_assign (this->record.len,
(c->length () - table_initpos - CmapSubtableFormat14::min_size) / (c->length () - table_initpos - CmapSubtableFormat14::min_size) /
VariationSelectorRecord::static_size); VariationSelectorRecord::static_size);
/* Correct the incorrect write order by reversing the order of the variation /* Correct the incorrect write order by reversing the order of the variation
records array. */ records array. */
@ -1004,7 +1004,7 @@ struct CmapSubtableFormat14
} }
void _add_links_to_variation_records (hb_serialize_context_t *c, void _add_links_to_variation_records (hb_serialize_context_t *c,
const hb_vector_t<hb_pair_t<unsigned, unsigned>>& obj_indices) const hb_vector_t<hb_pair_t<unsigned, unsigned>>& obj_indices)
{ {
for (unsigned i = 0; i < obj_indices.length; i++) for (unsigned i = 0; i < obj_indices.length; i++)
{ {
@ -1484,7 +1484,7 @@ struct cmap
} }
const EncodingRecord *find_encodingrec (unsigned int platform_id, const EncodingRecord *find_encodingrec (unsigned int platform_id,
unsigned int encoding_id) const unsigned int encoding_id) const
{ {
EncodingRecord key; EncodingRecord key;
key.platformID = platform_id; key.platformID = platform_id;

View File

@ -155,7 +155,7 @@ struct CPAL
private: private:
const CPALV1Tail& v1 () const const CPALV1Tail& v1 () const
{ {
if (version == 0) return Null(CPALV1Tail); if (version == 0) return Null (CPALV1Tail);
return StructAfter<CPALV1Tail> (*this); return StructAfter<CPALV1Tail> (*this);
} }

View File

@ -710,7 +710,7 @@ struct glyf
if (unlikely (!points.resize (num_points))) return false; if (unlikely (!points.resize (num_points))) return false;
for (unsigned i = 0; i < points.length; i++) for (unsigned i = 0; i < points.length; i++)
points[i].init (); points[i].init ();
break; break;
} }
case SIMPLE: case SIMPLE:
if (unlikely (!SimpleGlyph (*header, bytes).get_contour_points (points, phantom_only))) if (unlikely (!SimpleGlyph (*header, bytes).get_contour_points (points, phantom_only)))
@ -1057,7 +1057,7 @@ struct glyf
} }
/* based on https://github.com/RazrFalcon/ttf-parser/blob/4f32821/src/glyf.rs#L287 /* based on https://github.com/RazrFalcon/ttf-parser/blob/4f32821/src/glyf.rs#L287
See also: See also:
* https://developer.apple.com/fonts/TrueType-Reference-Manual/RM01/Chap1.html * https://developer.apple.com/fonts/TrueType-Reference-Manual/RM01/Chap1.html
* https://stackoverflow.com/a/20772557 */ * https://stackoverflow.com/a/20772557 */
void consume_point (const contour_point_t &point) void consume_point (const contour_point_t &point)

View File

@ -216,7 +216,7 @@ struct hmtxvmtx
return side_bearing; return side_bearing;
if (var_table.get_length ()) if (var_table.get_length ())
return side_bearing + var_table->get_side_bearing_var (glyph, font->coords, font->num_coords); // TODO Optimize?! return side_bearing + var_table->get_side_bearing_var (glyph, font->coords, font->num_coords); // TODO Optimize?!
return _glyf_get_side_bearing_var (font, glyph, T::tableTag == HB_OT_TAG_vmtx); return _glyf_get_side_bearing_var (font, glyph, T::tableTag == HB_OT_TAG_vmtx);
#else #else

View File

@ -85,14 +85,14 @@ static inline void Coverage_serialize (hb_serialize_context_t *c,
template<typename Iterator> template<typename Iterator>
static inline void ClassDef_serialize (hb_serialize_context_t *c, static inline void ClassDef_serialize (hb_serialize_context_t *c,
Iterator it); Iterator it);
static void ClassDef_remap_and_serialize (hb_serialize_context_t *c, static void ClassDef_remap_and_serialize (hb_serialize_context_t *c,
const hb_set_t &glyphset, const hb_set_t &glyphset,
const hb_map_t &gid_klass_map, const hb_map_t &gid_klass_map,
hb_sorted_vector_t<HBGlyphID> &glyphs, hb_sorted_vector_t<HBGlyphID> &glyphs,
const hb_set_t &klasses, const hb_set_t &klasses,
hb_map_t *klass_map /*INOUT*/); hb_map_t *klass_map /*INOUT*/);
struct hb_subset_layout_context_t : struct hb_subset_layout_context_t :
hb_dispatch_context_t<hb_subset_layout_context_t, hb_empty_t, HB_DEBUG_SUBSET> hb_dispatch_context_t<hb_subset_layout_context_t, hb_empty_t, HB_DEBUG_SUBSET>
@ -139,8 +139,8 @@ struct hb_subset_layout_context_t :
debug_depth (0), debug_depth (0),
script_count (0), script_count (0),
langsys_count (0), langsys_count (0),
feature_index_count (0), feature_index_count (0),
lookup_index_count (0) lookup_index_count (0)
{} {}
private: private:
@ -424,8 +424,8 @@ struct IndexArray : ArrayOf<Index>
template <typename Iterator, template <typename Iterator,
hb_requires (hb_is_iterator (Iterator))> hb_requires (hb_is_iterator (Iterator))>
void serialize (hb_serialize_context_t *c, void serialize (hb_serialize_context_t *c,
hb_subset_layout_context_t *l, hb_subset_layout_context_t *l,
Iterator it) Iterator it)
{ {
if (!it) return; if (!it) return;
if (unlikely (!c->extend_min ((*this)))) return; if (unlikely (!c->extend_min ((*this)))) return;
@ -491,7 +491,7 @@ struct LangSys
bool operator == (const LangSys& o) const bool operator == (const LangSys& o) const
{ {
if (featureIndex.len != o.featureIndex.len || if (featureIndex.len != o.featureIndex.len ||
reqFeatureIndex != o.reqFeatureIndex) reqFeatureIndex != o.reqFeatureIndex)
return false; return false;
for (const auto _ : + hb_zip (featureIndex, o.featureIndex)) for (const auto _ : + hb_zip (featureIndex, o.featureIndex))
@ -581,24 +581,24 @@ struct Script
bool ret = ls.subset (c, l); bool ret = ls.subset (c, l);
if (!ret && tag && *tag != HB_TAG ('D', 'F', 'L', 'T')) if (!ret && tag && *tag != HB_TAG ('D', 'F', 'L', 'T'))
{ {
c->serializer->pop_discard (); c->serializer->pop_discard ();
out->defaultLangSys = 0; out->defaultLangSys = 0;
} }
else else
{ {
c->serializer->add_link (out->defaultLangSys, c->serializer->pop_pack ()); c->serializer->add_link (out->defaultLangSys, c->serializer->pop_pack ());
defaultLang = true; defaultLang = true;
} }
} }
+ langSys.iter () + langSys.iter ()
| hb_filter ([=] (const Record<LangSys>& record) {return l->visitLangSys (); }) | hb_filter ([=] (const Record<LangSys>& record) {return l->visitLangSys (); })
| hb_filter ([&] (const Record<LangSys>& record) | hb_filter ([&] (const Record<LangSys>& record)
{ {
const LangSys& d = this+defaultLangSys; const LangSys& d = this+defaultLangSys;
const LangSys& l = this+record.offset; const LangSys& l = this+record.offset;
return !(l == d); return !(l == d);
}) })
| hb_apply (subset_record_array (l, &(out->langSys), this)) | hb_apply (subset_record_array (l, &(out->langSys), this))
; ;
@ -1498,7 +1498,7 @@ struct Coverage
struct iter_t : hb_iter_with_fallback_t<iter_t, hb_codepoint_t> struct iter_t : hb_iter_with_fallback_t<iter_t, hb_codepoint_t>
{ {
static constexpr bool is_sorted_iterator = true; static constexpr bool is_sorted_iterator = true;
iter_t (const Coverage &c_ = Null(Coverage)) iter_t (const Coverage &c_ = Null (Coverage))
{ {
memset (this, 0, sizeof (*this)); memset (this, 0, sizeof (*this));
format = c_.u.format; format = c_.u.format;
@ -1572,15 +1572,15 @@ struct Coverage
template<typename Iterator> template<typename Iterator>
static inline void static inline void
Coverage_serialize (hb_serialize_context_t *c, Coverage_serialize (hb_serialize_context_t *c,
Iterator it) Iterator it)
{ c->start_embed<Coverage> ()->serialize (c, it); } { c->start_embed<Coverage> ()->serialize (c, it); }
static void ClassDef_remap_and_serialize (hb_serialize_context_t *c, static void ClassDef_remap_and_serialize (hb_serialize_context_t *c,
const hb_set_t &glyphset, const hb_set_t &glyphset,
const hb_map_t &gid_klass_map, const hb_map_t &gid_klass_map,
hb_sorted_vector_t<HBGlyphID> &glyphs, hb_sorted_vector_t<HBGlyphID> &glyphs,
const hb_set_t &klasses, const hb_set_t &klasses,
hb_map_t *klass_map /*INOUT*/) hb_map_t *klass_map /*INOUT*/)
{ {
if (!klass_map) if (!klass_map)
{ {
@ -1605,10 +1605,10 @@ static void ClassDef_remap_and_serialize (hb_serialize_context_t *c,
auto it = auto it =
+ glyphs.iter () + glyphs.iter ()
| hb_map_retains_sorting ([&] (const HBGlyphID& gid) -> hb_pair_t<hb_codepoint_t, unsigned> | hb_map_retains_sorting ([&] (const HBGlyphID& gid) -> hb_pair_t<hb_codepoint_t, unsigned>
{ {
unsigned new_klass = klass_map->get (gid_klass_map[gid]); unsigned new_klass = klass_map->get (gid_klass_map[gid]);
return hb_pair ((hb_codepoint_t)gid, new_klass); return hb_pair ((hb_codepoint_t)gid, new_klass);
}) })
; ;
c->propagate_error (glyphs, klasses); c->propagate_error (glyphs, klasses);
@ -1632,7 +1632,7 @@ struct ClassDefFormat1
template<typename Iterator, template<typename Iterator,
hb_requires (hb_is_iterator (Iterator))> hb_requires (hb_is_iterator (Iterator))>
bool serialize (hb_serialize_context_t *c, bool serialize (hb_serialize_context_t *c,
Iterator it) Iterator it)
{ {
TRACE_SERIALIZE (this); TRACE_SERIALIZE (this);
if (unlikely (!c->extend_min (*this))) return_trace (false); if (unlikely (!c->extend_min (*this))) return_trace (false);
@ -1646,8 +1646,8 @@ struct ClassDefFormat1
hb_codepoint_t glyph_min = (*it).first; hb_codepoint_t glyph_min = (*it).first;
hb_codepoint_t glyph_max = + it hb_codepoint_t glyph_max = + it
| hb_map (hb_first) | hb_map (hb_first)
| hb_reduce (hb_max, 0u); | hb_reduce (hb_max, 0u);
unsigned glyph_count = glyph_max - glyph_min + 1; unsigned glyph_count = glyph_max - glyph_min + 1;
startGlyph = glyph_min; startGlyph = glyph_min;
@ -1661,7 +1661,7 @@ struct ClassDefFormat1
} }
bool subset (hb_subset_context_t *c, bool subset (hb_subset_context_t *c,
hb_map_t *klass_map = nullptr /*OUT*/) const hb_map_t *klass_map = nullptr /*OUT*/) const
{ {
TRACE_SUBSET (this); TRACE_SUBSET (this);
const hb_set_t &glyphset = *c->plan->_glyphset_gsub; const hb_set_t &glyphset = *c->plan->_glyphset_gsub;
@ -1685,7 +1685,7 @@ struct ClassDefFormat1
} }
ClassDef_remap_and_serialize (c->serializer, glyphset, gid_org_klass_map, ClassDef_remap_and_serialize (c->serializer, glyphset, gid_org_klass_map,
glyphs, orig_klasses, klass_map); glyphs, orig_klasses, klass_map);
return_trace ((bool) glyphs); return_trace ((bool) glyphs);
} }
@ -1778,7 +1778,7 @@ struct ClassDefFormat2
template<typename Iterator, template<typename Iterator,
hb_requires (hb_is_iterator (Iterator))> hb_requires (hb_is_iterator (Iterator))>
bool serialize (hb_serialize_context_t *c, bool serialize (hb_serialize_context_t *c,
Iterator it) Iterator it)
{ {
TRACE_SERIALIZE (this); TRACE_SERIALIZE (this);
if (unlikely (!c->extend_min (*this))) return_trace (false); if (unlikely (!c->extend_min (*this))) return_trace (false);
@ -1807,17 +1807,17 @@ struct ClassDefFormat2
unsigned cur_klass = gid_klass_pair.second; unsigned cur_klass = gid_klass_pair.second;
if (cur_gid != prev_gid + 1 || if (cur_gid != prev_gid + 1 ||
cur_klass != prev_klass) cur_klass != prev_klass)
{ {
if (unlikely (!record)) break; if (unlikely (!record)) break;
record->last = prev_gid; record->last = prev_gid;
num_ranges++; num_ranges++;
range_rec.first = cur_gid; range_rec.first = cur_gid;
range_rec.last = cur_gid; range_rec.last = cur_gid;
range_rec.value = cur_klass; range_rec.value = cur_klass;
record = c->copy (range_rec); record = c->copy (range_rec);
} }
prev_klass = cur_klass; prev_klass = cur_klass;
@ -1830,7 +1830,7 @@ struct ClassDefFormat2
} }
bool subset (hb_subset_context_t *c, bool subset (hb_subset_context_t *c,
hb_map_t *klass_map = nullptr /*OUT*/) const hb_map_t *klass_map = nullptr /*OUT*/) const
{ {
TRACE_SUBSET (this); TRACE_SUBSET (this);
const hb_set_t &glyphset = *c->plan->_glyphset_gsub; const hb_set_t &glyphset = *c->plan->_glyphset_gsub;
@ -1851,13 +1851,13 @@ struct ClassDefFormat2
{ {
if (!glyphset.has (g)) continue; if (!glyphset.has (g)) continue;
glyphs.push (glyph_map[g]); glyphs.push (glyph_map[g]);
gid_org_klass_map.set (glyph_map[g], klass); gid_org_klass_map.set (glyph_map[g], klass);
orig_klasses.add (klass); orig_klasses.add (klass);
} }
} }
ClassDef_remap_and_serialize (c->serializer, glyphset, gid_org_klass_map, ClassDef_remap_and_serialize (c->serializer, glyphset, gid_org_klass_map,
glyphs, orig_klasses, klass_map); glyphs, orig_klasses, klass_map);
return_trace ((bool) glyphs); return_trace ((bool) glyphs);
} }
@ -1967,7 +1967,7 @@ struct ClassDef
hb_codepoint_t glyph_min = (*it).first; hb_codepoint_t glyph_min = (*it).first;
hb_codepoint_t glyph_max = + it hb_codepoint_t glyph_max = + it
| hb_map (hb_first) | hb_map (hb_first)
| hb_reduce (hb_max, 0u); | hb_reduce (hb_max, 0u);
unsigned num_ranges = 1; unsigned num_ranges = 1;
hb_codepoint_t prev_gid = glyph_min; hb_codepoint_t prev_gid = glyph_min;
@ -1975,15 +1975,15 @@ struct ClassDef
for (const auto gid_klass_pair : it) for (const auto gid_klass_pair : it)
{ {
hb_codepoint_t cur_gid = gid_klass_pair.first; hb_codepoint_t cur_gid = gid_klass_pair.first;
unsigned cur_klass = gid_klass_pair.second; unsigned cur_klass = gid_klass_pair.second;
if (cur_gid == glyph_min || !cur_klass) continue; if (cur_gid == glyph_min || !cur_klass) continue;
if (cur_gid != prev_gid + 1 || if (cur_gid != prev_gid + 1 ||
cur_klass != prev_klass) cur_klass != prev_klass)
num_ranges++; num_ranges++;
prev_gid = cur_gid; prev_gid = cur_gid;
prev_klass = cur_klass; prev_klass = cur_klass;
} }
if (1 + (glyph_max - glyph_min + 1) <= num_ranges * 3) if (1 + (glyph_max - glyph_min + 1) <= num_ranges * 3)
@ -2000,7 +2000,7 @@ struct ClassDef
} }
bool subset (hb_subset_context_t *c, bool subset (hb_subset_context_t *c,
hb_map_t *klass_map = nullptr /*OUT*/) const hb_map_t *klass_map = nullptr /*OUT*/) const
{ {
TRACE_SUBSET (this); TRACE_SUBSET (this);
switch (u.format) { switch (u.format) {
@ -2074,7 +2074,7 @@ struct ClassDef
template<typename Iterator> template<typename Iterator>
static inline void ClassDef_serialize (hb_serialize_context_t *c, static inline void ClassDef_serialize (hb_serialize_context_t *c,
Iterator it) Iterator it)
{ c->start_embed<ClassDef> ()->serialize (c, it); } { c->start_embed<ClassDef> ()->serialize (c, it); }
@ -2708,10 +2708,10 @@ struct FeatureVariationRecord
TRACE_SUBSET (this); TRACE_SUBSET (this);
auto *out = c->subset_context->serializer->embed (this); auto *out = c->subset_context->serializer->embed (this);
if (unlikely (!out)) return_trace (false); if (unlikely (!out)) return_trace (false);
bool ret = out->substitutions.serialize_subset (c->subset_context, substitutions, base, c); bool ret = out->substitutions.serialize_subset (c->subset_context, substitutions, base, c);
if (unlikely (!ret)) return_trace (false); if (unlikely (!ret)) return_trace (false);
out->conditions.serialize_subset (c->subset_context, conditions, base); out->conditions.serialize_subset (c->subset_context, conditions, base);
return_trace (true); return_trace (true);
} }

View File

@ -372,8 +372,8 @@ struct MarkGlyphSetsFormat1
auto *o = out->coverage.serialize_append (c->serializer); auto *o = out->coverage.serialize_append (c->serializer);
if (unlikely (!o)) if (unlikely (!o))
{ {
ret = false; ret = false;
break; break;
} }
//not using o->serialize_subset (c, offset, this, out) here because //not using o->serialize_subset (c, offset, this, out) here because
@ -494,7 +494,7 @@ struct GDEF
bool has_var_store () const { return version.to_int () >= 0x00010003u && varStore != 0; } bool has_var_store () const { return version.to_int () >= 0x00010003u && varStore != 0; }
const VariationStore &get_var_store () const const VariationStore &get_var_store () const
{ return version.to_int () >= 0x00010003u ? this+varStore : Null(VariationStore); } { return version.to_int () >= 0x00010003u ? this+varStore : Null (VariationStore); }
/* glyph_props is a 16-bit integer where the lower 8-bit have bits representing /* glyph_props is a 16-bit integer where the lower 8-bit have bits representing
* glyph class and other bits, and high 8-bit the mark attachment type (if any). * glyph class and other bits, and high 8-bit the mark attachment type (if any).
@ -558,8 +558,8 @@ struct GDEF
if (version.to_int () >= 0x00010002u) if (version.to_int () >= 0x00010002u)
{ {
if (!out->markGlyphSetsDef.serialize_subset (c, markGlyphSetsDef, this) && if (!out->markGlyphSetsDef.serialize_subset (c, markGlyphSetsDef, this) &&
version.to_int () == 0x00010002u) version.to_int () == 0x00010002u)
out->version.minor = 0; out->version.minor = 0;
} }
if (version.to_int () >= 0x00010003u) if (version.to_int () >= 0x00010003u)

View File

@ -465,7 +465,7 @@ struct AnchorMatrix
unsigned int cols, bool *found) const unsigned int cols, bool *found) const
{ {
*found = false; *found = false;
if (unlikely (row >= rows || col >= cols)) return Null(Anchor); if (unlikely (row >= rows || col >= cols)) return Null (Anchor);
*found = !matrixZ[row * cols + col].is_null (); *found = !matrixZ[row * cols + col].is_null ();
return this+matrixZ[row * cols + col]; return this+matrixZ[row * cols + col];
} }
@ -967,7 +967,7 @@ struct PairSet
} }
bool subset (hb_subset_context_t *c, bool subset (hb_subset_context_t *c,
const ValueFormat valueFormats[2]) const const ValueFormat valueFormats[2]) const
{ {
TRACE_SUBSET (this); TRACE_SUBSET (this);
auto snap = c->serializer->snapshot (); auto snap = c->serializer->snapshot ();
@ -1227,17 +1227,17 @@ struct PairPosFormat2
+ hb_range ((unsigned) class1Count) + hb_range ((unsigned) class1Count)
| hb_filter (klass1_map) | hb_filter (klass1_map)
| hb_apply ([&] (const unsigned class1_idx) | hb_apply ([&] (const unsigned class1_idx)
{ {
+ hb_range ((unsigned) class2Count) + hb_range ((unsigned) class2Count)
| hb_filter (klass2_map) | hb_filter (klass2_map)
| hb_apply ([&] (const unsigned class2_idx) | hb_apply ([&] (const unsigned class2_idx)
{ {
unsigned idx = (class1_idx * (unsigned) class2Count + class2_idx) * (len1 + len2); unsigned idx = (class1_idx * (unsigned) class2Count + class2_idx) * (len1 + len2);
valueFormat1.serialize_copy (c->serializer, this, &values[idx]); valueFormat1.serialize_copy (c->serializer, this, &values[idx]);
valueFormat2.serialize_copy (c->serializer, this, &values[idx + len1]); valueFormat2.serialize_copy (c->serializer, this, &values[idx + len1]);
}) })
; ;
}) })
; ;
const hb_set_t &glyphset = *c->plan->_glyphset_gsub; const hb_set_t &glyphset = *c->plan->_glyphset_gsub;

View File

@ -114,7 +114,7 @@ struct hb_closure_context_t :
nesting_level_left (nesting_level_left_), nesting_level_left (nesting_level_left_),
debug_depth (0), debug_depth (0),
done_lookups (done_lookups_), done_lookups (done_lookups_),
lookup_count (0) lookup_count (0)
{} {}
~hb_closure_context_t () { flush (); } ~hb_closure_context_t () { flush (); }
@ -191,7 +191,7 @@ struct hb_closure_lookups_context_t :
debug_depth (0), debug_depth (0),
visited_lookups (visited_lookups_), visited_lookups (visited_lookups_),
inactive_lookups (inactive_lookups_), inactive_lookups (inactive_lookups_),
lookup_count (0) {} lookup_count (0) {}
void set_recurse_func (recurse_func_t func) { recurse_func = func; } void set_recurse_func (recurse_func_t func) { recurse_func = func; }
@ -314,7 +314,7 @@ struct hb_add_coverage_context_t :
typedef const Coverage &return_t; typedef const Coverage &return_t;
template <typename T> template <typename T>
return_t dispatch (const T &obj) { return obj.get_coverage (); } return_t dispatch (const T &obj) { return obj.get_coverage (); }
static return_t default_return_value () { return Null(Coverage); } static return_t default_return_value () { return Null (Coverage); }
bool stop_sublookup_iteration (return_t r) const bool stop_sublookup_iteration (return_t r) const
{ {
r.add_coverage (set); r.add_coverage (set);
@ -569,7 +569,7 @@ struct hb_ot_apply_context_t :
#ifndef HB_NO_OT_LAYOUT #ifndef HB_NO_OT_LAYOUT
*face->table.GDEF->table *face->table.GDEF->table
#else #else
Null(GDEF) Null (GDEF)
#endif #endif
), ),
var_store (gdef.get_var_store ()), var_store (gdef.get_var_store ()),
@ -2155,8 +2155,8 @@ struct ChainRule
template<typename Iterator, template<typename Iterator,
hb_requires (hb_is_iterator (Iterator))> hb_requires (hb_is_iterator (Iterator))>
void serialize_array (hb_serialize_context_t *c, void serialize_array (hb_serialize_context_t *c,
HBUINT16 len, HBUINT16 len,
Iterator it) const Iterator it) const
{ {
c->copy (len); c->copy (len);
for (const auto g : it) for (const auto g : it)
@ -2197,9 +2197,9 @@ struct ChainRule
} }
bool subset (hb_subset_context_t *c, bool subset (hb_subset_context_t *c,
const hb_map_t *backtrack_map = nullptr, const hb_map_t *backtrack_map = nullptr,
const hb_map_t *input_map = nullptr, const hb_map_t *input_map = nullptr,
const hb_map_t *lookahead_map = nullptr) const const hb_map_t *lookahead_map = nullptr) const
{ {
TRACE_SUBSET (this); TRACE_SUBSET (this);
@ -2210,18 +2210,18 @@ struct ChainRule
{ {
const hb_set_t &glyphset = *c->plan->glyphset (); const hb_set_t &glyphset = *c->plan->glyphset ();
if (!hb_all (backtrack, glyphset) || if (!hb_all (backtrack, glyphset) ||
!hb_all (input, glyphset) || !hb_all (input, glyphset) ||
!hb_all (lookahead, glyphset)) !hb_all (lookahead, glyphset))
return_trace (false); return_trace (false);
copy (c->serializer, c->plan->glyph_map); copy (c->serializer, c->plan->glyph_map);
} }
else else
{ {
if (!hb_all (backtrack, backtrack_map) || if (!hb_all (backtrack, backtrack_map) ||
!hb_all (input, input_map) || !hb_all (input, input_map) ||
!hb_all (lookahead, lookahead_map)) !hb_all (lookahead, lookahead_map))
return_trace (false); return_trace (false);
copy (c->serializer, backtrack_map, input_map, lookahead_map); copy (c->serializer, backtrack_map, input_map, lookahead_map);
} }
@ -2324,9 +2324,9 @@ struct ChainRuleSet
} }
bool subset (hb_subset_context_t *c, bool subset (hb_subset_context_t *c,
const hb_map_t *backtrack_klass_map = nullptr, const hb_map_t *backtrack_klass_map = nullptr,
const hb_map_t *input_klass_map = nullptr, const hb_map_t *input_klass_map = nullptr,
const hb_map_t *lookahead_klass_map = nullptr) const const hb_map_t *lookahead_klass_map = nullptr) const
{ {
TRACE_SUBSET (this); TRACE_SUBSET (this);
@ -2342,12 +2342,12 @@ struct ChainRuleSet
auto o_snap = c->serializer->snapshot (); auto o_snap = c->serializer->snapshot ();
if (!o->serialize_subset (c, _, this, if (!o->serialize_subset (c, _, this,
backtrack_klass_map, backtrack_klass_map,
input_klass_map, input_klass_map,
lookahead_klass_map)) lookahead_klass_map))
{ {
out->rule.pop (); out->rule.pop ();
c->serializer->revert (o_snap); c->serializer->revert (o_snap);
} }
} }
@ -2645,15 +2645,15 @@ struct ChainContextFormat2
auto *o = out->ruleSet.serialize_append (c->serializer); auto *o = out->ruleSet.serialize_append (c->serializer);
if (unlikely (!o)) if (unlikely (!o))
{ {
ret = false; ret = false;
break; break;
} }
if (!o->serialize_subset (c, _, this, if (!o->serialize_subset (c, _, this,
&backtrack_klass_map, &backtrack_klass_map,
&input_klass_map, &input_klass_map,
&lookahead_klass_map)) &lookahead_klass_map))
{ {
rulesets.push (0); rulesets.push (0);
} }
else rulesets.push (1); else rulesets.push (1);
} }
@ -2967,7 +2967,7 @@ struct Extension
{ {
switch (u.format) { switch (u.format) {
case 1: return u.format1.template get_subtable<typename T::SubTable> (); case 1: return u.format1.template get_subtable<typename T::SubTable> ();
default:return Null(typename T::SubTable); default:return Null (typename T::SubTable);
} }
} }
@ -3102,13 +3102,13 @@ struct GSUBGPOS
typedef LookupOffsetList<TLookup> TLookupList; typedef LookupOffsetList<TLookup> TLookupList;
reinterpret_cast<OffsetTo<TLookupList> &> (out->lookupList) reinterpret_cast<OffsetTo<TLookupList> &> (out->lookupList)
.serialize_subset (c->subset_context, .serialize_subset (c->subset_context,
reinterpret_cast<const OffsetTo<TLookupList> &> (lookupList), reinterpret_cast<const OffsetTo<TLookupList> &> (lookupList),
this, this,
c); c);
reinterpret_cast<OffsetTo<RecordListOfFeature> &> (out->featureList) reinterpret_cast<OffsetTo<RecordListOfFeature> &> (out->featureList)
.serialize_subset (c->subset_context, .serialize_subset (c->subset_context,
reinterpret_cast<const OffsetTo<RecordListOfFeature> &> (featureList), reinterpret_cast<const OffsetTo<RecordListOfFeature> &> (featureList),
this, this,
c); c);
@ -3124,8 +3124,8 @@ struct GSUBGPOS
bool ret = out->featureVars.serialize_subset (c->subset_context, featureVars, this, c); bool ret = out->featureVars.serialize_subset (c->subset_context, featureVars, this, c);
if (!ret) if (!ret)
{ {
out->version.major = 1; out->version.major = 1;
out->version.minor = 0; out->version.minor = 0;
} }
} }
#endif #endif
@ -3140,7 +3140,7 @@ struct GSUBGPOS
for (unsigned i = 0; i < feature_count; i++) for (unsigned i = 0; i < feature_count; i++)
{ {
if (get_feature (i).intersects_lookup_indexes (lookup_indexes)) if (get_feature (i).intersects_lookup_indexes (lookup_indexes))
feature_indexes->add (i); feature_indexes->add (i);
} }
#ifndef HB_NO_VAR #ifndef HB_NO_VAR
if (version.to_int () >= 0x00010001u) if (version.to_int () >= 0x00010001u)

View File

@ -419,7 +419,7 @@ get_gsubgpos_table (hb_face_t *face,
switch (table_tag) { switch (table_tag) {
case HB_OT_TAG_GSUB: return *face->table.GSUB->table; case HB_OT_TAG_GSUB: return *face->table.GSUB->table;
case HB_OT_TAG_GPOS: return *face->table.GPOS->table; case HB_OT_TAG_GPOS: return *face->table.GPOS->table;
default: return Null(OT::GSUBGPOS); default: return Null (OT::GSUBGPOS);
} }
} }
@ -1230,15 +1230,15 @@ hb_ot_layout_closure_lookups (hb_face_t *face,
{ {
case HB_OT_TAG_GSUB: case HB_OT_TAG_GSUB:
{ {
const OT::SubstLookup& l = face->table.GSUB->table->get_lookup (lookup_index); const OT::SubstLookup& l = face->table.GSUB->table->get_lookup (lookup_index);
l.closure_lookups (&c, lookup_index); l.closure_lookups (&c, lookup_index);
break; break;
} }
case HB_OT_TAG_GPOS: case HB_OT_TAG_GPOS:
{ {
const OT::PosLookup& l = face->table.GPOS->table->get_lookup (lookup_index); const OT::PosLookup& l = face->table.GPOS->table->get_lookup (lookup_index);
l.closure_lookups (&c, lookup_index); l.closure_lookups (&c, lookup_index);
break; break;
} }
} }
} }
@ -1513,8 +1513,8 @@ hb_ot_layout_delete_glyphs_inplace (hb_buffer_t *buffer,
**/ **/
void void
hb_ot_layout_lookup_substitute_closure (hb_face_t *face, hb_ot_layout_lookup_substitute_closure (hb_face_t *face,
unsigned int lookup_index, unsigned int lookup_index,
hb_set_t *glyphs /* OUT */) hb_set_t *glyphs /* OUT */)
{ {
hb_map_t done_lookups; hb_map_t done_lookups;
OT::hb_closure_context_t c (face, glyphs, &done_lookups); OT::hb_closure_context_t c (face, glyphs, &done_lookups);

View File

@ -112,7 +112,7 @@ struct NameRecord
unsigned int e = encodingID; unsigned int e = encodingID;
return (p == 0 || return (p == 0 ||
(p == 3 && (e == 0 || e == 1 || e == 10))); (p == 3 && (e == 0 || e == 1 || e == 10)));
} }
static int cmp (const void *pa, const void *pb) static int cmp (const void *pa, const void *pb)

View File

@ -292,7 +292,7 @@ arabic_fallback_plan_create (const hb_ot_shape_plan_t *plan,
{ {
arabic_fallback_plan_t *fallback_plan = (arabic_fallback_plan_t *) calloc (1, sizeof (arabic_fallback_plan_t)); arabic_fallback_plan_t *fallback_plan = (arabic_fallback_plan_t *) calloc (1, sizeof (arabic_fallback_plan_t));
if (unlikely (!fallback_plan)) if (unlikely (!fallback_plan))
return const_cast<arabic_fallback_plan_t *> (&Null(arabic_fallback_plan_t)); return const_cast<arabic_fallback_plan_t *> (&Null (arabic_fallback_plan_t));
fallback_plan->num_lookups = 0; fallback_plan->num_lookups = 0;
fallback_plan->free_lookups = false; fallback_plan->free_lookups = false;
@ -309,7 +309,7 @@ arabic_fallback_plan_create (const hb_ot_shape_plan_t *plan,
assert (fallback_plan->num_lookups == 0); assert (fallback_plan->num_lookups == 0);
free (fallback_plan); free (fallback_plan);
return const_cast<arabic_fallback_plan_t *> (&Null(arabic_fallback_plan_t)); return const_cast<arabic_fallback_plan_t *> (&Null (arabic_fallback_plan_t));
} }
static void static void

View File

@ -271,7 +271,7 @@ data_create_arabic (const hb_ot_shape_plan_t *plan)
arabic_plan->mask_array[i] = plan->map.get_1_mask (arabic_features[i]); arabic_plan->mask_array[i] = plan->map.get_1_mask (arabic_features[i]);
arabic_plan->do_fallback = arabic_plan->do_fallback && arabic_plan->do_fallback = arabic_plan->do_fallback &&
(FEATURE_IS_SYRIAC (arabic_features[i]) || (FEATURE_IS_SYRIAC (arabic_features[i]) ||
plan->map.needs_fallback (arabic_features[i])); plan->map.needs_fallback (arabic_features[i]));
} }
return arabic_plan; return arabic_plan;

View File

@ -139,7 +139,7 @@ struct index_map_subset_plan_t
max_inners.init (); max_inners.init ();
output_map.init (); output_map.init ();
if (&index_map == &Null(DeltaSetIndexMap)) return; if (&index_map == &Null (DeltaSetIndexMap)) return;
unsigned int last_val = (unsigned int)-1; unsigned int last_val = (unsigned int)-1;
hb_codepoint_t last_gid = (hb_codepoint_t)-1; hb_codepoint_t last_gid = (hb_codepoint_t)-1;
@ -202,7 +202,7 @@ struct index_map_subset_plan_t
const hb_vector_t<hb_inc_bimap_t> &inner_maps, const hb_vector_t<hb_inc_bimap_t> &inner_maps,
const hb_subset_plan_t *plan) const hb_subset_plan_t *plan)
{ {
if (input_map == &Null(DeltaSetIndexMap)) return; if (input_map == &Null (DeltaSetIndexMap)) return;
for (unsigned int i = 0; i < max_inners.length; i++) for (unsigned int i = 0; i < max_inners.length; i++)
{ {

View File

@ -69,7 +69,7 @@ hb_set_create ()
hb_set_t * hb_set_t *
hb_set_get_empty () hb_set_get_empty ()
{ {
return const_cast<hb_set_t *> (&Null(hb_set_t)); return const_cast<hb_set_t *> (&Null (hb_set_t));
} }
/** /**
@ -145,9 +145,9 @@ hb_set_get_user_data (hb_set_t *set,
* hb_set_allocation_successful: * hb_set_allocation_successful:
* @set: a set. * @set: a set.
* *
*
* *
* Return value: *
* Return value:
* *
* Since: 0.9.2 * Since: 0.9.2
**/ **/
@ -161,7 +161,7 @@ hb_set_allocation_successful (const hb_set_t *set)
* hb_set_clear: * hb_set_clear:
* @set: a set. * @set: a set.
* *
* *
* *
* Since: 0.9.2 * Since: 0.9.2
**/ **/
@ -175,9 +175,9 @@ hb_set_clear (hb_set_t *set)
* hb_set_is_empty: * hb_set_is_empty:
* @set: a set. * @set: a set.
* *
*
* *
* Return value: *
* Return value:
* *
* Since: 0.9.7 * Since: 0.9.7
**/ **/
@ -190,11 +190,11 @@ hb_set_is_empty (const hb_set_t *set)
/** /**
* hb_set_has: * hb_set_has:
* @set: a set. * @set: a set.
* @codepoint: * @codepoint:
* *
*
* *
* Return value: *
* Return value:
* *
* Since: 0.9.2 * Since: 0.9.2
**/ **/
@ -208,9 +208,9 @@ hb_set_has (const hb_set_t *set,
/** /**
* hb_set_add: * hb_set_add:
* @set: a set. * @set: a set.
* @codepoint: * @codepoint:
*
* *
*
* *
* Since: 0.9.2 * Since: 0.9.2
**/ **/
@ -224,10 +224,10 @@ hb_set_add (hb_set_t *set,
/** /**
* hb_set_add_range: * hb_set_add_range:
* @set: a set. * @set: a set.
* @first: * @first:
* @last: * @last:
*
* *
*
* *
* Since: 0.9.7 * Since: 0.9.7
**/ **/
@ -242,9 +242,9 @@ hb_set_add_range (hb_set_t *set,
/** /**
* hb_set_del: * hb_set_del:
* @set: a set. * @set: a set.
* @codepoint: * @codepoint:
*
* *
*
* *
* Since: 0.9.2 * Since: 0.9.2
**/ **/
@ -258,10 +258,10 @@ hb_set_del (hb_set_t *set,
/** /**
* hb_set_del_range: * hb_set_del_range:
* @set: a set. * @set: a set.
* @first: * @first:
* @last: * @last:
*
* *
*
* *
* Since: 0.9.7 * Since: 0.9.7
**/ **/
@ -278,7 +278,7 @@ hb_set_del_range (hb_set_t *set,
* @set: a set. * @set: a set.
* @other: other set. * @other: other set.
* *
* *
* *
* Return value: %TRUE if the two sets are equal, %FALSE otherwise. * Return value: %TRUE if the two sets are equal, %FALSE otherwise.
* *
@ -312,9 +312,9 @@ hb_set_is_subset (const hb_set_t *set,
/** /**
* hb_set_set: * hb_set_set:
* @set: a set. * @set: a set.
* @other: * @other:
*
* *
*
* *
* Since: 0.9.2 * Since: 0.9.2
**/ **/
@ -328,9 +328,9 @@ hb_set_set (hb_set_t *set,
/** /**
* hb_set_union: * hb_set_union:
* @set: a set. * @set: a set.
* @other: * @other:
*
* *
*
* *
* Since: 0.9.2 * Since: 0.9.2
**/ **/
@ -344,9 +344,9 @@ hb_set_union (hb_set_t *set,
/** /**
* hb_set_intersect: * hb_set_intersect:
* @set: a set. * @set: a set.
* @other: * @other:
*
* *
*
* *
* Since: 0.9.2 * Since: 0.9.2
**/ **/
@ -360,9 +360,9 @@ hb_set_intersect (hb_set_t *set,
/** /**
* hb_set_subtract: * hb_set_subtract:
* @set: a set. * @set: a set.
* @other: * @other:
*
* *
*
* *
* Since: 0.9.2 * Since: 0.9.2
**/ **/
@ -376,9 +376,9 @@ hb_set_subtract (hb_set_t *set,
/** /**
* hb_set_symmetric_difference: * hb_set_symmetric_difference:
* @set: a set. * @set: a set.
* @other: * @other:
*
* *
*
* *
* Since: 0.9.2 * Since: 0.9.2
**/ **/
@ -394,7 +394,7 @@ hb_set_symmetric_difference (hb_set_t *set,
* hb_set_invert: * hb_set_invert:
* @set: a set. * @set: a set.
* *
* *
* *
* Since: 0.9.10 * Since: 0.9.10
* *

View File

@ -530,7 +530,7 @@ struct hb_set_t
if (old_index_to_page_map_index[i] == 0xFFFFFFFF) continue; if (old_index_to_page_map_index[i] == 0xFFFFFFFF) continue;
if (write_index < i) if (write_index < i)
pages[write_index] = pages[i]; pages[write_index] = pages[i];
page_map[old_index_to_page_map_index[i]].index = write_index; page_map[old_index_to_page_map_index[i]].index = write_index;
write_index++; write_index++;
@ -555,16 +555,16 @@ struct hb_set_t
{ {
if (page_map[a].major == other->page_map[b].major) if (page_map[a].major == other->page_map[b].major)
{ {
if (!Op::passthru_left) if (!Op::passthru_left)
{ {
// Move page_map entries that we're keeping from the left side set // Move page_map entries that we're keeping from the left side set
// to the front of the page_map vector. This isn't necessary if // to the front of the page_map vector. This isn't necessary if
// passthru_left is set since no left side pages will be removed // passthru_left is set since no left side pages will be removed
// in that case. // in that case.
if (write_index < a) if (write_index < a)
page_map[write_index] = page_map[a]; page_map[write_index] = page_map[a];
write_index++; write_index++;
} }
count++; count++;
a++; a++;
@ -808,7 +808,7 @@ struct hb_set_t
struct iter_t : hb_iter_with_fallback_t<iter_t, hb_codepoint_t> struct iter_t : hb_iter_with_fallback_t<iter_t, hb_codepoint_t>
{ {
static constexpr bool is_sorted_iterator = true; static constexpr bool is_sorted_iterator = true;
iter_t (const hb_set_t &s_ = Null(hb_set_t), iter_t (const hb_set_t &s_ = Null (hb_set_t),
bool init = true) : s (&s_), v (INVALID), l(0) bool init = true) : s (&s_), v (INVALID), l(0)
{ {
if (init) if (init)

View File

@ -257,7 +257,7 @@ bail:
hb_shape_plan_t * hb_shape_plan_t *
hb_shape_plan_get_empty () hb_shape_plan_get_empty ()
{ {
return const_cast<hb_shape_plan_t *> (&Null(hb_shape_plan_t)); return const_cast<hb_shape_plan_t *> (&Null (hb_shape_plan_t));
} }
/** /**

View File

@ -44,7 +44,7 @@ struct str_encoder_t
void encode_byte (unsigned char b) void encode_byte (unsigned char b)
{ {
if (unlikely (buff.push (b) == &Crap(unsigned char))) if (unlikely (buff.push (b) == &Crap (unsigned char)))
set_error (); set_error ();
} }

View File

@ -82,7 +82,7 @@ struct cff1_sub_table_info_t : cff_sub_table_info_t
/* a copy of a parsed out cff1_top_dict_values_t augmented with additional operators */ /* a copy of a parsed out cff1_top_dict_values_t augmented with additional operators */
struct cff1_top_dict_values_mod_t : cff1_top_dict_values_t struct cff1_top_dict_values_mod_t : cff1_top_dict_values_t
{ {
void init (const cff1_top_dict_values_t *base_= &Null(cff1_top_dict_values_t)) void init (const cff1_top_dict_values_t *base_= &Null (cff1_top_dict_values_t))
{ {
SUPER::init (); SUPER::init ();
base = base_; base = base_;
@ -437,7 +437,7 @@ struct cff_subset_plan {
} }
last_code = code; last_code = code;
if (encoding != &Null(Encoding)) if (encoding != &Null (Encoding))
{ {
hb_codepoint_t sid = acc.glyph_to_sid (old_glyph); hb_codepoint_t sid = acc.glyph_to_sid (old_glyph);
encoding->get_supplement_codes (sid, supp_codes); encoding->get_supplement_codes (sid, supp_codes);
@ -521,7 +521,7 @@ struct cff_subset_plan {
} }
} }
if (acc.fdArray != &Null(CFF1FDArray)) if (acc.fdArray != &Null (CFF1FDArray))
for (unsigned int i = 0; i < orig_fdcount; i++) for (unsigned int i = 0; i < orig_fdcount; i++)
if (fdmap.has (i)) if (fdmap.has (i))
(void)sidmap.add (acc.fontDicts[i].fontName); (void)sidmap.add (acc.fontDicts[i].fontName);
@ -572,7 +572,7 @@ struct cff_subset_plan {
} }
/* Determine re-mapping of font index as fdmap among other info */ /* Determine re-mapping of font index as fdmap among other info */
if (acc.fdSelect != &Null(CFF1FDSelect)) if (acc.fdSelect != &Null (CFF1FDSelect))
{ {
if (unlikely (!hb_plan_subset_cff_fdselect (plan, if (unlikely (!hb_plan_subset_cff_fdselect (plan,
orig_fdcount, orig_fdcount,
@ -763,7 +763,7 @@ static bool _serialize_cff1 (hb_serialize_context_t *c,
} }
/* FDArray (FD Index) */ /* FDArray (FD Index) */
if (acc.fdArray != &Null(CFF1FDArray)) if (acc.fdArray != &Null (CFF1FDArray))
{ {
CFF1FDArray *fda = c->start_embed<CFF1FDArray> (); CFF1FDArray *fda = c->start_embed<CFF1FDArray> ();
if (unlikely (fda == nullptr)) return false; if (unlikely (fda == nullptr)) return false;
@ -780,7 +780,7 @@ static bool _serialize_cff1 (hb_serialize_context_t *c,
} }
/* FDSelect */ /* FDSelect */
if (acc.fdSelect != &Null(CFF1FDSelect)) if (acc.fdSelect != &Null (CFF1FDSelect))
{ {
c->push (); c->push ();
if (likely (hb_serialize_cff_fdselect (c, num_glyphs, *acc.fdSelect, acc.fdCount, if (likely (hb_serialize_cff_fdselect (c, num_glyphs, *acc.fdSelect, acc.fdCount,

View File

@ -300,7 +300,7 @@ struct cff2_subset_plan {
} }
/* FDSelect */ /* FDSelect */
if (acc.fdSelect != &Null(CFF2FDSelect)) if (acc.fdSelect != &Null (CFF2FDSelect))
{ {
if (unlikely (!hb_plan_subset_cff_fdselect (plan, if (unlikely (!hb_plan_subset_cff_fdselect (plan,
orig_fdcount, orig_fdcount,
@ -397,7 +397,7 @@ static bool _serialize_cff2 (hb_serialize_context_t *c,
} }
/* FDSelect */ /* FDSelect */
if (acc.fdSelect != &Null(CFF2FDSelect)) if (acc.fdSelect != &Null (CFF2FDSelect))
{ {
c->push (); c->push ();
if (likely (hb_serialize_cff_fdselect (c, num_glyphs, *(const FDSelect *)acc.fdSelect, plan.orig_fdcount, if (likely (hb_serialize_cff_fdselect (c, num_glyphs, *(const FDSelect *)acc.fdSelect, plan.orig_fdcount,
@ -428,7 +428,7 @@ static bool _serialize_cff2 (hb_serialize_context_t *c,
} }
/* variation store */ /* variation store */
if (acc.varStore != &Null(CFF2VariationStore)) if (acc.varStore != &Null (CFF2VariationStore))
{ {
c->push (); c->push ();
CFF2VariationStore *dest = c->start_embed<CFF2VariationStore> (); CFF2VariationStore *dest = c->start_embed<CFF2VariationStore> ();

View File

@ -62,7 +62,7 @@ struct hb_subset_context_t :
hb_subset_context_t (hb_blob_t *source_blob_, hb_subset_context_t (hb_blob_t *source_blob_,
hb_subset_plan_t *plan_, hb_subset_plan_t *plan_,
hb_serialize_context_t *serializer_) : hb_serialize_context_t *serializer_) :
source_blob (source_blob_), source_blob (source_blob_),
plan (plan_), plan (plan_),
serializer (serializer_), serializer (serializer_),
debug_depth (0) {} debug_depth (0) {}

View File

@ -212,7 +212,7 @@ DEFINE_NULL_INSTANCE (hb_unicode_funcs_t) =
hb_unicode_funcs_t * hb_unicode_funcs_t *
hb_unicode_funcs_get_empty () hb_unicode_funcs_get_empty ()
{ {
return const_cast<hb_unicode_funcs_t *> (&Null(hb_unicode_funcs_t)); return const_cast<hb_unicode_funcs_t *> (&Null (hb_unicode_funcs_t));
} }
/** /**

View File

@ -117,7 +117,7 @@ struct hb_vector_t
{ {
unsigned int i = (unsigned int) i_; unsigned int i = (unsigned int) i_;
if (unlikely (i >= length)) if (unlikely (i >= length))
return Null(Type); return Null (Type);
return arrayZ[i]; return arrayZ[i];
} }
@ -165,7 +165,7 @@ struct hb_vector_t
Type *push () Type *push ()
{ {
if (unlikely (!resize (length + 1))) if (unlikely (!resize (length + 1)))
return &Crap(Type); return &Crap (Type);
return &arrayZ[length - 1]; return &arrayZ[length - 1];
} }
template <typename T> template <typename T>
@ -228,7 +228,7 @@ struct hb_vector_t
Type pop () Type pop ()
{ {
if (!length) return Null(Type); if (!length) return Null (Type);
return hb_move (arrayZ[--length]); /* Does this move actually work? */ return hb_move (arrayZ[--length]); /* Does this move actually work? */
} }

View File

@ -105,7 +105,7 @@ test_iterator (Iter it)
template <typename Iterable, template <typename Iterable,
hb_requires (hb_is_iterable (Iterable))> hb_requires (hb_is_iterable (Iterable))>
static void static void
test_iterable (const Iterable &lst = Null(Iterable)) test_iterable (const Iterable &lst = Null (Iterable))
{ {
for (auto _ : lst) for (auto _ : lst)
(void) _; (void) _;