This commit is contained in:
Ebrahim Byagowi 2020-07-18 22:14:52 +04:30
parent 7e3edfa454
commit d0e2addd43
17 changed files with 87 additions and 80 deletions

View File

@ -101,7 +101,7 @@ struct BaselineTableFormat3Part
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (c->check_struct (this) && lookupTable.sanitize (c));
return_trace (likely (c->check_struct (this) && lookupTable.sanitize (c)));
}
protected:

View File

@ -484,7 +484,7 @@ struct KerxSubTableFormat4
};
driver_context_t (const KerxSubTableFormat4 *table,
hb_aat_apply_context_t *c_) :
hb_aat_apply_context_t *c_) :
c (c_),
action_type ((table->flags & ActionType) >> 30),
ankrData ((HBUINT16 *) ((const char *) &table->machine + (table->flags & Offset))),
@ -493,9 +493,7 @@ struct KerxSubTableFormat4
bool is_actionable (StateTableDriver<Types, EntryData> *driver HB_UNUSED,
const Entry<EntryData> &entry)
{
return entry.data.ankrActionIndex != 0xFFFF;
}
{ return entry.data.ankrActionIndex != 0xFFFF; }
void transition (StateTableDriver<Types, EntryData> *driver,
const Entry<EntryData> &entry)
{
@ -630,7 +628,7 @@ struct KerxSubTableFormat6
bool is_long () const { return flags & ValuesAreLong; }
int get_kerning (hb_codepoint_t left, hb_codepoint_t right,
hb_aat_apply_context_t *c) const
hb_aat_apply_context_t *c) const
{
unsigned int num_glyphs = c->sanitizer.get_num_glyphs ();
if (is_long ())

View File

@ -971,7 +971,7 @@ struct Chain
}
void apply (hb_aat_apply_context_t *c,
hb_mask_t flags) const
hb_mask_t flags) const
{
const ChainSubtable<Types> *subtable = &StructAfter<ChainSubtable<Types>> (featureZ.as_array (featureCount));
unsigned int count = subtableCount;

View File

@ -1096,8 +1096,8 @@ hb_buffer_get_flags (hb_buffer_t *buffer)
* Since: 0.9.42
**/
void
hb_buffer_set_cluster_level (hb_buffer_t *buffer,
hb_buffer_cluster_level_t cluster_level)
hb_buffer_set_cluster_level (hb_buffer_t *buffer,
hb_buffer_cluster_level_t cluster_level)
{
if (unlikely (hb_object_is_immutable (buffer)))
return;

View File

@ -318,7 +318,7 @@ struct hb_buffer_t
HB_INTERNAL void delete_glyph ();
void unsafe_to_break (unsigned int start,
unsigned int end)
unsigned int end)
{
if (end - start < 2)
return;

View File

@ -52,7 +52,7 @@ struct blend_arg_t : number_t
void set_real (double v) { reset_blends (); number_t::set_real (v); }
void set_blends (unsigned int numValues_, unsigned int valueIndex_,
unsigned int numBlends, hb_array_t<const blend_arg_t> blends_)
unsigned int numBlends, hb_array_t<const blend_arg_t> blends_)
{
numValues = numValues_;
valueIndex = valueIndex_;

View File

@ -339,7 +339,7 @@ struct hb_font_t
}
hb_bool_t get_glyph_contour_point (hb_codepoint_t glyph, unsigned int point_index,
hb_position_t *x, hb_position_t *y)
hb_position_t *x, hb_position_t *y)
{
*x = *y = 0;
return klass->get.f.glyph_contour_point (this, user_data,

View File

@ -157,10 +157,10 @@ struct CmapSubtableFormat4
template<typename Iterator,
hb_requires (hb_is_iterator (Iterator))>
HBINT16* serialize_idDelta_array (hb_serialize_context_t *c,
Iterator it,
HBUINT16 *endCode,
HBUINT16 *startCode,
unsigned segcount)
Iterator it,
HBUINT16 *endCode,
HBUINT16 *startCode,
unsigned segcount)
{
unsigned i = 0;
hb_codepoint_t last_gid = 0, start_gid = 0, last_cp = 0xFFFF;
@ -317,12 +317,12 @@ struct CmapSubtableFormat4
HBUINT16 last;
};
const HBUINT16 *found =hb_bsearch (codepoint,
this->endCount,
this->segCount,
2,
_hb_cmp_method<hb_codepoint_t, CustomRange, unsigned>,
this->segCount + 1);
const HBUINT16 *found = hb_bsearch (codepoint,
this->endCount,
this->segCount,
2,
_hb_cmp_method<hb_codepoint_t, CustomRange, unsigned>,
this->segCount + 1);
if (!found)
return false;
unsigned int i = found - endCount;
@ -466,8 +466,8 @@ struct CmapSubtableFormat4
* If that is the case, just change the value to truncate
* the subtable at the end of the blob. */
uint16_t new_length = (uint16_t) hb_min ((uintptr_t) 65535,
(uintptr_t) (c->end -
(char *) this));
(uintptr_t) (c->end -
(char *) this));
if (!c->try_set (&length, new_length))
return_trace (false);
}
@ -793,7 +793,7 @@ struct DefaultUVS : SortedArrayOf<UnicodeValueRange, HBUINT32>
{
hb_codepoint_t first = arrayZ[i].startUnicodeValue;
hb_codepoint_t last = hb_min ((hb_codepoint_t) (first + arrayZ[i].additionalCount),
(hb_codepoint_t) HB_UNICODE_MAX);
(hb_codepoint_t) HB_UNICODE_MAX);
out->add_range (first, last);
}
}
@ -1366,7 +1366,7 @@ struct cmap
hb_set_t unicodes_set;
hb_map_t cp_glyphid_map;
(base+_.subtable).collect_mapping (&unicodes_set, &cp_glyphid_map);
auto table_iter =
+ hb_zip (unicodes_set.iter(), unicodes_set.iter() | hb_map(cp_glyphid_map))
| hb_filter (plan->_glyphset, hb_second)
@ -1380,7 +1380,7 @@ struct cmap
return hb_pair_t<hb_codepoint_t, hb_codepoint_t> (p_org.first, plan->glyph_map->get(p_org.second));
})
;
if (format == 4) c->copy (_, table_iter, 4u, base, plan, &format4objidx);
else if (format == 12) c->copy (_, table_iter, 12u, base, plan, &format12objidx);
else if (format == 14) c->copy (_, table_iter, 14u, base, plan, &format14objidx);

View File

@ -1297,9 +1297,9 @@ struct CoverageFormat2
unsigned int get_coverage (hb_codepoint_t glyph_id) const
{
const RangeRecord &range = rangeRecord.bsearch (glyph_id);
return likely (range.first <= range.last) ?
(unsigned int) range.value + (glyph_id - range.first) :
NOT_COVERED;
return likely (range.first <= range.last)
? (unsigned int) range.value + (glyph_id - range.first)
: NOT_COVERED;
}
template <typename Iterator,
@ -2191,7 +2191,7 @@ struct VarRegionAxis
struct VarRegionList
{
float evaluate (unsigned int region_index,
const int *coords, unsigned int coord_len) const
const int *coords, unsigned int coord_len) const
{
if (unlikely (region_index >= regionCount))
return 0.;
@ -2261,8 +2261,8 @@ struct VarData
{ return itemCount * get_row_size (); }
float get_delta (unsigned int inner,
const int *coords, unsigned int coord_count,
const VarRegionList &regions) const
const int *coords, unsigned int coord_count,
const VarRegionList &regions) const
{
if (unlikely (inner >= itemCount))
return 0.;
@ -2836,7 +2836,7 @@ struct FeatureVariations
static constexpr unsigned NOT_FOUND_INDEX = 0xFFFFFFFFu;
bool find_index (const int *coords, unsigned int coord_len,
unsigned int *index) const
unsigned int *index) const
{
unsigned int count = varRecords.len;
for (unsigned int i = 0; i < count; i++)

View File

@ -49,7 +49,7 @@ struct AttachPoint : ArrayOf<HBUINT16>
TRACE_SUBSET (this);
auto *out = c->serializer->start_embed (*this);
if (unlikely (!out)) return_trace (false);
return_trace (out->serialize (c->serializer, + iter ()));
}
};
@ -231,9 +231,9 @@ struct CaretValueFormat3
struct CaretValue
{
hb_position_t get_caret_value (hb_font_t *font,
hb_direction_t direction,
hb_codepoint_t glyph_id,
const VariationStore &var_store) const
hb_direction_t direction,
hb_codepoint_t glyph_id,
const VariationStore &var_store) const
{
switch (u.format) {
case 1: return u.format1.get_caret_value (font, direction);

View File

@ -79,14 +79,14 @@ struct ValueFormat : HBUINT16
/* All fields are options. Only those available advance the value pointer. */
#if 0
HBINT16 xPlacement; /* Horizontal adjustment for
HBINT16 xPlacement; /* Horizontal adjustment for
* placement--in design units */
HBINT16 yPlacement; /* Vertical adjustment for
HBINT16 yPlacement; /* Vertical adjustment for
* placement--in design units */
HBINT16 xAdvance; /* Horizontal adjustment for
HBINT16 xAdvance; /* Horizontal adjustment for
* advance--in design units (only used
* for horizontal writing) */
HBINT16 yAdvance; /* Vertical adjustment for advance--in
HBINT16 yAdvance; /* Vertical adjustment for advance--in
* design units (only used for vertical
* writing) */
OffsetTo<Device> xPlaDevice; /* Offset to Device table for
@ -698,7 +698,7 @@ struct SinglePosFormat1
void collect_variation_indices (hb_collect_variation_indices_context_t *c) const
{
if (!valueFormat.has_device ()) return;
auto it =
+ hb_iter (this+coverage)
| hb_filter (c->glyph_set)
@ -801,7 +801,7 @@ struct SinglePosFormat2
void collect_variation_indices (hb_collect_variation_indices_context_t *c) const
{
if (!valueFormat.has_device ()) return;
auto it =
+ hb_zip (this+coverage, hb_range ((unsigned) valueCount))
| hb_filter (c->glyph_set, hb_first)
@ -1063,7 +1063,7 @@ struct PairSet
}
void collect_glyphs (hb_collect_glyphs_context_t *c,
const ValueFormat *valueFormats) const
const ValueFormat *valueFormats) const
{
unsigned int len1 = valueFormats[0].get_len ();
unsigned int len2 = valueFormats[1].get_len ();
@ -1347,7 +1347,7 @@ struct PairPosFormat2
}
if (class1_set.is_empty () || class2_set.is_empty ()) return;
unsigned len1 = valueFormat1.get_len ();
unsigned len2 = valueFormat2.get_len ();
const hb_array_t<const Value> values_array = values.as_array ((unsigned)class1Count * (unsigned) class2Count * (len1 + len2));
@ -1358,7 +1358,7 @@ struct PairPosFormat2
unsigned start_offset = (class1_idx * (unsigned) class2Count + class2_idx) * (len1 + len2);
if (valueFormat1.has_device ())
valueFormat1.collect_variation_indices (c, this, values_array.sub_array (start_offset, len1));
if (valueFormat2.has_device ())
valueFormat2.collect_variation_indices (c, this, values_array.sub_array (start_offset+len1, len2));
}
@ -1816,8 +1816,10 @@ static void Markclass_closure_and_remap_indexes (const Coverage &mark_coverage,
struct MarkBasePosFormat1
{
bool intersects (const hb_set_t *glyphs) const
{ return (this+markCoverage).intersects (glyphs) &&
(this+baseCoverage).intersects (glyphs); }
{
return (this+markCoverage).intersects (glyphs) &&
(this+baseCoverage).intersects (glyphs);
}
void closure_lookups (hb_closure_lookups_context_t *c) const {}
@ -2031,8 +2033,10 @@ typedef OffsetListOf<LigatureAttach> LigatureArray;
struct MarkLigPosFormat1
{
bool intersects (const hb_set_t *glyphs) const
{ return (this+markCoverage).intersects (glyphs) &&
(this+ligatureCoverage).intersects (glyphs); }
{
return (this+markCoverage).intersects (glyphs) &&
(this+ligatureCoverage).intersects (glyphs);
}
void closure_lookups (hb_closure_lookups_context_t *c) const {}
@ -2189,8 +2193,10 @@ typedef AnchorMatrix Mark2Array; /* mark2-major--
struct MarkMarkPosFormat1
{
bool intersects (const hb_set_t *glyphs) const
{ return (this+mark1Coverage).intersects (glyphs) &&
(this+mark2Coverage).intersects (glyphs); }
{
return (this+mark1Coverage).intersects (glyphs) &&
(this+mark2Coverage).intersects (glyphs);
}
void closure_lookups (hb_closure_lookups_context_t *c) const {}
@ -2254,12 +2260,15 @@ struct MarkMarkPosFormat1
unsigned int comp1 = _hb_glyph_info_get_lig_comp (&buffer->cur());
unsigned int comp2 = _hb_glyph_info_get_lig_comp (&buffer->info[j]);
if (likely (id1 == id2)) {
if (likely (id1 == id2))
{
if (id1 == 0) /* Marks belonging to the same base. */
goto good;
else if (comp1 == comp2) /* Marks belonging to the same ligature component. */
goto good;
} else {
}
else
{
/* If ligature ids don't match, it may be the case that one of the marks
* itself is a ligature. In which case match. */
if ((id1 > 0 && !comp1) || (id2 > 0 && !comp2))
@ -2311,7 +2320,7 @@ struct MarkMarkPosFormat1
out->mark1Array.serialize (c->serializer, out)
.serialize (c->serializer, &klass_mapping, c->plan->layout_variation_idx_map, &(this+mark1Array), + mark1_iter
| hb_map (hb_second));
unsigned mark2count = (this+mark2Array).rows;
auto mark2_iter =
+ hb_zip (this+mark2Coverage, hb_range (mark2count))

View File

@ -852,8 +852,8 @@ struct Ligature
auto *out = c->serializer->start_embed (*this);
return_trace (out->serialize (c->serializer,
glyph_map[ligGlyph],
it));
glyph_map[ligGlyph],
it));
}
public:

View File

@ -335,7 +335,7 @@ struct hb_ot_apply_context_t :
void set_mask (hb_mask_t mask_) { mask = mask_; }
void set_syllable (uint8_t syllable_) { syllable = syllable_; }
void set_match_func (match_func_t match_func_,
const void *match_data_)
const void *match_data_)
{ match_func = match_func_; match_data = match_data_; }
enum may_match_t {
@ -540,8 +540,8 @@ struct hb_ot_apply_context_t :
hb_ot_apply_context_t (unsigned int table_index_,
hb_font_t *font_,
hb_buffer_t *buffer_) :
hb_font_t *font_,
hb_buffer_t *buffer_) :
iter_input (), iter_context (),
font (font_), face (font->face), buffer (buffer_),
recurse_func (nullptr),
@ -3013,7 +3013,7 @@ struct ChainContextFormat3
const hb_map_t *lookup_map = c->table_tag == HB_OT_TAG_GSUB ? c->plan->gsub_lookups : c->plan->gpos_lookups;
for (unsigned i = 0; i < (unsigned) lookupCount; i++)
if (!c->serializer->copy (lookupRecord[i], lookup_map)) return_trace (false);
return_trace (true);
}

View File

@ -78,7 +78,7 @@ struct MathConstants
}
hb_position_t get_value (hb_ot_math_constant_t constant,
hb_font_t *font) const
hb_font_t *font) const
{
switch (constant) {
@ -616,12 +616,12 @@ struct MathVariants
.get_variants (direction, font, start_offset, variants_count, variants); }
unsigned int get_glyph_parts (hb_codepoint_t glyph,
hb_direction_t direction,
hb_font_t *font,
unsigned int start_offset,
unsigned int *parts_count, /* IN/OUT */
hb_ot_math_glyph_part_t *parts /* OUT */,
hb_position_t *italics_correction /* OUT */) const
hb_direction_t direction,
hb_font_t *font,
unsigned int start_offset,
unsigned int *parts_count, /* IN/OUT */
hb_ot_math_glyph_part_t *parts /* OUT */,
hb_position_t *italics_correction /* OUT */) const
{ return get_glyph_construction (glyph, direction, font)
.get_assembly ()
.get_parts (direction, font,
@ -701,7 +701,7 @@ struct MATH
}
hb_position_t get_constant (hb_ot_math_constant_t constant,
hb_font_t *font) const
hb_font_t *font) const
{ return (this+mathConstants).get_value (constant, font); }
const MathGlyphInfo &get_glyph_info () const { return this+mathGlyphInfo; }

View File

@ -1097,12 +1097,12 @@ hb_ot_shape_internal (hb_ot_shape_context_t *c)
if (likely (!hb_unsigned_mul_overflows (c->buffer->len, HB_BUFFER_MAX_LEN_FACTOR)))
{
c->buffer->max_len = hb_max (c->buffer->len * HB_BUFFER_MAX_LEN_FACTOR,
(unsigned) HB_BUFFER_MAX_LEN_MIN);
(unsigned) HB_BUFFER_MAX_LEN_MIN);
}
if (likely (!hb_unsigned_mul_overflows (c->buffer->len, HB_BUFFER_MAX_OPS_FACTOR)))
{
c->buffer->max_ops = hb_max (c->buffer->len * HB_BUFFER_MAX_OPS_FACTOR,
(unsigned) HB_BUFFER_MAX_OPS_MIN);
(unsigned) HB_BUFFER_MAX_OPS_MIN);
}
/* Save the original direction, we use it later. */

View File

@ -545,7 +545,7 @@ struct gvar
hb_vector_t<unsigned int> shared_indices;
GlyphVariationData::tuple_iterator_t iterator;
if (!GlyphVariationData::get_tuple_iterator (var_data_bytes, table->axisCount,
shared_indices, &iterator))
shared_indices, &iterator))
return true; /* so isn't applied at all */
/* Save original points for inferred delta calculation */

View File

@ -303,13 +303,13 @@ struct cff2_subset_plan {
if (acc.fdSelect != &Null (CFF2FDSelect))
{
if (unlikely (!hb_plan_subset_cff_fdselect (plan,
orig_fdcount,
*(const FDSelect *)acc.fdSelect,
subset_fdcount,
subset_fdselect_size,
subset_fdselect_format,
subset_fdselect_ranges,
fdmap)))
orig_fdcount,
*(const FDSelect *)acc.fdSelect,
subset_fdcount,
subset_fdselect_size,
subset_fdselect_format,
subset_fdselect_ranges,
fdmap)))
return false;
}
else