From 2dda6dd744b192616c65ca4aa5fce8e90fd0ff30 Mon Sep 17 00:00:00 2001 From: Ebrahim Byagowi Date: Mon, 20 Apr 2020 14:12:45 +0430 Subject: [PATCH] minor, tweak spacing turn 8 spaces to tab, add space before Null/Crap --- src/hb-aat-layout-ankr-table.hh | 2 +- src/hb-aat-layout-common.hh | 6 +- src/hb-aat-layout-morx-table.hh | 6 +- src/hb-aat-layout.cc | 2 +- src/hb-aat-map.cc | 10 +- src/hb-aat-map.hh | 4 +- src/hb-blob.cc | 2 +- src/hb-buffer.cc | 2 +- src/hb-buffer.h | 2 +- src/hb-buffer.hh | 4 +- src/hb-cff-interp-common.hh | 6 +- src/hb-cff-interp-cs-common.hh | 2 +- src/hb-cff2-interp-cs.hh | 2 +- src/hb-draw.hh | 2 +- src/hb-face.cc | 2 +- src/hb-font.cc | 2 +- src/hb-font.hh | 2 +- src/hb-machinery.hh | 2 +- src/hb-map.cc | 2 +- src/hb-map.hh | 4 +- src/hb-null.hh | 8 +- src/hb-open-file.hh | 4 +- src/hb-ot-cff-common.hh | 4 +- src/hb-ot-cff1-table.hh | 107 +++++++++--------- src/hb-ot-cff2-table.hh | 18 +-- src/hb-ot-cmap-table.hh | 34 +++--- src/hb-ot-color-cpal-table.hh | 2 +- src/hb-ot-glyf-table.hh | 4 +- src/hb-ot-hmtx-table.hh | 2 +- src/hb-ot-layout-common.hh | 124 ++++++++++----------- src/hb-ot-layout-gdef-table.hh | 10 +- src/hb-ot-layout-gpos-table.hh | 26 ++--- src/hb-ot-layout-gsubgpos.hh | 70 ++++++------ src/hb-ot-layout.cc | 18 +-- src/hb-ot-name-table.hh | 2 +- src/hb-ot-shape-complex-arabic-fallback.hh | 4 +- src/hb-ot-shape-complex-arabic.cc | 2 +- src/hb-ot-var-hvar-table.hh | 4 +- src/hb-set.cc | 62 +++++------ src/hb-set.hh | 24 ++-- src/hb-shape-plan.cc | 2 +- src/hb-subset-cff-common.hh | 2 +- src/hb-subset-cff1.cc | 12 +- src/hb-subset-cff2.cc | 6 +- src/hb-subset.hh | 2 +- src/hb-unicode.cc | 2 +- src/hb-vector.hh | 6 +- src/test-iter.cc | 2 +- 48 files changed, 315 insertions(+), 314 deletions(-) diff --git a/src/hb-aat-layout-ankr-table.hh b/src/hb-aat-layout-ankr-table.hh index e1858a497..f2785a6f5 100644 --- a/src/hb-aat-layout-ankr-table.hh +++ b/src/hb-aat-layout-ankr-table.hh @@ -66,7 +66,7 @@ struct ankr { const NNOffsetTo *offset = (this+lookupTable).get_value (glyph_id, num_glyphs); if (!offset) - return Null(Anchor); + return Null (Anchor); const GlyphAnchors &anchors = &(this+anchorData) + *offset; return anchors[i]; } diff --git a/src/hb-aat-layout-common.hh b/src/hb-aat-layout-common.hh index 473f2cdcd..f186917fc 100644 --- a/src/hb-aat-layout-common.hh +++ b/src/hb-aat-layout-common.hh @@ -303,7 +303,7 @@ struct LookupFormat10 const typename T::type get_value_or_null (hb_codepoint_t glyph_id) const { if (!(firstGlyph <= glyph_id && glyph_id - firstGlyph < glyphCount)) - return Null(T); + return Null (T); 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); default: 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_font_t *font_, hb_buffer_t *buffer_, - hb_blob_t *blob = const_cast (&Null(hb_blob_t))); + hb_blob_t *blob = const_cast (&Null (hb_blob_t))); HB_INTERNAL ~hb_aat_apply_context_t (); diff --git a/src/hb-aat-layout-morx-table.hh b/src/hb-aat-layout-morx-table.hh index c6b5aa53f..9d04c7102 100644 --- a/src/hb-aat-layout-morx-table.hh +++ b/src/hb-aat-layout-morx-table.hh @@ -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_selector_t setting = (hb_aat_layout_feature_selector_t) (unsigned int) feature.featureSetting; retry: - // 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.) - hb_aat_map_builder_t::feature_info_t info = { type, setting, false, 0 }; + // 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.) + hb_aat_map_builder_t::feature_info_t info = { type, setting, false, 0 }; if (map->features.bsearch (info)) { flags &= feature.disableFlags; diff --git a/src/hb-aat-layout.cc b/src/hb-aat-layout.cc index fa1048e18..49c908fd1 100644 --- a/src/hb-aat-layout.cc +++ b/src/hb-aat-layout.cc @@ -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), buffer (buffer_), sanitizer (), - ankr_table (&Null(AAT::ankr)), + ankr_table (&Null (AAT::ankr)), lookup_index (0), debug_depth (0) { diff --git a/src/hb-aat-map.cc b/src/hb-aat-map.cc index 255684231..2c38c3502 100644 --- a/src/hb-aat-map.cc +++ b/src/hb-aat-map.cc @@ -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. * https://github.com/harfbuzz/harfbuzz/issues/2307 */ 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); if (!feature->has_data ()) return; @@ -87,10 +87,10 @@ hb_aat_map_builder_t::compile (hb_aat_map_t &m) unsigned int j = 0; for (unsigned int i = 1; i < features.length; i++) if (features[i].type != features[j].type || - /* 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" - * (selectors referring to the same feature setting) here. */ - (!features[i].is_exclusive && ((features[i].setting & ~1) != (features[j].setting & ~1)))) + /* 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" + * (selectors referring to the same feature setting) here. */ + (!features[i].is_exclusive && ((features[i].setting & ~1) != (features[j].setting & ~1)))) features[++j] = features[i]; features.shrink (j + 1); } diff --git a/src/hb-aat-map.hh b/src/hb-aat-map.hh index 1cf5a8a13..5a0fa7054 100644 --- a/src/hb-aat-map.hh +++ b/src/hb-aat-map.hh @@ -73,7 +73,7 @@ struct hb_aat_map_builder_t const feature_info_t *b = (const feature_info_t *) pb; if (a->type != b->type) return (a->type < b->type ? -1 : 1); 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); } @@ -81,7 +81,7 @@ struct hb_aat_map_builder_t int cmp (const feature_info_t& f) const { 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; } }; diff --git a/src/hb-blob.cc b/src/hb-blob.cc index 7eeb067aa..24d8be754 100644 --- a/src/hb-blob.cc +++ b/src/hb-blob.cc @@ -189,7 +189,7 @@ hb_blob_copy_writable_or_fail (hb_blob_t *blob) hb_blob_t * hb_blob_get_empty () { - return const_cast (&Null(hb_blob_t)); + return const_cast (&Null (hb_blob_t)); } /** diff --git a/src/hb-buffer.cc b/src/hb-buffer.cc index f49b35f2d..d443edf25 100644 --- a/src/hb-buffer.cc +++ b/src/hb-buffer.cc @@ -715,7 +715,7 @@ hb_buffer_create () hb_buffer_t * hb_buffer_get_empty () { - return const_cast (&Null(hb_buffer_t)); + return const_cast (&Null (hb_buffer_t)); } /** diff --git a/src/hb-buffer.h b/src/hb-buffer.h index d5cb74686..2f581f3c7 100644 --- a/src/hb-buffer.h +++ b/src/hb-buffer.h @@ -365,7 +365,7 @@ hb_buffer_clear_contents (hb_buffer_t *buffer); HB_EXTERN hb_bool_t hb_buffer_pre_allocate (hb_buffer_t *buffer, - unsigned int size); + unsigned int size); HB_EXTERN hb_bool_t diff --git a/src/hb-buffer.hh b/src/hb-buffer.hh index 6c771774a..dce89fabe 100644 --- a/src/hb-buffer.hh +++ b/src/hb-buffer.hh @@ -228,10 +228,10 @@ struct hb_buffer_t /* 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) { - 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)) - 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].codepoint = glyph_index; diff --git a/src/hb-cff-interp-common.hh b/src/hb-cff-interp-common.hh index e7b5af9d8..274019cfb 100644 --- a/src/hb-cff-interp-common.hh +++ b/src/hb-cff-interp-common.hh @@ -405,7 +405,7 @@ struct cff_stack_t else { set_error (); - return Crap(ELEM); + return Crap (ELEM); } } @@ -416,7 +416,7 @@ struct cff_stack_t else { set_error (); - return Crap(ELEM); + return Crap (ELEM); } } void pop (unsigned int n) @@ -432,7 +432,7 @@ struct cff_stack_t if (unlikely (count < 0)) { set_error (); - return Null(ELEM); + return Null (ELEM); } return elements[count - 1]; } diff --git a/src/hb-cff-interp-cs-common.hh b/src/hb-cff-interp-cs-common.hh index eb7df084a..336b18894 100644 --- a/src/hb-cff-interp-cs-common.hh +++ b/src/hb-cff-interp-cs-common.hh @@ -82,7 +82,7 @@ struct biased_subrs_t byte_str_t operator [] (unsigned int index) const { if (unlikely ((subrs == nullptr) || index >= subrs->count)) - return Null(byte_str_t); + return Null (byte_str_t); else return (*subrs)[index]; } diff --git a/src/hb-cff2-interp-cs.hh b/src/hb-cff2-interp-cs.hh index d75f2958b..dc4e59548 100644 --- a/src/hb-cff2-interp-cs.hh +++ b/src/hb-cff2-interp-cs.hh @@ -90,7 +90,7 @@ struct cff2_cs_interp_env_t : cs_interp_env_t seen_blend = false; seen_vsindex_ = false; 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); } diff --git a/src/hb-draw.hh b/src/hb-draw.hh index 318ceed1d..2aa0a5b4d 100644 --- a/src/hb-draw.hh +++ b/src/hb-draw.hh @@ -92,7 +92,7 @@ struct draw_helper_t hb_position_t to_x, hb_position_t to_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)) return; if (!path_open) start_path (); diff --git a/src/hb-face.cc b/src/hb-face.cc index 2da0af41f..e4d8a3f36 100644 --- a/src/hb-face.cc +++ b/src/hb-face.cc @@ -226,7 +226,7 @@ hb_face_create (hb_blob_t *blob, hb_face_t * hb_face_get_empty () { - return const_cast (&Null(hb_face_t)); + return const_cast (&Null (hb_face_t)); } diff --git a/src/hb-font.cc b/src/hb-font.cc index 692b197ba..27959487d 100644 --- a/src/hb-font.cc +++ b/src/hb-font.cc @@ -1465,7 +1465,7 @@ hb_font_create_sub_font (hb_font_t *parent) hb_font_t * hb_font_get_empty () { - return const_cast (&Null(hb_font_t)); + return const_cast (&Null (hb_font_t)); } /** diff --git a/src/hb-font.hh b/src/hb-font.hh index 4a5c85300..12982fc6b 100644 --- a/src/hb-font.hh +++ b/src/hb-font.hh @@ -287,7 +287,7 @@ struct hb_font_t } 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; return klass->get.f.glyph_h_origin (this, user_data, diff --git a/src/hb-machinery.hh b/src/hb-machinery.hh index 8e96a3a7d..54bc60d4c 100644 --- a/src/hb-machinery.hh +++ b/src/hb-machinery.hh @@ -234,7 +234,7 @@ struct hb_lazy_loader_t : hb_data_wrapper_t static Returned* convert (Stored *p) { return p; } /* 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) { Stored *p = (Stored *) calloc (1, sizeof (Stored)); diff --git a/src/hb-map.cc b/src/hb-map.cc index a2c770c58..191be1437 100644 --- a/src/hb-map.cc +++ b/src/hb-map.cc @@ -69,7 +69,7 @@ hb_map_create () hb_map_t * hb_map_get_empty () { - return const_cast (&Null(hb_map_t)); + return const_cast (&Null (hb_map_t)); } /** diff --git a/src/hb-map.hh b/src/hb-map.hh index 8c8db4d52..34f51b218 100644 --- a/src/hb-map.hh +++ b/src/hb-map.hh @@ -135,8 +135,8 @@ struct hb_hashmap_t for (unsigned int i = 0; i < old_size; i++) if (old_items[i].is_real ()) set_with_hash (old_items[i].key, - old_items[i].hash, - old_items[i].value); + old_items[i].hash, + old_items[i].value); free (old_items); diff --git a/src/hb-null.hh b/src/hb-null.hh index d4578205e..803b0a943 100644 --- a/src/hb-null.hh +++ b/src/hb-null.hh @@ -135,7 +135,7 @@ template static inline Type& Crap () { static_assert (hb_null_size (Type) <= HB_NULL_POOL_SIZE, "Increase HB_NULL_POOL_SIZE."); Type *obj = reinterpret_cast (_hb_CrapPool); - memcpy (obj, &Null(Type), sizeof (*obj)); + memcpy (obj, &Null (Type), sizeof (*obj)); return *obj; } template @@ -148,11 +148,11 @@ struct CrapHelper template struct CrapOrNullHelper { - static Type & get () { return Crap(Type); } + static Type & get () { return Crap (Type); } }; template struct CrapOrNullHelper { - static const Type & get () { return Null(Type); } + static const Type & get () { return Null (Type); } }; #define CrapOrNull(Type) CrapOrNullHelper::get () @@ -174,7 +174,7 @@ struct hb_nonnull_ptr_t /* Only auto-cast to const types. */ template operator const C * () const { return get (); } operator const char * () const { return (const char *) get (); } - T * get () const { return v ? v : const_cast (&Null(T)); } + T * get () const { return v ? v : const_cast (&Null (T)); } T * get_raw () const { return v; } T *v; diff --git a/src/hb-open-file.hh b/src/hb-open-file.hh index 23ca44dee..2f01ce91e 100644 --- a/src/hb-open-file.hh +++ b/src/hb-open-file.hh @@ -249,7 +249,7 @@ struct TTCHeader switch (u.header.version.major) { case 2: /* version 2 is compatible with version 1 */ 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 TTCTag: return u.ttcHeader.get_face (i); case DFontTag: return u.rfHeader.get_face (i, base_offset); - default: return Null(OpenTypeFontFace); + default: return Null (OpenTypeFontFace); } } diff --git a/src/hb-ot-cff-common.hh b/src/hb-ot-cff-common.hh index 46f66b7bd..c2b8812ec 100644 --- a/src/hb-ot-cff-common.hh +++ b/src/hb-ot-cff-common.hh @@ -260,7 +260,7 @@ struct CFFIndex unsigned int length_at (unsigned int index) const { 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 offset_at (index + 1) - offset_at (index); } @@ -321,7 +321,7 @@ struct CFFIndexOf : CFFIndex { if (likely (index < CFFIndex::count)) return byte_str_t (CFFIndex::data_base () + CFFIndex::offset_at (index) - 1, CFFIndex::length_at (index)); - return Null(byte_str_t); + return Null (byte_str_t); } template diff --git a/src/hb-ot-cff1-table.hh b/src/hb-ot-cff1-table.hh index 6a3fd3045..e6352adc0 100644 --- a/src/hb-ot-cff1-table.hh +++ b/src/hb-ot-cff1-table.hh @@ -570,13 +570,13 @@ struct Charset struct CFF1StringIndex : CFF1Index { 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); if (unlikely ((strings.count == 0) || (sidmap.get_population () == 0))) { if (unlikely (!c->extend_min (this->count))) - return_trace (false); + return_trace (false); count = 0; return_trace (true); } @@ -589,7 +589,7 @@ struct CFF1StringIndex : CFF1Index { hb_codepoint_t j = sidmap[i]; if (j != HB_MAP_VALUE_INVALID) - bytesArray[j] = strings[i]; + bytesArray[j] = strings[i]; } bool result = CFF1Index::serialize (c, bytesArray); @@ -840,7 +840,7 @@ struct cff1_private_dict_values_base_t : dict_values_t { dict_values_t::init (); subrsOffset = 0; - localSubrs = &Null(CFF1Subrs); + localSubrs = &Null (CFF1Subrs); } void fini () { dict_values_t::fini (); } @@ -950,7 +950,7 @@ struct cff1_font_dict_values_mod_t { 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_, unsigned int fontName_) @@ -1011,7 +1011,7 @@ struct cff1 const OT::cff1 *cff = this->blob->template as (); - if (cff == &Null(OT::cff1)) + if (cff == &Null (OT::cff1)) { fini (); return; } nameIndex = &cff->nameIndex (cff); @@ -1032,7 +1032,7 @@ struct cff1 } if (is_predef_charset ()) - charset = &Null(Charset); + charset = &Null (Charset); else { charset = &StructAtOffsetOrNull (cff, topDict.CharsetOffset); @@ -1044,22 +1044,22 @@ struct cff1 { fdArray = &StructAtOffsetOrNull (cff, topDict.FDArrayOffset); fdSelect = &StructAtOffsetOrNull (cff, topDict.FDSelectOffset); - if (unlikely ((fdArray == &Null(CFF1FDArray)) || !fdArray->sanitize (&sc) || - (fdSelect == &Null(CFF1FDSelect)) || !fdSelect->sanitize (&sc, fdArray->count))) + if (unlikely ((fdArray == &Null (CFF1FDArray)) || !fdArray->sanitize (&sc) || + (fdSelect == &Null (CFF1FDSelect)) || !fdSelect->sanitize (&sc, fdArray->count))) { fini (); return; } fdCount = fdArray->count; } else { - fdArray = &Null(CFF1FDArray); - fdSelect = &Null(CFF1FDSelect); + fdArray = &Null (CFF1FDArray); + fdSelect = &Null (CFF1FDSelect); } - encoding = &Null(Encoding); + encoding = &Null (Encoding); if (is_CID ()) { - if (unlikely (charset == &Null(Charset))) { fini (); return; } + if (unlikely (charset == &Null (Charset))) { fini (); return; } } else { @@ -1080,7 +1080,7 @@ struct cff1 charStrings = &StructAtOffsetOrNull (cff, topDict.charStringsOffset); - if ((charStrings == &Null(CFF1CharStrings)) || unlikely (!charStrings->sanitize (&sc))) + if ((charStrings == &Null (CFF1CharStrings)) || unlikely (!charStrings->sanitize (&sc))) { fini (); return; } num_glyphs = charStrings->count; @@ -1098,14 +1098,14 @@ struct cff1 { byte_str_t fontDictStr = (*fdArray)[i]; 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; font_interp.env.init (fontDictStr); 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 (); if (unlikely (!font_interp.interpret (*font))) { fini (); return; } - PRIVDICTVAL *priv = &privateDicts[i]; + PRIVDICTVAL *priv = &privateDicts[i]; const byte_str_t privDictStr (StructAtOffset (cff, font->privateDictInfo.offset), font->privateDictInfo.size); if (unlikely (!privDictStr.sanitize (&sc))) { fini (); return; } dict_interpreter_t priv_interp; @@ -1114,15 +1114,15 @@ struct cff1 if (unlikely (!priv_interp.interpret (*priv))) { fini (); return; } priv->localSubrs = &StructAtOffsetOrNull (&privDictStr, priv->subrsOffset); - if (priv->localSubrs != &Null(CFF1Subrs) && + if (priv->localSubrs != &Null (CFF1Subrs) && unlikely (!priv->localSubrs->sanitize (&sc))) { fini (); return; } } } else /* non-CID */ { - cff1_top_dict_values_t *font = &topDict; - PRIVDICTVAL *priv = &privateDicts[0]; + cff1_top_dict_values_t *font = &topDict; + PRIVDICTVAL *priv = &privateDicts[0]; const byte_str_t privDictStr (StructAtOffset (cff, font->privateDictInfo.offset), font->privateDictInfo.size); if (unlikely (!privDictStr.sanitize (&sc))) { fini (); return; } @@ -1132,7 +1132,7 @@ struct cff1 if (unlikely (!priv_interp.interpret (*priv))) { fini (); return; } priv->localSubrs = &StructAtOffsetOrNull (&privDictStr, priv->subrsOffset); - if (priv->localSubrs != &Null(CFF1Subrs) && + if (priv->localSubrs != &Null (CFF1Subrs) && unlikely (!priv->localSubrs->sanitize (&sc))) { fini (); return; } } @@ -1159,7 +1159,7 @@ struct cff1 if (unlikely (sid == CFF_UNDEF_SID)) return 0; - if (charset != &Null(Charset)) + if (charset != &Null (Charset)) return charset->get_glyph (sid, num_glyphs); else if ((topDict.CharsetOffset == ISOAdobeCharset) && (code <= 228 /*zcaron*/)) return sid; @@ -1170,7 +1170,7 @@ struct cff1 hb_codepoint_t glyph_to_code (hb_codepoint_t glyph) const { - if (encoding != &Null(Encoding)) + if (encoding != &Null (Encoding)) return encoding->get_code (glyph); else { @@ -1194,20 +1194,20 @@ struct cff1 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); else { hb_codepoint_t sid = 0; switch (topDict.CharsetOffset) { - case ISOAdobeCharset: + case ISOAdobeCharset: if (glyph <= 228 /*zcaron*/) sid = glyph; break; - case ExpertCharset: + case ExpertCharset: sid = lookup_expert_charset_for_sid (glyph); break; - case ExpertSubsetCharset: + case ExpertSubsetCharset: sid = lookup_expert_subset_charset_for_sid (glyph); break; default: @@ -1219,31 +1219,31 @@ struct cff1 hb_codepoint_t sid_to_glyph (hb_codepoint_t sid) const { - if (charset != &Null(Charset)) - return charset->get_glyph (sid, num_glyphs); + if (charset != &Null (Charset)) + return charset->get_glyph (sid, num_glyphs); else { - hb_codepoint_t glyph = 0; - switch (topDict.CharsetOffset) - { - case ISOAdobeCharset: - if (sid <= 228 /*zcaron*/) glyph = sid; - break; - case ExpertCharset: - glyph = lookup_expert_charset_for_glyph (sid); - break; - case ExpertSubsetCharset: - glyph = lookup_expert_subset_charset_for_glyph (sid); - break; - default: - break; - } - return glyph; + hb_codepoint_t glyph = 0; + switch (topDict.CharsetOffset) + { + case ISOAdobeCharset: + if (sid <= 228 /*zcaron*/) glyph = sid; + break; + case ExpertCharset: + glyph = lookup_expert_charset_for_glyph (sid); + break; + case ExpertSubsetCharset: + glyph = lookup_expert_subset_charset_for_glyph (sid); + break; + default: + break; + } + return glyph; } } protected: - hb_blob_t *blob; + hb_blob_t *blob; hb_sanitize_context_t sc; public: @@ -1256,13 +1256,14 @@ struct cff1 const CFF1CharStrings *charStrings; const CFF1FDArray *fdArray; const CFF1FDSelect *fdSelect; - unsigned int fdCount; + unsigned int fdCount; - cff1_top_dict_values_t topDict; - hb_vector_t fontDicts; - hb_vector_t privateDicts; + cff1_top_dict_values_t topDict; + hb_vector_t + fontDicts; + hb_vector_t privateDicts; - unsigned int num_glyphs; + unsigned int num_glyphs; }; struct accelerator_t : accelerator_templ_t @@ -1301,7 +1302,7 @@ struct cff1 } 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 (unlikely (!is_valid ())) return false; @@ -1334,7 +1335,7 @@ struct cff1 if (len < 0) len = strlen (name); 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); if (gname == nullptr) return false; hb_codepoint_t gid = sid_to_glyph (gname->sid); diff --git a/src/hb-ot-cff2-table.hh b/src/hb-ot-cff2-table.hh index a03ec7170..6af4efc99 100644 --- a/src/hb-ot-cff2-table.hh +++ b/src/hb-ot-cff2-table.hh @@ -232,7 +232,7 @@ struct cff2_private_dict_values_base_t : dict_values_t { dict_values_t::init (); subrsOffset = 0; - localSubrs = &Null(CFF2Subrs); + localSubrs = &Null (CFF2Subrs); ivs = 0; } void fini () { dict_values_t::fini (); } @@ -411,7 +411,7 @@ struct cff2 const OT::cff2 *cff2 = this->blob->template as (); - if (cff2 == &Null(OT::cff2)) + if (cff2 == &Null (OT::cff2)) { fini (); return; } { /* parse top dict */ @@ -429,11 +429,11 @@ struct cff2 fdArray = &StructAtOffsetOrNull (cff2, topDict.FDArrayOffset); fdSelect = &StructAtOffsetOrNull (cff2, topDict.FDSelectOffset); - if (((varStore != &Null(CFF2VariationStore)) && unlikely (!varStore->sanitize (&sc))) || - (charStrings == &Null(CFF2CharStrings)) || unlikely (!charStrings->sanitize (&sc)) || - (globalSubrs == &Null(CFF2Subrs)) || unlikely (!globalSubrs->sanitize (&sc)) || - (fdArray == &Null(CFF2FDArray)) || unlikely (!fdArray->sanitize (&sc)) || - (((fdSelect != &Null(CFF2FDSelect)) && unlikely (!fdSelect->sanitize (&sc, fdArray->count))))) + if (((varStore != &Null (CFF2VariationStore)) && unlikely (!varStore->sanitize (&sc))) || + (charStrings == &Null (CFF2CharStrings)) || unlikely (!charStrings->sanitize (&sc)) || + (globalSubrs == &Null (CFF2Subrs)) || unlikely (!globalSubrs->sanitize (&sc)) || + (fdArray == &Null (CFF2FDArray)) || unlikely (!fdArray->sanitize (&sc)) || + (((fdSelect != &Null (CFF2FDSelect)) && unlikely (!fdSelect->sanitize (&sc, fdArray->count))))) { fini (); return; } num_glyphs = charStrings->count; @@ -452,7 +452,7 @@ struct cff2 cff2_font_dict_interpreter_t font_interp; font_interp.env.init (fontDictStr); 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 (); if (unlikely (!font_interp.interpret (*font))) { fini (); return; } @@ -464,7 +464,7 @@ struct cff2 if (unlikely (!priv_interp.interpret (privateDicts[i]))) { fini (); return; } privateDicts[i].localSubrs = &StructAtOffsetOrNull (&privDictStr[0], privateDicts[i].subrsOffset); - if (privateDicts[i].localSubrs != &Null(CFF2Subrs) && + if (privateDicts[i].localSubrs != &Null (CFF2Subrs) && unlikely (!privateDicts[i].localSubrs->sanitize (&sc))) { fini (); return; } } diff --git a/src/hb-ot-cmap-table.hh b/src/hb-ot-cmap-table.hh index 1cd142b47..c942af217 100644 --- a/src/hb-ot-cmap-table.hh +++ b/src/hb-ot-cmap-table.hh @@ -123,9 +123,9 @@ struct CmapSubtableFormat4 { if (prev_cp == 0xFFFF || prev_cp + 1u != _.first) { - HBUINT16 start_code; - start_code = _.first; - c->copy (start_code); + HBUINT16 start_code; + start_code = _.first; + c->copy (start_code); } prev_cp = _.first; @@ -302,7 +302,7 @@ struct CmapSubtableFormat4 if (k < (&last)[distance]) return -1; return 0; } - HBUINT16 last; + HBUINT16 last; }; const HBUINT16 *found =hb_bsearch (codepoint, @@ -312,7 +312,7 @@ struct CmapSubtableFormat4 _hb_cmp_method, this->segCount + 1); if (!found) - return false; + return false; unsigned int i = found - endCount; hb_codepoint_t gid; @@ -539,7 +539,7 @@ struct CmapSubtableLongSegmented { hb_codepoint_t start = this->groups[i].startCharCode; 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; if (!gid) { @@ -879,10 +879,10 @@ struct VariationSelectorRecord hb_pair_t copy (hb_serialize_context_t *c, - const hb_set_t *unicodes, - const hb_set_t *glyphs, - const hb_map_t *glyph_map, - const void *base) const + const hb_set_t *unicodes, + const hb_set_t *glyphs, + const hb_map_t *glyph_map, + const void *base) const { auto snap = c->snapshot (); auto *out = c->embed (*this); @@ -896,7 +896,7 @@ struct VariationSelectorRecord { c->push (); 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 (); } @@ -905,7 +905,7 @@ struct VariationSelectorRecord { c->push (); if (c->copy (base+defaultUVS, unicodes)) - default_uvs_objidx = c->pop_pack (); + default_uvs_objidx = c->pop_pack (); else c->pop_discard (); } @@ -975,7 +975,7 @@ struct CmapSubtableFormat14 { hb_pair_t result = src_tbl->record[i].copy (c, unicodes, glyphs, glyph_map, base); if (result.first || result.second) - obj_indices.push (result); + obj_indices.push (result); } if (c->length () - table_initpos == CmapSubtableFormat14::min_size) @@ -987,8 +987,8 @@ struct CmapSubtableFormat14 int tail_len = init_tail - c->tail; c->check_assign (this->length, c->length () - table_initpos + tail_len); c->check_assign (this->record.len, - (c->length () - table_initpos - CmapSubtableFormat14::min_size) / - VariationSelectorRecord::static_size); + (c->length () - table_initpos - CmapSubtableFormat14::min_size) / + VariationSelectorRecord::static_size); /* Correct the incorrect write order by reversing the order of the variation records array. */ @@ -1004,7 +1004,7 @@ struct CmapSubtableFormat14 } void _add_links_to_variation_records (hb_serialize_context_t *c, - const hb_vector_t>& obj_indices) + const hb_vector_t>& obj_indices) { for (unsigned i = 0; i < obj_indices.length; i++) { @@ -1484,7 +1484,7 @@ struct cmap } const EncodingRecord *find_encodingrec (unsigned int platform_id, - unsigned int encoding_id) const + unsigned int encoding_id) const { EncodingRecord key; key.platformID = platform_id; diff --git a/src/hb-ot-color-cpal-table.hh b/src/hb-ot-color-cpal-table.hh index 1b3c7fc0b..ce9f76e45 100644 --- a/src/hb-ot-color-cpal-table.hh +++ b/src/hb-ot-color-cpal-table.hh @@ -155,7 +155,7 @@ struct CPAL private: const CPALV1Tail& v1 () const { - if (version == 0) return Null(CPALV1Tail); + if (version == 0) return Null (CPALV1Tail); return StructAfter (*this); } diff --git a/src/hb-ot-glyf-table.hh b/src/hb-ot-glyf-table.hh index f2eb91d31..ce7ffa9d1 100644 --- a/src/hb-ot-glyf-table.hh +++ b/src/hb-ot-glyf-table.hh @@ -710,7 +710,7 @@ struct glyf if (unlikely (!points.resize (num_points))) return false; for (unsigned i = 0; i < points.length; i++) points[i].init (); - break; + break; } case SIMPLE: 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 - See also: + See also: * https://developer.apple.com/fonts/TrueType-Reference-Manual/RM01/Chap1.html * https://stackoverflow.com/a/20772557 */ void consume_point (const contour_point_t &point) diff --git a/src/hb-ot-hmtx-table.hh b/src/hb-ot-hmtx-table.hh index 5580c3e2c..612de7697 100644 --- a/src/hb-ot-hmtx-table.hh +++ b/src/hb-ot-hmtx-table.hh @@ -216,7 +216,7 @@ struct hmtxvmtx return side_bearing; 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); #else diff --git a/src/hb-ot-layout-common.hh b/src/hb-ot-layout-common.hh index 883ccab6a..8b628a1b8 100644 --- a/src/hb-ot-layout-common.hh +++ b/src/hb-ot-layout-common.hh @@ -85,14 +85,14 @@ static inline void Coverage_serialize (hb_serialize_context_t *c, template 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, - const hb_set_t &glyphset, - const hb_map_t &gid_klass_map, - hb_sorted_vector_t &glyphs, - const hb_set_t &klasses, - hb_map_t *klass_map /*INOUT*/); + const hb_set_t &glyphset, + const hb_map_t &gid_klass_map, + hb_sorted_vector_t &glyphs, + const hb_set_t &klasses, + hb_map_t *klass_map /*INOUT*/); struct hb_subset_layout_context_t : hb_dispatch_context_t @@ -139,8 +139,8 @@ struct hb_subset_layout_context_t : debug_depth (0), script_count (0), langsys_count (0), - feature_index_count (0), - lookup_index_count (0) + feature_index_count (0), + lookup_index_count (0) {} private: @@ -424,8 +424,8 @@ struct IndexArray : ArrayOf template void serialize (hb_serialize_context_t *c, - hb_subset_layout_context_t *l, - Iterator it) + hb_subset_layout_context_t *l, + Iterator it) { if (!it) return; if (unlikely (!c->extend_min ((*this)))) return; @@ -491,7 +491,7 @@ struct LangSys bool operator == (const LangSys& o) const { if (featureIndex.len != o.featureIndex.len || - reqFeatureIndex != o.reqFeatureIndex) + reqFeatureIndex != o.reqFeatureIndex) return false; for (const auto _ : + hb_zip (featureIndex, o.featureIndex)) @@ -581,24 +581,24 @@ struct Script bool ret = ls.subset (c, l); if (!ret && tag && *tag != HB_TAG ('D', 'F', 'L', 'T')) { - c->serializer->pop_discard (); - out->defaultLangSys = 0; + c->serializer->pop_discard (); + out->defaultLangSys = 0; } else { - c->serializer->add_link (out->defaultLangSys, c->serializer->pop_pack ()); - defaultLang = true; + c->serializer->add_link (out->defaultLangSys, c->serializer->pop_pack ()); + defaultLang = true; } } + langSys.iter () | hb_filter ([=] (const Record& record) {return l->visitLangSys (); }) | hb_filter ([&] (const Record& record) - { - const LangSys& d = this+defaultLangSys; - const LangSys& l = this+record.offset; - return !(l == d); - }) + { + const LangSys& d = this+defaultLangSys; + const LangSys& l = this+record.offset; + return !(l == d); + }) | hb_apply (subset_record_array (l, &(out->langSys), this)) ; @@ -1498,7 +1498,7 @@ struct Coverage struct iter_t : hb_iter_with_fallback_t { 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)); format = c_.u.format; @@ -1572,15 +1572,15 @@ struct Coverage template static inline void Coverage_serialize (hb_serialize_context_t *c, - Iterator it) + Iterator it) { c->start_embed ()->serialize (c, it); } static void ClassDef_remap_and_serialize (hb_serialize_context_t *c, - const hb_set_t &glyphset, - const hb_map_t &gid_klass_map, - hb_sorted_vector_t &glyphs, - const hb_set_t &klasses, - hb_map_t *klass_map /*INOUT*/) + const hb_set_t &glyphset, + const hb_map_t &gid_klass_map, + hb_sorted_vector_t &glyphs, + const hb_set_t &klasses, + hb_map_t *klass_map /*INOUT*/) { if (!klass_map) { @@ -1605,10 +1605,10 @@ static void ClassDef_remap_and_serialize (hb_serialize_context_t *c, auto it = + glyphs.iter () | hb_map_retains_sorting ([&] (const HBGlyphID& gid) -> hb_pair_t - { - unsigned new_klass = klass_map->get (gid_klass_map[gid]); - return hb_pair ((hb_codepoint_t)gid, new_klass); - }) + { + unsigned new_klass = klass_map->get (gid_klass_map[gid]); + return hb_pair ((hb_codepoint_t)gid, new_klass); + }) ; c->propagate_error (glyphs, klasses); @@ -1632,7 +1632,7 @@ struct ClassDefFormat1 template bool serialize (hb_serialize_context_t *c, - Iterator it) + Iterator it) { TRACE_SERIALIZE (this); 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_max = + it - | hb_map (hb_first) - | hb_reduce (hb_max, 0u); + | hb_map (hb_first) + | hb_reduce (hb_max, 0u); unsigned glyph_count = glyph_max - glyph_min + 1; startGlyph = glyph_min; @@ -1661,7 +1661,7 @@ struct ClassDefFormat1 } 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); 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, - glyphs, orig_klasses, klass_map); + glyphs, orig_klasses, klass_map); return_trace ((bool) glyphs); } @@ -1778,7 +1778,7 @@ struct ClassDefFormat2 template bool serialize (hb_serialize_context_t *c, - Iterator it) + Iterator it) { TRACE_SERIALIZE (this); if (unlikely (!c->extend_min (*this))) return_trace (false); @@ -1807,17 +1807,17 @@ struct ClassDefFormat2 unsigned cur_klass = gid_klass_pair.second; if (cur_gid != prev_gid + 1 || - cur_klass != prev_klass) + cur_klass != prev_klass) { - if (unlikely (!record)) break; - record->last = prev_gid; - num_ranges++; + if (unlikely (!record)) break; + record->last = prev_gid; + num_ranges++; - range_rec.first = cur_gid; - range_rec.last = cur_gid; - range_rec.value = cur_klass; + range_rec.first = cur_gid; + range_rec.last = cur_gid; + range_rec.value = cur_klass; - record = c->copy (range_rec); + record = c->copy (range_rec); } prev_klass = cur_klass; @@ -1830,7 +1830,7 @@ struct ClassDefFormat2 } 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); const hb_set_t &glyphset = *c->plan->_glyphset_gsub; @@ -1851,13 +1851,13 @@ struct ClassDefFormat2 { if (!glyphset.has (g)) continue; glyphs.push (glyph_map[g]); - gid_org_klass_map.set (glyph_map[g], klass); - orig_klasses.add (klass); + gid_org_klass_map.set (glyph_map[g], klass); + orig_klasses.add (klass); } } 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); } @@ -1967,7 +1967,7 @@ struct ClassDef hb_codepoint_t glyph_min = (*it).first; hb_codepoint_t glyph_max = + it | hb_map (hb_first) - | hb_reduce (hb_max, 0u); + | hb_reduce (hb_max, 0u); unsigned num_ranges = 1; hb_codepoint_t prev_gid = glyph_min; @@ -1975,15 +1975,15 @@ struct ClassDef for (const auto gid_klass_pair : it) { - hb_codepoint_t cur_gid = gid_klass_pair.first; - unsigned cur_klass = gid_klass_pair.second; - if (cur_gid == glyph_min || !cur_klass) continue; - if (cur_gid != prev_gid + 1 || - cur_klass != prev_klass) - num_ranges++; + hb_codepoint_t cur_gid = gid_klass_pair.first; + unsigned cur_klass = gid_klass_pair.second; + if (cur_gid == glyph_min || !cur_klass) continue; + if (cur_gid != prev_gid + 1 || + cur_klass != prev_klass) + num_ranges++; - prev_gid = cur_gid; - prev_klass = cur_klass; + prev_gid = cur_gid; + prev_klass = cur_klass; } if (1 + (glyph_max - glyph_min + 1) <= num_ranges * 3) @@ -2000,7 +2000,7 @@ struct ClassDef } 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); switch (u.format) { @@ -2074,7 +2074,7 @@ struct ClassDef template static inline void ClassDef_serialize (hb_serialize_context_t *c, - Iterator it) + Iterator it) { c->start_embed ()->serialize (c, it); } @@ -2708,10 +2708,10 @@ struct FeatureVariationRecord TRACE_SUBSET (this); auto *out = c->subset_context->serializer->embed (this); if (unlikely (!out)) return_trace (false); - + bool ret = out->substitutions.serialize_subset (c->subset_context, substitutions, base, c); if (unlikely (!ret)) return_trace (false); - + out->conditions.serialize_subset (c->subset_context, conditions, base); return_trace (true); } diff --git a/src/hb-ot-layout-gdef-table.hh b/src/hb-ot-layout-gdef-table.hh index 27df58612..70feaf8fa 100644 --- a/src/hb-ot-layout-gdef-table.hh +++ b/src/hb-ot-layout-gdef-table.hh @@ -372,8 +372,8 @@ struct MarkGlyphSetsFormat1 auto *o = out->coverage.serialize_append (c->serializer); if (unlikely (!o)) { - ret = false; - break; + ret = false; + break; } //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; } 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 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 (!out->markGlyphSetsDef.serialize_subset (c, markGlyphSetsDef, this) && - version.to_int () == 0x00010002u) - out->version.minor = 0; + version.to_int () == 0x00010002u) + out->version.minor = 0; } if (version.to_int () >= 0x00010003u) diff --git a/src/hb-ot-layout-gpos-table.hh b/src/hb-ot-layout-gpos-table.hh index c44e93281..4827384f7 100644 --- a/src/hb-ot-layout-gpos-table.hh +++ b/src/hb-ot-layout-gpos-table.hh @@ -465,7 +465,7 @@ struct AnchorMatrix unsigned int cols, bool *found) const { *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 (); return this+matrixZ[row * cols + col]; } @@ -967,7 +967,7 @@ struct PairSet } bool subset (hb_subset_context_t *c, - const ValueFormat valueFormats[2]) const + const ValueFormat valueFormats[2]) const { TRACE_SUBSET (this); auto snap = c->serializer->snapshot (); @@ -1227,17 +1227,17 @@ struct PairPosFormat2 + hb_range ((unsigned) class1Count) | hb_filter (klass1_map) | hb_apply ([&] (const unsigned class1_idx) - { - + hb_range ((unsigned) class2Count) - | hb_filter (klass2_map) - | hb_apply ([&] (const unsigned class2_idx) - { - unsigned idx = (class1_idx * (unsigned) class2Count + class2_idx) * (len1 + len2); - valueFormat1.serialize_copy (c->serializer, this, &values[idx]); - valueFormat2.serialize_copy (c->serializer, this, &values[idx + len1]); - }) - ; - }) + { + + hb_range ((unsigned) class2Count) + | hb_filter (klass2_map) + | hb_apply ([&] (const unsigned class2_idx) + { + unsigned idx = (class1_idx * (unsigned) class2Count + class2_idx) * (len1 + len2); + valueFormat1.serialize_copy (c->serializer, this, &values[idx]); + valueFormat2.serialize_copy (c->serializer, this, &values[idx + len1]); + }) + ; + }) ; const hb_set_t &glyphset = *c->plan->_glyphset_gsub; diff --git a/src/hb-ot-layout-gsubgpos.hh b/src/hb-ot-layout-gsubgpos.hh index 5ce832f4d..b0d1c2e63 100644 --- a/src/hb-ot-layout-gsubgpos.hh +++ b/src/hb-ot-layout-gsubgpos.hh @@ -114,7 +114,7 @@ struct hb_closure_context_t : nesting_level_left (nesting_level_left_), debug_depth (0), done_lookups (done_lookups_), - lookup_count (0) + lookup_count (0) {} ~hb_closure_context_t () { flush (); } @@ -191,7 +191,7 @@ struct hb_closure_lookups_context_t : debug_depth (0), visited_lookups (visited_lookups_), inactive_lookups (inactive_lookups_), - lookup_count (0) {} + lookup_count (0) {} 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; template 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 { r.add_coverage (set); @@ -569,7 +569,7 @@ struct hb_ot_apply_context_t : #ifndef HB_NO_OT_LAYOUT *face->table.GDEF->table #else - Null(GDEF) + Null (GDEF) #endif ), var_store (gdef.get_var_store ()), @@ -2155,8 +2155,8 @@ struct ChainRule template void serialize_array (hb_serialize_context_t *c, - HBUINT16 len, - Iterator it) const + HBUINT16 len, + Iterator it) const { c->copy (len); for (const auto g : it) @@ -2197,9 +2197,9 @@ struct ChainRule } bool subset (hb_subset_context_t *c, - const hb_map_t *backtrack_map = nullptr, - const hb_map_t *input_map = nullptr, - const hb_map_t *lookahead_map = nullptr) const + const hb_map_t *backtrack_map = nullptr, + const hb_map_t *input_map = nullptr, + const hb_map_t *lookahead_map = nullptr) const { TRACE_SUBSET (this); @@ -2210,18 +2210,18 @@ struct ChainRule { const hb_set_t &glyphset = *c->plan->glyphset (); if (!hb_all (backtrack, glyphset) || - !hb_all (input, glyphset) || - !hb_all (lookahead, glyphset)) - return_trace (false); + !hb_all (input, glyphset) || + !hb_all (lookahead, glyphset)) + return_trace (false); copy (c->serializer, c->plan->glyph_map); } else { if (!hb_all (backtrack, backtrack_map) || - !hb_all (input, input_map) || - !hb_all (lookahead, lookahead_map)) - return_trace (false); + !hb_all (input, input_map) || + !hb_all (lookahead, lookahead_map)) + return_trace (false); copy (c->serializer, backtrack_map, input_map, lookahead_map); } @@ -2324,9 +2324,9 @@ struct ChainRuleSet } bool subset (hb_subset_context_t *c, - const hb_map_t *backtrack_klass_map = nullptr, - const hb_map_t *input_klass_map = nullptr, - const hb_map_t *lookahead_klass_map = nullptr) const + const hb_map_t *backtrack_klass_map = nullptr, + const hb_map_t *input_klass_map = nullptr, + const hb_map_t *lookahead_klass_map = nullptr) const { TRACE_SUBSET (this); @@ -2342,12 +2342,12 @@ struct ChainRuleSet auto o_snap = c->serializer->snapshot (); if (!o->serialize_subset (c, _, this, - backtrack_klass_map, - input_klass_map, - lookahead_klass_map)) + backtrack_klass_map, + input_klass_map, + lookahead_klass_map)) { - out->rule.pop (); - c->serializer->revert (o_snap); + out->rule.pop (); + c->serializer->revert (o_snap); } } @@ -2645,15 +2645,15 @@ struct ChainContextFormat2 auto *o = out->ruleSet.serialize_append (c->serializer); if (unlikely (!o)) { - ret = false; - break; + ret = false; + break; } if (!o->serialize_subset (c, _, this, - &backtrack_klass_map, - &input_klass_map, - &lookahead_klass_map)) + &backtrack_klass_map, + &input_klass_map, + &lookahead_klass_map)) { - rulesets.push (0); + rulesets.push (0); } else rulesets.push (1); } @@ -2967,7 +2967,7 @@ struct Extension { switch (u.format) { case 1: return u.format1.template get_subtable (); - default:return Null(typename T::SubTable); + default:return Null (typename T::SubTable); } } @@ -3102,13 +3102,13 @@ struct GSUBGPOS typedef LookupOffsetList TLookupList; reinterpret_cast &> (out->lookupList) - .serialize_subset (c->subset_context, + .serialize_subset (c->subset_context, reinterpret_cast &> (lookupList), this, c); reinterpret_cast &> (out->featureList) - .serialize_subset (c->subset_context, + .serialize_subset (c->subset_context, reinterpret_cast &> (featureList), this, c); @@ -3124,8 +3124,8 @@ struct GSUBGPOS bool ret = out->featureVars.serialize_subset (c->subset_context, featureVars, this, c); if (!ret) { - out->version.major = 1; - out->version.minor = 0; + out->version.major = 1; + out->version.minor = 0; } } #endif @@ -3140,7 +3140,7 @@ struct GSUBGPOS for (unsigned i = 0; i < feature_count; i++) { if (get_feature (i).intersects_lookup_indexes (lookup_indexes)) - feature_indexes->add (i); + feature_indexes->add (i); } #ifndef HB_NO_VAR if (version.to_int () >= 0x00010001u) diff --git a/src/hb-ot-layout.cc b/src/hb-ot-layout.cc index 2d7f46cc3..058caa2b9 100644 --- a/src/hb-ot-layout.cc +++ b/src/hb-ot-layout.cc @@ -419,7 +419,7 @@ get_gsubgpos_table (hb_face_t *face, switch (table_tag) { case HB_OT_TAG_GSUB: return *face->table.GSUB->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: { - const OT::SubstLookup& l = face->table.GSUB->table->get_lookup (lookup_index); - l.closure_lookups (&c, lookup_index); - break; + const OT::SubstLookup& l = face->table.GSUB->table->get_lookup (lookup_index); + l.closure_lookups (&c, lookup_index); + break; } case HB_OT_TAG_GPOS: { - const OT::PosLookup& l = face->table.GPOS->table->get_lookup (lookup_index); - l.closure_lookups (&c, lookup_index); - break; + const OT::PosLookup& l = face->table.GPOS->table->get_lookup (lookup_index); + l.closure_lookups (&c, lookup_index); + break; } } } @@ -1513,8 +1513,8 @@ hb_ot_layout_delete_glyphs_inplace (hb_buffer_t *buffer, **/ void hb_ot_layout_lookup_substitute_closure (hb_face_t *face, - unsigned int lookup_index, - hb_set_t *glyphs /* OUT */) + unsigned int lookup_index, + hb_set_t *glyphs /* OUT */) { hb_map_t done_lookups; OT::hb_closure_context_t c (face, glyphs, &done_lookups); diff --git a/src/hb-ot-name-table.hh b/src/hb-ot-name-table.hh index c0c6fb1e6..f81c3792e 100644 --- a/src/hb-ot-name-table.hh +++ b/src/hb-ot-name-table.hh @@ -112,7 +112,7 @@ struct NameRecord unsigned int e = encodingID; 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) diff --git a/src/hb-ot-shape-complex-arabic-fallback.hh b/src/hb-ot-shape-complex-arabic-fallback.hh index 2a7a8ebbc..262ab8a1f 100644 --- a/src/hb-ot-shape-complex-arabic-fallback.hh +++ b/src/hb-ot-shape-complex-arabic-fallback.hh @@ -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)); if (unlikely (!fallback_plan)) - return const_cast (&Null(arabic_fallback_plan_t)); + return const_cast (&Null (arabic_fallback_plan_t)); fallback_plan->num_lookups = 0; 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); free (fallback_plan); - return const_cast (&Null(arabic_fallback_plan_t)); + return const_cast (&Null (arabic_fallback_plan_t)); } static void diff --git a/src/hb-ot-shape-complex-arabic.cc b/src/hb-ot-shape-complex-arabic.cc index 481b06204..0c1863bc5 100644 --- a/src/hb-ot-shape-complex-arabic.cc +++ b/src/hb-ot-shape-complex-arabic.cc @@ -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->do_fallback = arabic_plan->do_fallback && (FEATURE_IS_SYRIAC (arabic_features[i]) || - plan->map.needs_fallback (arabic_features[i])); + plan->map.needs_fallback (arabic_features[i])); } return arabic_plan; diff --git a/src/hb-ot-var-hvar-table.hh b/src/hb-ot-var-hvar-table.hh index 689534bfb..fdcc88d67 100644 --- a/src/hb-ot-var-hvar-table.hh +++ b/src/hb-ot-var-hvar-table.hh @@ -139,7 +139,7 @@ struct index_map_subset_plan_t max_inners.init (); output_map.init (); - if (&index_map == &Null(DeltaSetIndexMap)) return; + if (&index_map == &Null (DeltaSetIndexMap)) return; unsigned int last_val = (unsigned int)-1; hb_codepoint_t last_gid = (hb_codepoint_t)-1; @@ -202,7 +202,7 @@ struct index_map_subset_plan_t const hb_vector_t &inner_maps, 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++) { diff --git a/src/hb-set.cc b/src/hb-set.cc index 10638a7e6..0551ed80f 100644 --- a/src/hb-set.cc +++ b/src/hb-set.cc @@ -69,7 +69,7 @@ hb_set_create () hb_set_t * hb_set_get_empty () { - return const_cast (&Null(hb_set_t)); + return const_cast (&Null (hb_set_t)); } /** @@ -145,9 +145,9 @@ hb_set_get_user_data (hb_set_t *set, * hb_set_allocation_successful: * @set: a set. * - * * - * Return value: + * + * Return value: * * Since: 0.9.2 **/ @@ -161,7 +161,7 @@ hb_set_allocation_successful (const hb_set_t *set) * hb_set_clear: * @set: a set. * - * + * * * Since: 0.9.2 **/ @@ -175,9 +175,9 @@ hb_set_clear (hb_set_t *set) * hb_set_is_empty: * @set: a set. * - * * - * Return value: + * + * Return value: * * Since: 0.9.7 **/ @@ -190,11 +190,11 @@ hb_set_is_empty (const hb_set_t *set) /** * hb_set_has: * @set: a set. - * @codepoint: + * @codepoint: * - * * - * Return value: + * + * Return value: * * Since: 0.9.2 **/ @@ -208,9 +208,9 @@ hb_set_has (const hb_set_t *set, /** * hb_set_add: * @set: a set. - * @codepoint: + * @codepoint: + * * - * * * Since: 0.9.2 **/ @@ -224,10 +224,10 @@ hb_set_add (hb_set_t *set, /** * hb_set_add_range: * @set: a set. - * @first: - * @last: + * @first: + * @last: + * * - * * * Since: 0.9.7 **/ @@ -242,9 +242,9 @@ hb_set_add_range (hb_set_t *set, /** * hb_set_del: * @set: a set. - * @codepoint: + * @codepoint: + * * - * * * Since: 0.9.2 **/ @@ -258,10 +258,10 @@ hb_set_del (hb_set_t *set, /** * hb_set_del_range: * @set: a set. - * @first: - * @last: + * @first: + * @last: + * * - * * * Since: 0.9.7 **/ @@ -278,7 +278,7 @@ hb_set_del_range (hb_set_t *set, * @set: a set. * @other: other set. * - * + * * * 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: * @set: a set. - * @other: + * @other: + * * - * * * Since: 0.9.2 **/ @@ -328,9 +328,9 @@ hb_set_set (hb_set_t *set, /** * hb_set_union: * @set: a set. - * @other: + * @other: + * * - * * * Since: 0.9.2 **/ @@ -344,9 +344,9 @@ hb_set_union (hb_set_t *set, /** * hb_set_intersect: * @set: a set. - * @other: + * @other: + * * - * * * Since: 0.9.2 **/ @@ -360,9 +360,9 @@ hb_set_intersect (hb_set_t *set, /** * hb_set_subtract: * @set: a set. - * @other: + * @other: + * * - * * * Since: 0.9.2 **/ @@ -376,9 +376,9 @@ hb_set_subtract (hb_set_t *set, /** * hb_set_symmetric_difference: * @set: a set. - * @other: + * @other: + * * - * * * Since: 0.9.2 **/ @@ -394,7 +394,7 @@ hb_set_symmetric_difference (hb_set_t *set, * hb_set_invert: * @set: a set. * - * + * * * Since: 0.9.10 * diff --git a/src/hb-set.hh b/src/hb-set.hh index 56df9b111..38bd9c221 100644 --- a/src/hb-set.hh +++ b/src/hb-set.hh @@ -530,7 +530,7 @@ struct hb_set_t if (old_index_to_page_map_index[i] == 0xFFFFFFFF) continue; 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; write_index++; @@ -555,16 +555,16 @@ struct hb_set_t { if (page_map[a].major == other->page_map[b].major) { - if (!Op::passthru_left) - { - // 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 - // passthru_left is set since no left side pages will be removed - // in that case. - if (write_index < a) - page_map[write_index] = page_map[a]; - write_index++; - } + if (!Op::passthru_left) + { + // 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 + // passthru_left is set since no left side pages will be removed + // in that case. + if (write_index < a) + page_map[write_index] = page_map[a]; + write_index++; + } count++; a++; @@ -808,7 +808,7 @@ struct hb_set_t struct iter_t : hb_iter_with_fallback_t { 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) { if (init) diff --git a/src/hb-shape-plan.cc b/src/hb-shape-plan.cc index ffd723d08..666470b4f 100644 --- a/src/hb-shape-plan.cc +++ b/src/hb-shape-plan.cc @@ -257,7 +257,7 @@ bail: hb_shape_plan_t * hb_shape_plan_get_empty () { - return const_cast (&Null(hb_shape_plan_t)); + return const_cast (&Null (hb_shape_plan_t)); } /** diff --git a/src/hb-subset-cff-common.hh b/src/hb-subset-cff-common.hh index d3909acbd..260da77a0 100644 --- a/src/hb-subset-cff-common.hh +++ b/src/hb-subset-cff-common.hh @@ -44,7 +44,7 @@ struct str_encoder_t void encode_byte (unsigned char b) { - if (unlikely (buff.push (b) == &Crap(unsigned char))) + if (unlikely (buff.push (b) == &Crap (unsigned char))) set_error (); } diff --git a/src/hb-subset-cff1.cc b/src/hb-subset-cff1.cc index ec6794b64..c84b3e2c6 100644 --- a/src/hb-subset-cff1.cc +++ b/src/hb-subset-cff1.cc @@ -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 */ 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 (); base = base_; @@ -437,7 +437,7 @@ struct cff_subset_plan { } last_code = code; - if (encoding != &Null(Encoding)) + if (encoding != &Null (Encoding)) { hb_codepoint_t sid = acc.glyph_to_sid (old_glyph); 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++) if (fdmap.has (i)) (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 */ - if (acc.fdSelect != &Null(CFF1FDSelect)) + if (acc.fdSelect != &Null (CFF1FDSelect)) { if (unlikely (!hb_plan_subset_cff_fdselect (plan, orig_fdcount, @@ -763,7 +763,7 @@ static bool _serialize_cff1 (hb_serialize_context_t *c, } /* FDArray (FD Index) */ - if (acc.fdArray != &Null(CFF1FDArray)) + if (acc.fdArray != &Null (CFF1FDArray)) { CFF1FDArray *fda = c->start_embed (); if (unlikely (fda == nullptr)) return false; @@ -780,7 +780,7 @@ static bool _serialize_cff1 (hb_serialize_context_t *c, } /* FDSelect */ - if (acc.fdSelect != &Null(CFF1FDSelect)) + if (acc.fdSelect != &Null (CFF1FDSelect)) { c->push (); if (likely (hb_serialize_cff_fdselect (c, num_glyphs, *acc.fdSelect, acc.fdCount, diff --git a/src/hb-subset-cff2.cc b/src/hb-subset-cff2.cc index eaa2755e1..02132d3d2 100644 --- a/src/hb-subset-cff2.cc +++ b/src/hb-subset-cff2.cc @@ -300,7 +300,7 @@ struct cff2_subset_plan { } /* FDSelect */ - if (acc.fdSelect != &Null(CFF2FDSelect)) + if (acc.fdSelect != &Null (CFF2FDSelect)) { if (unlikely (!hb_plan_subset_cff_fdselect (plan, orig_fdcount, @@ -397,7 +397,7 @@ static bool _serialize_cff2 (hb_serialize_context_t *c, } /* FDSelect */ - if (acc.fdSelect != &Null(CFF2FDSelect)) + if (acc.fdSelect != &Null (CFF2FDSelect)) { c->push (); 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 */ - if (acc.varStore != &Null(CFF2VariationStore)) + if (acc.varStore != &Null (CFF2VariationStore)) { c->push (); CFF2VariationStore *dest = c->start_embed (); diff --git a/src/hb-subset.hh b/src/hb-subset.hh index 64d725362..a3dfd3b87 100644 --- a/src/hb-subset.hh +++ b/src/hb-subset.hh @@ -62,7 +62,7 @@ struct hb_subset_context_t : hb_subset_context_t (hb_blob_t *source_blob_, hb_subset_plan_t *plan_, hb_serialize_context_t *serializer_) : - source_blob (source_blob_), + source_blob (source_blob_), plan (plan_), serializer (serializer_), debug_depth (0) {} diff --git a/src/hb-unicode.cc b/src/hb-unicode.cc index 08a4054cd..36070a7f1 100644 --- a/src/hb-unicode.cc +++ b/src/hb-unicode.cc @@ -212,7 +212,7 @@ DEFINE_NULL_INSTANCE (hb_unicode_funcs_t) = hb_unicode_funcs_t * hb_unicode_funcs_get_empty () { - return const_cast (&Null(hb_unicode_funcs_t)); + return const_cast (&Null (hb_unicode_funcs_t)); } /** diff --git a/src/hb-vector.hh b/src/hb-vector.hh index 7b150fba0..d979169de 100644 --- a/src/hb-vector.hh +++ b/src/hb-vector.hh @@ -117,7 +117,7 @@ struct hb_vector_t { unsigned int i = (unsigned int) i_; if (unlikely (i >= length)) - return Null(Type); + return Null (Type); return arrayZ[i]; } @@ -165,7 +165,7 @@ struct hb_vector_t Type *push () { if (unlikely (!resize (length + 1))) - return &Crap(Type); + return &Crap (Type); return &arrayZ[length - 1]; } template @@ -228,7 +228,7 @@ struct hb_vector_t Type pop () { - if (!length) return Null(Type); + if (!length) return Null (Type); return hb_move (arrayZ[--length]); /* Does this move actually work? */ } diff --git a/src/test-iter.cc b/src/test-iter.cc index 9c8317188..fd201c85e 100644 --- a/src/test-iter.cc +++ b/src/test-iter.cc @@ -105,7 +105,7 @@ test_iterator (Iter it) template static void -test_iterable (const Iterable &lst = Null(Iterable)) +test_iterable (const Iterable &lst = Null (Iterable)) { for (auto _ : lst) (void) _;