Turn 8 spaces to tab across the project

According to the current code style of the project
This commit is contained in:
Ebrahim Byagowi 2019-08-24 17:57:14 +04:30
parent 269a120f13
commit a0b4ac4dce
78 changed files with 655 additions and 661 deletions

View File

@ -830,7 +830,7 @@ struct KerxTable
for (unsigned int i = 0; i < count; i++) for (unsigned int i = 0; i < count; i++)
{ {
if (st->get_type () == 1) if (st->get_type () == 1)
return true; return true;
st = &StructAfter<SubTable> (*st); st = &StructAfter<SubTable> (*st);
} }
return false; return false;
@ -845,7 +845,7 @@ struct KerxTable
for (unsigned int i = 0; i < count; i++) for (unsigned int i = 0; i < count; i++)
{ {
if (st->u.header.coverage & st->u.header.CrossStream) if (st->u.header.coverage & st->u.header.CrossStream)
return true; return true;
st = &StructAfter<SubTable> (*st); st = &StructAfter<SubTable> (*st);
} }
return false; return false;
@ -862,7 +862,7 @@ struct KerxTable
{ {
if ((st->u.header.coverage & (st->u.header.Variation | st->u.header.CrossStream)) || if ((st->u.header.coverage & (st->u.header.Variation | st->u.header.CrossStream)) ||
!st->u.header.is_horizontal ()) !st->u.header.is_horizontal ())
continue; continue;
v += st->get_kerning (left, right); v += st->get_kerning (left, right);
st = &StructAfter<SubTable> (*st); st = &StructAfter<SubTable> (*st);
} }
@ -883,7 +883,7 @@ struct KerxTable
bool reverse; bool reverse;
if (!T::Types::extended && (st->u.header.coverage & st->u.header.Variation)) if (!T::Types::extended && (st->u.header.coverage & st->u.header.Variation))
goto skip; goto skip;
if (HB_DIRECTION_IS_HORIZONTAL (c->buffer->props.direction) != st->u.header.is_horizontal ()) if (HB_DIRECTION_IS_HORIZONTAL (c->buffer->props.direction) != st->u.header.is_horizontal ())
goto skip; goto skip;
@ -897,8 +897,8 @@ struct KerxTable
if (!seenCrossStream && if (!seenCrossStream &&
(st->u.header.coverage & st->u.header.CrossStream)) (st->u.header.coverage & st->u.header.CrossStream))
{ {
/* Attach all glyphs into a chain. */ /* Attach all glyphs into a chain. */
seenCrossStream = true; seenCrossStream = true;
hb_glyph_position_t *pos = c->buffer->pos; hb_glyph_position_t *pos = c->buffer->pos;
unsigned int count = c->buffer->len; unsigned int count = c->buffer->len;
for (unsigned int i = 0; i < count; i++) for (unsigned int i = 0; i < count; i++)

View File

@ -226,7 +226,7 @@ struct ContextualSubtable
hb_buffer_t *buffer = driver->buffer; hb_buffer_t *buffer = driver->buffer;
if (buffer->idx == buffer->len && !mark_set) if (buffer->idx == buffer->len && !mark_set)
return false; return false;
return entry.data.markIndex != 0xFFFF || entry.data.currentIndex != 0xFFFF; return entry.data.markIndex != 0xFFFF || entry.data.currentIndex != 0xFFFF;
} }
@ -238,7 +238,7 @@ struct ContextualSubtable
/* Looks like CoreText applies neither mark nor current substitution for /* Looks like CoreText applies neither mark nor current substitution for
* end-of-text if mark was not explicitly set. */ * end-of-text if mark was not explicitly set. */
if (buffer->idx == buffer->len && !mark_set) if (buffer->idx == buffer->len && !mark_set)
return; return;
const GlyphID *replacement; const GlyphID *replacement;
@ -488,7 +488,7 @@ struct LigatureSubtable
unsigned int ligature_idx = 0; unsigned int ligature_idx = 0;
unsigned int action; unsigned int action;
do do
{ {
if (unlikely (!cursor)) if (unlikely (!cursor))
{ {
@ -976,12 +976,12 @@ struct Chain
bool reverse; bool reverse;
if (!(subtable->subFeatureFlags & flags)) if (!(subtable->subFeatureFlags & flags))
goto skip; goto skip;
if (!(subtable->get_coverage() & ChainSubtable<Types>::AllDirections) && if (!(subtable->get_coverage() & ChainSubtable<Types>::AllDirections) &&
HB_DIRECTION_IS_VERTICAL (c->buffer->props.direction) != HB_DIRECTION_IS_VERTICAL (c->buffer->props.direction) !=
bool (subtable->get_coverage() & ChainSubtable<Types>::Vertical)) bool (subtable->get_coverage() & ChainSubtable<Types>::Vertical))
goto skip; goto skip;
/* Buffer contents is always in logical direction. Determine if /* Buffer contents is always in logical direction. Determine if
* we need to reverse before applying this subtable. We reverse * we need to reverse before applying this subtable. We reverse
@ -1016,15 +1016,15 @@ struct Chain
HB_DIRECTION_IS_BACKWARD (c->buffer->props.direction); HB_DIRECTION_IS_BACKWARD (c->buffer->props.direction);
if (!c->buffer->message (c->font, "start chain subtable %d", c->lookup_index)) if (!c->buffer->message (c->font, "start chain subtable %d", c->lookup_index))
goto skip; goto skip;
if (reverse) if (reverse)
c->buffer->reverse (); c->buffer->reverse ();
subtable->apply (c); subtable->apply (c);
if (reverse) if (reverse)
c->buffer->reverse (); c->buffer->reverse ();
(void) c->buffer->message (c->font, "end chain subtable %d", c->lookup_index); (void) c->buffer->message (c->font, "end chain subtable %d", c->lookup_index);

View File

@ -124,7 +124,7 @@ struct TrackData
unsigned int size_index; unsigned int size_index;
for (size_index = 0; size_index < sizes - 1; size_index++) for (size_index = 0; size_index < sizes - 1; size_index++)
if (size_table[size_index].to_float () >= ptem) if (size_table[size_index].to_float () >= ptem)
break; break;
return roundf (interpolate_at (size_index ? size_index - 1 : 0, ptem, return roundf (interpolate_at (size_index ? size_index - 1 : 0, ptem,
*trackTableEntry, base)); *trackTableEntry, base));
@ -176,7 +176,7 @@ struct trak
hb_position_t advance_to_add = c->font->em_scalef_x (tracking); hb_position_t advance_to_add = c->font->em_scalef_x (tracking);
foreach_grapheme (buffer, start, end) foreach_grapheme (buffer, start, end)
{ {
if (!(buffer->info[start].mask & trak_mask)) continue; if (!(buffer->info[start].mask & trak_mask)) continue;
buffer->pos[start].x_advance += advance_to_add; buffer->pos[start].x_advance += advance_to_add;
buffer->pos[start].x_offset += offset_to_add; buffer->pos[start].x_offset += offset_to_add;
} }
@ -189,7 +189,7 @@ struct trak
hb_position_t advance_to_add = c->font->em_scalef_y (tracking); hb_position_t advance_to_add = c->font->em_scalef_y (tracking);
foreach_grapheme (buffer, start, end) foreach_grapheme (buffer, start, end)
{ {
if (!(buffer->info[start].mask & trak_mask)) continue; if (!(buffer->info[start].mask & trak_mask)) continue;
buffer->pos[start].y_advance += advance_to_add; buffer->pos[start].y_advance += advance_to_add;
buffer->pos[start].y_offset += offset_to_add; buffer->pos[start].y_offset += offset_to_add;
} }

View File

@ -281,9 +281,9 @@ struct hb_sorted_array_t :
int mid = ((unsigned int) min + (unsigned int) max) / 2; int mid = ((unsigned int) min + (unsigned int) max) / 2;
int c = array[mid].cmp (x); int c = array[mid].cmp (x);
if (c < 0) if (c < 0)
max = mid - 1; max = mid - 1;
else if (c > 0) else if (c > 0)
min = mid + 1; min = mid + 1;
else else
{ {
if (i) if (i)

View File

@ -592,7 +592,7 @@ fail_without_close:
ceparams.lpSecurityAttributes = nullptr; ceparams.lpSecurityAttributes = nullptr;
ceparams.hTemplateFile = nullptr; ceparams.hTemplateFile = nullptr;
fd = CreateFile2 (wchar_file_name, GENERIC_READ, FILE_SHARE_READ, fd = CreateFile2 (wchar_file_name, GENERIC_READ, FILE_SHARE_READ,
OPEN_EXISTING, &ceparams); OPEN_EXISTING, &ceparams);
} }
#else #else
fd = CreateFileW (wchar_file_name, GENERIC_READ, FILE_SHARE_READ, nullptr, fd = CreateFileW (wchar_file_name, GENERIC_READ, FILE_SHARE_READ, nullptr,
@ -669,7 +669,7 @@ fail_without_close:
} }
return hb_blob_create (data, len, HB_MEMORY_MODE_WRITABLE, data, return hb_blob_create (data, len, HB_MEMORY_MODE_WRITABLE, data,
(hb_destroy_func_t) free); (hb_destroy_func_t) free);
fread_fail: fread_fail:
fclose (fp); fclose (fp);

View File

@ -135,7 +135,7 @@ _hb_buffer_serialize_glyphs_json (hb_buffer_t *buffer,
hb_font_glyph_to_string (font, info[i].codepoint, g, sizeof (g)); hb_font_glyph_to_string (font, info[i].codepoint, g, sizeof (g));
*p++ = '"'; *p++ = '"';
for (char *q = g; *q; q++) { for (char *q = g; *q; q++) {
if (*q == '"') if (*q == '"')
*p++ = '\\'; *p++ = '\\';
*p++ = *q; *p++ = *q;
} }

View File

@ -648,8 +648,8 @@ hb_buffer_t::guess_segment_properties ()
if (likely (script != HB_SCRIPT_COMMON && if (likely (script != HB_SCRIPT_COMMON &&
script != HB_SCRIPT_INHERITED && script != HB_SCRIPT_INHERITED &&
script != HB_SCRIPT_UNKNOWN)) { script != HB_SCRIPT_UNKNOWN)) {
props.script = script; props.script = script;
break; break;
} }
} }
} }
@ -1388,7 +1388,7 @@ hb_buffer_get_length (hb_buffer_t *buffer)
**/ **/
hb_glyph_info_t * hb_glyph_info_t *
hb_buffer_get_glyph_infos (hb_buffer_t *buffer, hb_buffer_get_glyph_infos (hb_buffer_t *buffer,
unsigned int *length) unsigned int *length)
{ {
if (length) if (length)
*length = buffer->len; *length = buffer->len;
@ -1412,7 +1412,7 @@ hb_buffer_get_glyph_infos (hb_buffer_t *buffer,
**/ **/
hb_glyph_position_t * hb_glyph_position_t *
hb_buffer_get_glyph_positions (hb_buffer_t *buffer, hb_buffer_get_glyph_positions (hb_buffer_t *buffer,
unsigned int *length) unsigned int *length)
{ {
if (!buffer->have_positions) if (!buffer->have_positions)
buffer->clear_positions (); buffer->clear_positions ();
@ -1936,9 +1936,9 @@ hb_buffer_diff (hb_buffer_t *buffer,
for (i = 0; i < count; i++) for (i = 0; i < count; i++)
{ {
if (contains && info[i].codepoint == dottedcircle_glyph) if (contains && info[i].codepoint == dottedcircle_glyph)
result |= HB_BUFFER_DIFF_FLAG_DOTTED_CIRCLE_PRESENT; result |= HB_BUFFER_DIFF_FLAG_DOTTED_CIRCLE_PRESENT;
if (contains && info[i].codepoint == 0) if (contains && info[i].codepoint == 0)
result |= HB_BUFFER_DIFF_FLAG_NOTDEF_PRESENT; result |= HB_BUFFER_DIFF_FLAG_NOTDEF_PRESENT;
} }
result |= HB_BUFFER_DIFF_FLAG_LENGTH_MISMATCH; result |= HB_BUFFER_DIFF_FLAG_LENGTH_MISMATCH;
return hb_buffer_diff_flags_t (result); return hb_buffer_diff_flags_t (result);
@ -1973,12 +1973,12 @@ hb_buffer_diff (hb_buffer_t *buffer,
for (unsigned int i = 0; i < count; i++) for (unsigned int i = 0; i < count; i++)
{ {
if ((unsigned int) abs (buf_pos->x_advance - ref_pos->x_advance) > position_fuzz || if ((unsigned int) abs (buf_pos->x_advance - ref_pos->x_advance) > position_fuzz ||
(unsigned int) abs (buf_pos->y_advance - ref_pos->y_advance) > position_fuzz || (unsigned int) abs (buf_pos->y_advance - ref_pos->y_advance) > position_fuzz ||
(unsigned int) abs (buf_pos->x_offset - ref_pos->x_offset) > position_fuzz || (unsigned int) abs (buf_pos->x_offset - ref_pos->x_offset) > position_fuzz ||
(unsigned int) abs (buf_pos->y_offset - ref_pos->y_offset) > position_fuzz) (unsigned int) abs (buf_pos->y_offset - ref_pos->y_offset) > position_fuzz)
{ {
result |= HB_BUFFER_DIFF_FLAG_POSITION_MISMATCH; result |= HB_BUFFER_DIFF_FLAG_POSITION_MISMATCH;
break; break;
} }
buf_pos++; buf_pos++;
ref_pos++; ref_pos++;

View File

@ -441,11 +441,11 @@ hb_buffer_get_length (hb_buffer_t *buffer);
HB_EXTERN hb_glyph_info_t * HB_EXTERN hb_glyph_info_t *
hb_buffer_get_glyph_infos (hb_buffer_t *buffer, hb_buffer_get_glyph_infos (hb_buffer_t *buffer,
unsigned int *length); unsigned int *length);
HB_EXTERN hb_glyph_position_t * HB_EXTERN hb_glyph_position_t *
hb_buffer_get_glyph_positions (hb_buffer_t *buffer, hb_buffer_get_glyph_positions (hb_buffer_t *buffer,
unsigned int *length); unsigned int *length);
HB_EXTERN void HB_EXTERN void

View File

@ -67,7 +67,7 @@ _hb_options_init ()
{ {
const char *p = strchr (c, ':'); const char *p = strchr (c, ':');
if (!p) if (!p)
p = c + strlen (c); p = c + strlen (c);
#define OPTION(name, symbol) \ #define OPTION(name, symbol) \
if (0 == strncmp (c, name, p - c) && strlen (name) == static_cast<size_t>(p - c)) do { u.opts.symbol = true; } while (0) if (0 == strncmp (c, name, p - c) && strlen (name) == static_cast<size_t>(p - c)) do { u.opts.symbol = true; } while (0)
@ -956,7 +956,7 @@ parse_feature_value_postfix (const char **pp, const char *end, hb_feature_t *fea
{ {
bool had_equal = parse_char (pp, end, '='); bool had_equal = parse_char (pp, end, '=');
bool had_value = parse_uint32 (pp, end, &feature->value) || bool had_value = parse_uint32 (pp, end, &feature->value) ||
parse_bool (pp, end, &feature->value); parse_bool (pp, end, &feature->value);
/* CSS doesn't use equal-sign between tag and value. /* CSS doesn't use equal-sign between tag and value.
* If there was an equal-sign, then there *must* be a value. * If there was an equal-sign, then there *must* be a value.
* A value without an equal-sign is ok, but not required. */ * A value without an equal-sign is ok, but not required. */

View File

@ -111,7 +111,7 @@ static void
release_data (void *info, const void *data, size_t size) release_data (void *info, const void *data, size_t size)
{ {
assert (hb_blob_get_length ((hb_blob_t *) info) == size && assert (hb_blob_get_length ((hb_blob_t *) info) == size &&
hb_blob_get_data ((hb_blob_t *) info, nullptr) == data); hb_blob_get_data ((hb_blob_t *) info, nullptr) == data);
hb_blob_destroy ((hb_blob_t *) info); hb_blob_destroy ((hb_blob_t *) info);
} }
@ -233,21 +233,21 @@ create_ct_font (CGFontRef cg_font, CGFloat font_size)
atsFont = CTFontGetPlatformFont (new_ct_font, NULL); atsFont = CTFontGetPlatformFont (new_ct_font, NULL);
status = ATSFontGetFileReference (atsFont, &fsref); status = ATSFontGetFileReference (atsFont, &fsref);
if (status == noErr) if (status == noErr)
new_url = CFURLCreateFromFSRef (NULL, &fsref); new_url = CFURLCreateFromFSRef (NULL, &fsref);
#else #else
new_url = (CFURLRef) CTFontCopyAttribute (new_ct_font, kCTFontURLAttribute); new_url = (CFURLRef) CTFontCopyAttribute (new_ct_font, kCTFontURLAttribute);
#endif #endif
// Keep reconfigured font if URL cannot be retrieved (seems to be the case // Keep reconfigured font if URL cannot be retrieved (seems to be the case
// on Mac OS 10.12 Sierra), speculative fix for crbug.com/625606 // on Mac OS 10.12 Sierra), speculative fix for crbug.com/625606
if (!original_url || !new_url || CFEqual (original_url, new_url)) { if (!original_url || !new_url || CFEqual (original_url, new_url)) {
CFRelease (ct_font); CFRelease (ct_font);
ct_font = new_ct_font; ct_font = new_ct_font;
} else { } else {
CFRelease (new_ct_font); CFRelease (new_ct_font);
DEBUG_MSG (CORETEXT, ct_font, "Discarding reconfigured CTFont, location changed."); DEBUG_MSG (CORETEXT, ct_font, "Discarding reconfigured CTFont, location changed.");
} }
if (new_url) if (new_url)
CFRelease (new_url); CFRelease (new_url);
} }
else else
DEBUG_MSG (CORETEXT, ct_font, "Font copy with empty cascade list failed"); DEBUG_MSG (CORETEXT, ct_font, "Font copy with empty cascade list failed");
@ -433,9 +433,9 @@ struct range_record_t {
hb_bool_t hb_bool_t
_hb_coretext_shape (hb_shape_plan_t *shape_plan, _hb_coretext_shape (hb_shape_plan_t *shape_plan,
hb_font_t *font, hb_font_t *font,
hb_buffer_t *buffer, hb_buffer_t *buffer,
const hb_feature_t *features, const hb_feature_t *features,
unsigned int num_features) unsigned int num_features)
{ {
hb_face_t *face = font->face; hb_face_t *face = font->face;
CGFontRef cg_font = (CGFontRef) (const void *) face->data.coretext; CGFontRef cg_font = (CGFontRef) (const void *) face->data.coretext;
@ -477,7 +477,7 @@ _hb_coretext_shape (hb_shape_plan_t *shape_plan,
{ {
const hb_aat_feature_mapping_t * mapping = hb_aat_layout_find_feature_mapping (features[i].tag); const hb_aat_feature_mapping_t * mapping = hb_aat_layout_find_feature_mapping (features[i].tag);
if (!mapping) if (!mapping)
continue; continue;
active_feature_t feature; active_feature_t feature;
feature.rec.feature = mapping->aatFeatureType; feature.rec.feature = mapping->aatFeatureType;
@ -519,7 +519,7 @@ _hb_coretext_shape (hb_shape_plan_t *shape_plan,
if (event->index != last_index) if (event->index != last_index)
{ {
/* Save a snapshot of active features and the range. */ /* Save a snapshot of active features and the range. */
range_record_t *range = range_records.push (); range_record_t *range = range_records.push ();
if (active_features.length) if (active_features.length)
@ -580,9 +580,9 @@ _hb_coretext_shape (hb_shape_plan_t *shape_plan,
if (event->start) if (event->start)
{ {
active_features.push (event->feature); active_features.push (event->feature);
} else { } else {
active_feature_t *feature = active_features.find (&event->feature); active_feature_t *feature = active_features.find (&event->feature);
if (feature) if (feature)
active_features.remove (feature - active_features.arrayZ); active_features.remove (feature - active_features.arrayZ);
} }
@ -700,15 +700,15 @@ resize_and_retry:
#if !(defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE) && MAC_OS_X_VERSION_MIN_REQUIRED < 1090 #if !(defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE) && MAC_OS_X_VERSION_MIN_REQUIRED < 1090
# define kCTLanguageAttributeName CFSTR ("NSLanguage") # define kCTLanguageAttributeName CFSTR ("NSLanguage")
#endif #endif
CFStringRef lang = CFStringCreateWithCStringNoCopy (kCFAllocatorDefault, CFStringRef lang = CFStringCreateWithCStringNoCopy (kCFAllocatorDefault,
hb_language_to_string (buffer->props.language), hb_language_to_string (buffer->props.language),
kCFStringEncodingUTF8, kCFStringEncodingUTF8,
kCFAllocatorNull); kCFAllocatorNull);
if (unlikely (!lang)) if (unlikely (!lang))
{ {
CFRelease (attr_string); CFRelease (attr_string);
FAIL ("CFStringCreateWithCStringNoCopy failed"); FAIL ("CFStringCreateWithCStringNoCopy failed");
} }
CFAttributedStringSetAttribute (attr_string, CFRangeMake (0, chars_len), CFAttributedStringSetAttribute (attr_string, CFRangeMake (0, chars_len),
kCTLanguageAttributeName, lang); kCTLanguageAttributeName, lang);
CFRelease (lang); CFRelease (lang);
@ -757,7 +757,7 @@ resize_and_retry:
feature.start < chars_len && feature.start < feature.end) feature.start < chars_len && feature.start < feature.end)
{ {
CFRange feature_range = CFRangeMake (feature.start, CFRange feature_range = CFRangeMake (feature.start,
hb_min (feature.end, chars_len) - feature.start); hb_min (feature.end, chars_len) - feature.start);
if (feature.value) if (feature.value)
CFAttributedStringRemoveAttribute (attr_string, feature_range, kCTKernAttributeName); CFAttributedStringRemoveAttribute (attr_string, feature_range, kCTKernAttributeName);
else else
@ -781,8 +781,8 @@ resize_and_retry:
CFRelease (level_number); CFRelease (level_number);
if (unlikely (!options)) if (unlikely (!options))
{ {
CFRelease (attr_string); CFRelease (attr_string);
FAIL ("CFDictionaryCreate failed"); FAIL ("CFDictionaryCreate failed");
} }
CTTypesetterRef typesetter = CTTypesetterCreateWithAttributedStringAndOptions (attr_string, options); CTTypesetterRef typesetter = CTTypesetterCreateWithAttributedStringAndOptions (attr_string, options);
@ -893,7 +893,7 @@ resize_and_retry:
if (!matched) if (!matched)
{ {
CFRange range = CTRunGetStringRange (run); CFRange range = CTRunGetStringRange (run);
DEBUG_MSG (CORETEXT, run, "Run used fallback font: %ld..%ld", DEBUG_MSG (CORETEXT, run, "Run used fallback font: %ld..%ld",
range.location, range.location + range.length); range.location, range.location + range.length);
if (!buffer->ensure_inplace (buffer->len + range.length)) if (!buffer->ensure_inplace (buffer->len + range.length))
goto resize_and_retry; goto resize_and_retry;
@ -921,7 +921,7 @@ resize_and_retry:
continue; continue;
} }
if (buffer->unicode->is_default_ignorable (ch)) if (buffer->unicode->is_default_ignorable (ch))
continue; continue;
info->codepoint = notdef; info->codepoint = notdef;
info->cluster = log_clusters[j]; info->cluster = log_clusters[j];
@ -966,7 +966,7 @@ resize_and_retry:
scratch = scratch_saved scratch = scratch_saved
{ /* Setup glyphs */ { /* Setup glyphs */
SCRATCH_SAVE(); SCRATCH_SAVE();
const CGGlyph* glyphs = USE_PTR ? CTRunGetGlyphsPtr (run) : nullptr; const CGGlyph* glyphs = USE_PTR ? CTRunGetGlyphsPtr (run) : nullptr;
if (!glyphs) { if (!glyphs) {
ALLOCATE_ARRAY (CGGlyph, glyph_buf, num_glyphs, goto resize_and_retry); ALLOCATE_ARRAY (CGGlyph, glyph_buf, num_glyphs, goto resize_and_retry);
@ -989,12 +989,12 @@ resize_and_retry:
SCRATCH_RESTORE(); SCRATCH_RESTORE();
} }
{ {
/* Setup positions. /* Setup positions.
* Note that CoreText does not return advances for glyphs. As such, * Note that CoreText does not return advances for glyphs. As such,
* for all but last glyph, we use the delta position to next glyph as * for all but last glyph, we use the delta position to next glyph as
* advance (in the advance direction only), and for last glyph we set * advance (in the advance direction only), and for last glyph we set
* whatever is needed to make the whole run's advance add up. */ * whatever is needed to make the whole run's advance add up. */
SCRATCH_SAVE(); SCRATCH_SAVE();
const CGPoint* positions = USE_PTR ? CTRunGetPositionsPtr (run) : nullptr; const CGPoint* positions = USE_PTR ? CTRunGetPositionsPtr (run) : nullptr;
if (!positions) { if (!positions) {
ALLOCATE_ARRAY (CGPoint, position_buf, num_glyphs, goto resize_and_retry); ALLOCATE_ARRAY (CGPoint, position_buf, num_glyphs, goto resize_and_retry);

View File

@ -41,7 +41,7 @@ struct hb_dispatch_context_t
private: private:
/* https://en.wikipedia.org/wiki/Curiously_recurring_template_pattern */ /* https://en.wikipedia.org/wiki/Curiously_recurring_template_pattern */
const Context* thiz () const { return static_cast<const Context *> (this); } const Context* thiz () const { return static_cast<const Context *> (this); }
Context* thiz () { return static_cast< Context *> (this); } Context* thiz () { return static_cast< Context *> (this); }
public: public:
static constexpr unsigned max_debug_depth = MaxDebugDepth; static constexpr unsigned max_debug_depth = MaxDebugDepth;
typedef Return return_t; typedef Return return_t;

View File

@ -667,22 +667,22 @@ hb_font_funcs_is_immutable (hb_font_funcs_t *ffuncs)
#define HB_FONT_FUNC_IMPLEMENT(name) \ #define HB_FONT_FUNC_IMPLEMENT(name) \
\ \
void \ void \
hb_font_funcs_set_##name##_func (hb_font_funcs_t *ffuncs, \ hb_font_funcs_set_##name##_func (hb_font_funcs_t *ffuncs, \
hb_font_get_##name##_func_t func, \ hb_font_get_##name##_func_t func, \
void *user_data, \ void *user_data, \
hb_destroy_func_t destroy) \ hb_destroy_func_t destroy) \
{ \ { \
if (hb_object_is_immutable (ffuncs)) { \ if (hb_object_is_immutable (ffuncs)) { \
if (destroy) \ if (destroy) \
destroy (user_data); \ destroy (user_data); \
return; \ return; \
} \ } \
\ \
if (ffuncs->destroy.name) \ if (ffuncs->destroy.name) \
ffuncs->destroy.name (ffuncs->user_data.name); \ ffuncs->destroy.name (ffuncs->user_data.name); \
\ \
if (func) { \ if (func) { \
ffuncs->get.f.name = func; \ ffuncs->get.f.name = func; \
ffuncs->user_data.name = user_data; \ ffuncs->user_data.name = user_data; \
@ -1676,8 +1676,8 @@ hb_font_set_funcs (hb_font_t *font,
**/ **/
void void
hb_font_set_funcs_data (hb_font_t *font, hb_font_set_funcs_data (hb_font_t *font,
void *font_data, void *font_data,
hb_destroy_func_t destroy) hb_destroy_func_t destroy)
{ {
/* Destroy user_data? */ /* Destroy user_data? */
if (hb_object_is_immutable (font)) if (hb_object_is_immutable (font))

View File

@ -471,7 +471,7 @@ hb_ft_get_glyph_from_name (hb_font_t *font HB_UNUSED,
/* Check whether the given name was actually the name of glyph 0. */ /* Check whether the given name was actually the name of glyph 0. */
char buf[128]; char buf[128];
if (!FT_Get_Glyph_Name(ft_face, 0, buf, sizeof (buf)) && if (!FT_Get_Glyph_Name(ft_face, 0, buf, sizeof (buf)) &&
len < 0 ? !strcmp (buf, name) : !strncmp (buf, name, len)) len < 0 ? !strcmp (buf, name) : !strncmp (buf, name, len))
return true; return true;
} }

View File

@ -340,14 +340,14 @@ _hb_graphite2_shape (hb_shape_plan_t *shape_plan HB_UNUSED,
c->num_glyphs = 0; c->num_glyphs = 0;
if (HB_DIRECTION_IS_BACKWARD(buffer->props.direction)) if (HB_DIRECTION_IS_BACKWARD(buffer->props.direction))
{ {
c->advance = curradv - gr_slot_origin_X(is) * xscale; c->advance = curradv - gr_slot_origin_X(is) * xscale;
curradv -= c->advance; curradv -= c->advance;
} }
else else
{ {
c->advance = 0; c->advance = 0;
clusters[ci].advance += gr_slot_origin_X(is) * xscale - curradv; clusters[ci].advance += gr_slot_origin_X(is) * xscale - curradv;
curradv += clusters[ci].advance; curradv += clusters[ci].advance;
} }
ci++; ci++;
} }

View File

@ -72,7 +72,7 @@ struct hb_iter_t
private: private:
/* https://en.wikipedia.org/wiki/Curiously_recurring_template_pattern */ /* https://en.wikipedia.org/wiki/Curiously_recurring_template_pattern */
const iter_t* thiz () const { return static_cast<const iter_t *> (this); } const iter_t* thiz () const { return static_cast<const iter_t *> (this); }
iter_t* thiz () { return static_cast< iter_t *> (this); } iter_t* thiz () { return static_cast< iter_t *> (this); }
public: public:
/* TODO: /* TODO:
@ -183,7 +183,7 @@ struct hb_iter_fallback_mixin_t
private: private:
/* https://en.wikipedia.org/wiki/Curiously_recurring_template_pattern */ /* https://en.wikipedia.org/wiki/Curiously_recurring_template_pattern */
const iter_t* thiz () const { return static_cast<const iter_t *> (this); } const iter_t* thiz () const { return static_cast<const iter_t *> (this); }
iter_t* thiz () { return static_cast< iter_t *> (this); } iter_t* thiz () { return static_cast< iter_t *> (this); }
public: public:
/* Access: Implement __item__(), or __item_at__() if random-access. */ /* Access: Implement __item__(), or __item_at__() if random-access. */

View File

@ -82,11 +82,11 @@ struct hb_kern_machine_t
if (likely (!kern)) if (likely (!kern))
goto skip; goto skip;
if (horizontal) if (horizontal)
{ {
if (scale) if (scale)
kern = font->em_scale_x (kern); kern = font->em_scale_x (kern);
if (crossStream) if (crossStream)
{ {
@ -104,7 +104,7 @@ struct hb_kern_machine_t
} }
else else
{ {
if (scale) if (scale)
kern = font->em_scale_y (kern); kern = font->em_scale_y (kern);
if (crossStream) if (crossStream)
{ {

View File

@ -225,7 +225,7 @@ struct hb_lazy_loader_t : hb_data_wrapper_t<Data, WheresData>
if (unlikely (!cmpexch (nullptr, p))) if (unlikely (!cmpexch (nullptr, p)))
{ {
do_destroy (p); do_destroy (p);
goto retry; goto retry;
} }
} }

View File

@ -62,7 +62,7 @@ struct hb_lockable_set_t
old.fini (); old.fini ();
} }
else { else {
item = nullptr; item = nullptr;
l.unlock (); l.unlock ();
} }
} else { } else {

View File

@ -92,9 +92,9 @@ typedef struct OffsetTable
if (table_count) if (table_count)
{ {
if (start_offset >= tables.len) if (start_offset >= tables.len)
*table_count = 0; *table_count = 0;
else else
*table_count = hb_min (*table_count, tables.len - start_offset); *table_count = hb_min (*table_count, tables.len - start_offset);
const TableRecord *sub_tables = tables.arrayZ + start_offset; const TableRecord *sub_tables = tables.arrayZ + start_offset;
unsigned int count = *table_count; unsigned int count = *table_count;

View File

@ -944,7 +944,7 @@ struct VarSizedBinSearchArrayOf
unsigned int count = Type::TerminationWordCount; unsigned int count = Type::TerminationWordCount;
for (unsigned int i = 0; i < count; i++) for (unsigned int i = 0; i < count; i++)
if (words[i] != 0xFFFFu) if (words[i] != 0xFFFFu)
return false; return false;
return true; return true;
} }

View File

@ -76,24 +76,24 @@ struct CmapSubtableFormat4
{ {
template<typename Iterator, template<typename Iterator,
hb_requires (hb_is_iterator (Iterator))> hb_requires (hb_is_iterator (Iterator))>
HBUINT16* serialize_endcode_array (hb_serialize_context_t *c, HBUINT16* serialize_endcode_array (hb_serialize_context_t *c,
Iterator it) Iterator it)
{ {
HBUINT16 *endCode = c->start_embed<HBUINT16> (); HBUINT16 *endCode = c->start_embed<HBUINT16> ();
hb_codepoint_t prev_endcp = 0xFFFF; hb_codepoint_t prev_endcp = 0xFFFF;
+ it + it
| hb_apply ([&] (const hb_item_type<Iterator> _) | hb_apply ([&] (const hb_item_type<Iterator> _)
{ {
if (prev_endcp != 0xFFFF && prev_endcp + 1u != _.first) if (prev_endcp != 0xFFFF && prev_endcp + 1u != _.first)
{ {
HBUINT16 end_code; HBUINT16 end_code;
end_code = prev_endcp; end_code = prev_endcp;
c->copy<HBUINT16> (end_code); c->copy<HBUINT16> (end_code);
} }
prev_endcp = _.first; prev_endcp = _.first;
}) })
; ;
{ {
@ -104,9 +104,9 @@ struct CmapSubtableFormat4
// There must be a final entry with end_code == 0xFFFF. // There must be a final entry with end_code == 0xFFFF.
if (prev_endcp != 0xFFFF) if (prev_endcp != 0xFFFF)
{ {
HBUINT16 finalcode; HBUINT16 finalcode;
finalcode = 0xFFFF; finalcode = 0xFFFF;
if (unlikely (!c->copy<HBUINT16> (finalcode))) return nullptr; if (unlikely (!c->copy<HBUINT16> (finalcode))) return nullptr;
} }
} }
@ -114,25 +114,25 @@ struct CmapSubtableFormat4
} }
template<typename Iterator, template<typename Iterator,
hb_requires (hb_is_iterator (Iterator))> hb_requires (hb_is_iterator (Iterator))>
HBUINT16* serialize_startcode_array (hb_serialize_context_t *c, HBUINT16* serialize_startcode_array (hb_serialize_context_t *c,
Iterator it) Iterator it)
{ {
HBUINT16 *startCode = c->start_embed<HBUINT16> (); HBUINT16 *startCode = c->start_embed<HBUINT16> ();
hb_codepoint_t prev_cp = 0xFFFF; hb_codepoint_t prev_cp = 0xFFFF;
+ it + it
| hb_apply ([&] (const hb_item_type<Iterator> _) | hb_apply ([&] (const hb_item_type<Iterator> _)
{ {
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;
}) })
; ;
// There must be a final entry with end_code == 0xFFFF. // There must be a final entry with end_code == 0xFFFF.
@ -147,44 +147,44 @@ struct CmapSubtableFormat4
} }
template<typename Iterator, template<typename Iterator,
hb_requires (hb_is_iterator (Iterator))> hb_requires (hb_is_iterator (Iterator))>
HBINT16* serialize_idDelta_array (hb_serialize_context_t *c, HBINT16* serialize_idDelta_array (hb_serialize_context_t *c,
Iterator it, Iterator it,
HBUINT16 *endCode, HBUINT16 *endCode,
HBUINT16 *startCode, HBUINT16 *startCode,
unsigned segcount) unsigned segcount)
{ {
unsigned i = 0; unsigned i = 0;
hb_codepoint_t last_gid = 0, start_gid = 0, last_cp = 0xFFFF; hb_codepoint_t last_gid = 0, start_gid = 0, last_cp = 0xFFFF;
bool use_delta = true; bool use_delta = true;
HBINT16 *idDelta = c->start_embed<HBINT16> (); HBINT16 *idDelta = c->start_embed<HBINT16> ();
if ((char *)idDelta - (char *)startCode != (int) segcount * (int) HBINT16::static_size) if ((char *)idDelta - (char *)startCode != (int) segcount * (int) HBINT16::static_size)
return nullptr; return nullptr;
+ it + it
| hb_apply ([&] (const hb_item_type<Iterator> _) | hb_apply ([&] (const hb_item_type<Iterator> _)
{ {
if (_.first == startCode[i]) if (_.first == startCode[i])
{ {
use_delta = true; use_delta = true;
start_gid = _.second; start_gid = _.second;
} }
else if (_.second != last_gid + 1) use_delta = false; else if (_.second != last_gid + 1) use_delta = false;
if (_.first == endCode[i]) if (_.first == endCode[i])
{ {
HBINT16 delta; HBINT16 delta;
if (use_delta) delta = (int)start_gid - (int)startCode[i]; if (use_delta) delta = (int)start_gid - (int)startCode[i];
else delta = 0; else delta = 0;
c->copy<HBINT16> (delta); c->copy<HBINT16> (delta);
i++; i++;
} }
last_gid = _.second; last_gid = _.second;
last_cp = _.first; last_cp = _.first;
}) })
; ;
if (it.len () == 0 || last_cp != 0xFFFF) if (it.len () == 0 || last_cp != 0xFFFF)
@ -198,43 +198,43 @@ struct CmapSubtableFormat4
} }
template<typename Iterator, template<typename Iterator,
hb_requires (hb_is_iterator (Iterator))> hb_requires (hb_is_iterator (Iterator))>
HBUINT16* serialize_rangeoffset_glyid (hb_serialize_context_t *c, HBUINT16* serialize_rangeoffset_glyid (hb_serialize_context_t *c,
Iterator it, Iterator it,
HBUINT16 *endCode, HBUINT16 *endCode,
HBUINT16 *startCode, HBUINT16 *startCode,
HBINT16 *idDelta, HBINT16 *idDelta,
unsigned segcount) unsigned segcount)
{ {
HBUINT16 *idRangeOffset = c->allocate_size<HBUINT16> (HBUINT16::static_size * segcount); HBUINT16 *idRangeOffset = c->allocate_size<HBUINT16> (HBUINT16::static_size * segcount);
if (unlikely (!c->check_success (idRangeOffset))) return nullptr; if (unlikely (!c->check_success (idRangeOffset))) return nullptr;
if (unlikely ((char *)idRangeOffset - (char *)idDelta != (int) segcount * (int) HBINT16::static_size)) return nullptr; if (unlikely ((char *)idRangeOffset - (char *)idDelta != (int) segcount * (int) HBINT16::static_size)) return nullptr;
+ hb_range (segcount) + hb_range (segcount)
| hb_filter ([&] (const unsigned _) { return idDelta[_] == 0; }) | hb_filter ([&] (const unsigned _) { return idDelta[_] == 0; })
| hb_apply ([&] (const unsigned i) | hb_apply ([&] (const unsigned i)
{ {
idRangeOffset[i] = 2 * (c->start_embed<HBUINT16> () - idRangeOffset - i); idRangeOffset[i] = 2 * (c->start_embed<HBUINT16> () - idRangeOffset - i);
+ it + it
| hb_filter ([&] (const hb_item_type<Iterator> _) { return _.first >= startCode[i] && _.first <= endCode[i]; }) | hb_filter ([&] (const hb_item_type<Iterator> _) { return _.first >= startCode[i] && _.first <= endCode[i]; })
| hb_apply ([&] (const hb_item_type<Iterator> _) | hb_apply ([&] (const hb_item_type<Iterator> _)
{ {
HBUINT16 glyID; HBUINT16 glyID;
glyID = _.second; glyID = _.second;
c->copy<HBUINT16> (glyID); c->copy<HBUINT16> (glyID);
}) })
; ;
}) })
; ;
return idRangeOffset; return idRangeOffset;
} }
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,
Iterator it) Iterator it)
{ {
@ -247,21 +247,21 @@ struct CmapSubtableFormat4
if (unlikely (!endCode)) return; if (unlikely (!endCode)) return;
unsigned segcount = (c->length () - min_size) / HBUINT16::static_size; unsigned segcount = (c->length () - min_size) / HBUINT16::static_size;
// 2 bytes of padding. // 2 bytes of padding.
if (unlikely (!c->allocate_size<HBUINT16> (HBUINT16::static_size))) return; // 2 bytes of padding. if (unlikely (!c->allocate_size<HBUINT16> (HBUINT16::static_size))) return; // 2 bytes of padding.
// serialize startCode[] // serialize startCode[]
HBUINT16 *startCode = serialize_startcode_array (c, it); HBUINT16 *startCode = serialize_startcode_array (c, it);
if (unlikely (!startCode)) return; if (unlikely (!startCode)) return;
//serialize idDelta[] //serialize idDelta[]
HBINT16 *idDelta = serialize_idDelta_array (c, it, endCode, startCode, segcount); HBINT16 *idDelta = serialize_idDelta_array (c, it, endCode, startCode, segcount);
if (unlikely (!idDelta)) return; if (unlikely (!idDelta)) return;
HBUINT16 *idRangeOffset = serialize_rangeoffset_glyid (c, it, endCode, startCode, idDelta, segcount); HBUINT16 *idRangeOffset = serialize_rangeoffset_glyid (c, it, endCode, startCode, idDelta, segcount);
if (unlikely (!c->check_success (idRangeOffset))) return; if (unlikely (!c->check_success (idRangeOffset))) return;
if (unlikely (!c->check_assign(this->length, c->length () - table_initpos))) return; if (unlikely (!c->check_assign(this->length, c->length () - table_initpos))) return;
this->segCountX2 = segcount * 2; this->segCountX2 = segcount * 2;
this->entrySelector = hb_max (1u, hb_bit_storage (segcount)) - 1; this->entrySelector = hb_max (1u, hb_bit_storage (segcount)) - 1;
@ -557,7 +557,7 @@ struct CmapSubtableFormat12 : CmapSubtableLongSegmented<CmapSubtableFormat12>
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,
Iterator it) Iterator it)
{ {
@ -570,30 +570,30 @@ struct CmapSubtableFormat12 : CmapSubtableLongSegmented<CmapSubtableFormat12>
+ it + it
| hb_apply ([&] (const hb_item_type<Iterator> _) | hb_apply ([&] (const hb_item_type<Iterator> _)
{ {
if (startCharCode == 0xFFFF) if (startCharCode == 0xFFFF)
{ {
startCharCode = _.first; startCharCode = _.first;
endCharCode = _.first; endCharCode = _.first;
glyphID = _.second; glyphID = _.second;
} }
else if (!_is_gid_consecutive (endCharCode, startCharCode, glyphID, _.first, _.second)) else if (!_is_gid_consecutive (endCharCode, startCharCode, glyphID, _.first, _.second))
{ {
CmapSubtableLongGroup grouprecord; CmapSubtableLongGroup grouprecord;
grouprecord.startCharCode = startCharCode; grouprecord.startCharCode = startCharCode;
grouprecord.endCharCode = endCharCode; grouprecord.endCharCode = endCharCode;
grouprecord.glyphID = glyphID; grouprecord.glyphID = glyphID;
c->copy<CmapSubtableLongGroup> (grouprecord); c->copy<CmapSubtableLongGroup> (grouprecord);
startCharCode = _.first; startCharCode = _.first;
endCharCode = _.first; endCharCode = _.first;
glyphID = _.second; glyphID = _.second;
} }
else else
{ {
endCharCode = _.first; endCharCode = _.first;
} }
}) })
; ;
CmapSubtableLongGroup record; CmapSubtableLongGroup record;
@ -615,8 +615,8 @@ struct CmapSubtableFormat12 : CmapSubtableLongSegmented<CmapSubtableFormat12>
private: private:
static bool _is_gid_consecutive (hb_codepoint_t endCharCode, static bool _is_gid_consecutive (hb_codepoint_t endCharCode,
hb_codepoint_t startCharCode, hb_codepoint_t startCharCode,
hb_codepoint_t glyphID, hb_codepoint_t glyphID,
hb_codepoint_t cp, hb_codepoint_t cp,
hb_codepoint_t new_gid) hb_codepoint_t new_gid)
{ {
@ -828,10 +828,10 @@ struct CmapSubtable
} }
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,
Iterator it, Iterator it,
unsigned format) unsigned format)
{ {
switch (format) { switch (format) {
case 4: u.format4.serialize (c, it); return; case 4: u.format4.serialize (c, it); return;
@ -892,12 +892,12 @@ struct EncodingRecord
} }
template<typename Iterator, template<typename Iterator,
hb_requires (hb_is_iterator (Iterator))> hb_requires (hb_is_iterator (Iterator))>
EncodingRecord* copy (hb_serialize_context_t *c, EncodingRecord* copy (hb_serialize_context_t *c,
Iterator it, Iterator it,
unsigned format, unsigned format,
void *base, void *base,
/* INOUT */ unsigned *objidx) const /* INOUT */ unsigned *objidx) const
{ {
TRACE_SERIALIZE (this); TRACE_SERIALIZE (this);
auto *out = c->embed (this); auto *out = c->embed (this);
@ -930,13 +930,13 @@ struct cmap
static constexpr hb_tag_t tableTag = HB_OT_TAG_cmap; static constexpr hb_tag_t tableTag = HB_OT_TAG_cmap;
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,
Iterator it, Iterator it,
const EncodingRecord *unicode_bmp, const EncodingRecord *unicode_bmp,
const EncodingRecord *unicode_ucs4, const EncodingRecord *unicode_ucs4,
const EncodingRecord *ms_bmp, const EncodingRecord *ms_bmp,
const EncodingRecord *ms_ucs4) const EncodingRecord *ms_ucs4)
{ {
if (unlikely (!c->extend_min ((*this)))) return; if (unlikely (!c->extend_min ((*this)))) return;
this->version = 0; this->version = 0;
@ -972,15 +972,15 @@ struct cmap
auto it = auto it =
+ hb_iter (c->plan->unicodes) + hb_iter (c->plan->unicodes)
| hb_map ([&] (hb_codepoint_t _) | hb_map ([&] (hb_codepoint_t _)
{ {
hb_codepoint_t new_gid = HB_MAP_VALUE_INVALID; hb_codepoint_t new_gid = HB_MAP_VALUE_INVALID;
c->plan->new_gid_for_codepoint (_, &new_gid); c->plan->new_gid_for_codepoint (_, &new_gid);
return hb_pair_t<hb_codepoint_t, hb_codepoint_t> (_, new_gid); return hb_pair_t<hb_codepoint_t, hb_codepoint_t> (_, new_gid);
}) })
| hb_filter ([&] (const hb_pair_t<hb_codepoint_t, hb_codepoint_t> _) | hb_filter ([&] (const hb_pair_t<hb_codepoint_t, hb_codepoint_t> _)
{ {
return (_.second != HB_MAP_VALUE_INVALID); return (_.second != HB_MAP_VALUE_INVALID);
}) })
; ;
cmap_prime->serialize (c->serializer, it, unicode_bmp, unicode_ucs4, ms_bmp, ms_ucs4); cmap_prime->serialize (c->serializer, it, unicode_bmp, unicode_ucs4, ms_bmp, ms_ucs4);
@ -1181,7 +1181,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

@ -251,7 +251,7 @@ struct IndexSubtableArray
unsigned int firstGlyphIndex = indexSubtablesZ[i].firstGlyphIndex; unsigned int firstGlyphIndex = indexSubtablesZ[i].firstGlyphIndex;
unsigned int lastGlyphIndex = indexSubtablesZ[i].lastGlyphIndex; unsigned int lastGlyphIndex = indexSubtablesZ[i].lastGlyphIndex;
if (firstGlyphIndex <= glyph && glyph <= lastGlyphIndex) if (firstGlyphIndex <= glyph && glyph <= lastGlyphIndex)
return &indexSubtablesZ[i]; return &indexSubtablesZ[i];
} }
return nullptr; return nullptr;
} }

View File

@ -147,7 +147,7 @@ struct CPAL
unsigned int count = hb_min ((unsigned) hb_max ((int) (numColors - start_offset), 0), *color_count); unsigned int count = hb_min ((unsigned) hb_max ((int) (numColors - start_offset), 0), *color_count);
*color_count = count; *color_count = count;
for (unsigned int i = 0; i < count; i++) for (unsigned int i = 0; i < count; i++)
colors[i] = segment_colors[i]; /* Bound-checked read. */ colors[i] = segment_colors[i]; /* Bound-checked read. */
} }
return numColors; return numColors;
} }

View File

@ -173,11 +173,11 @@ struct sbix
{ {
unsigned count = table->strikes.len; unsigned count = table->strikes.len;
if (unlikely (!count)) if (unlikely (!count))
return Null(SBIXStrike); return Null(SBIXStrike);
unsigned int requested_ppem = hb_max (font->x_ppem, font->y_ppem); unsigned int requested_ppem = hb_max (font->x_ppem, font->y_ppem);
if (!requested_ppem) if (!requested_ppem)
requested_ppem = 1<<30; /* Choose largest strike. */ requested_ppem = 1<<30; /* Choose largest strike. */
/* TODO Add DPI sensitivity as well? */ /* TODO Add DPI sensitivity as well? */
unsigned int best_i = 0; unsigned int best_i = 0;
unsigned int best_ppem = table->get_strike (0).ppem; unsigned int best_ppem = table->get_strike (0).ppem;
@ -201,7 +201,7 @@ struct sbix
HBUINT8 signature[8]; HBUINT8 signature[8];
struct struct
{ {
struct struct
{ {
HBUINT32 length; HBUINT32 length;
Tag type; Tag type;
@ -226,7 +226,7 @@ struct sbix
/* Following code is safe to call even without data. /* Following code is safe to call even without data.
* But faster to short-circuit. */ * But faster to short-circuit. */
if (!has_data ()) if (!has_data ())
return false; return false;
int x_offset = 0, y_offset = 0; int x_offset = 0, y_offset = 0;
unsigned int strike_ppem = 0; unsigned int strike_ppem = 0;

View File

@ -208,20 +208,20 @@ hb_ot_get_glyph_extents (hb_font_t *font,
#ifndef HB_NO_OT_FONT_GLYPH_NAMES #ifndef HB_NO_OT_FONT_GLYPH_NAMES
static hb_bool_t static hb_bool_t
hb_ot_get_glyph_name (hb_font_t *font HB_UNUSED, hb_ot_get_glyph_name (hb_font_t *font HB_UNUSED,
void *font_data, void *font_data,
hb_codepoint_t glyph, hb_codepoint_t glyph,
char *name, unsigned int size, char *name, unsigned int size,
void *user_data HB_UNUSED) void *user_data HB_UNUSED)
{ {
const hb_ot_face_t *ot_face = (const hb_ot_face_t *) font_data; const hb_ot_face_t *ot_face = (const hb_ot_face_t *) font_data;
return ot_face->post->get_glyph_name (glyph, name, size); return ot_face->post->get_glyph_name (glyph, name, size);
} }
static hb_bool_t static hb_bool_t
hb_ot_get_glyph_from_name (hb_font_t *font HB_UNUSED, hb_ot_get_glyph_from_name (hb_font_t *font HB_UNUSED,
void *font_data, void *font_data,
const char *name, int len, const char *name, int len,
hb_codepoint_t *glyph, hb_codepoint_t *glyph,
void *user_data HB_UNUSED) void *user_data HB_UNUSED)
{ {
const hb_ot_face_t *ot_face = (const hb_ot_face_t *) font_data; const hb_ot_face_t *ot_face = (const hb_ot_face_t *) font_data;
return ot_face->post->get_glyph_from_name (name, len, glyph); return ot_face->post->get_glyph_from_name (name, len, glyph);

View File

@ -66,7 +66,7 @@ struct hmtxvmtx
bool subset_update_header (hb_subset_plan_t *plan, bool subset_update_header (hb_subset_plan_t *plan,
unsigned int num_hmetrics) const unsigned int num_hmetrics) const
{ {
hb_blob_t *src_blob = hb_sanitize_context_t ().reference_table<H> (plan->source, H::tableTag); hb_blob_t *src_blob = hb_sanitize_context_t ().reference_table<H> (plan->source, H::tableTag);
hb_blob_t *dest_blob = hb_blob_copy_writable_or_fail (src_blob); hb_blob_t *dest_blob = hb_blob_copy_writable_or_fail (src_blob);
@ -87,30 +87,30 @@ struct hmtxvmtx
} }
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,
Iterator it, Iterator it,
unsigned num_advances) unsigned num_advances)
{ {
unsigned idx = 0; unsigned idx = 0;
+ it + it
| hb_apply ([c, &idx, num_advances] (const hb_item_type<Iterator>& _) | hb_apply ([c, &idx, num_advances] (const hb_item_type<Iterator>& _)
{ {
if (idx < num_advances) if (idx < num_advances)
{ {
LongMetric lm; LongMetric lm;
lm.advance = _.first; lm.advance = _.first;
lm.sb = _.second; lm.sb = _.second;
if (unlikely (!c->embed<LongMetric> (&lm))) return; if (unlikely (!c->embed<LongMetric> (&lm))) return;
} }
else else
{ {
FWORD *sb = c->allocate_size<FWORD> (FWORD::static_size); FWORD *sb = c->allocate_size<FWORD> (FWORD::static_size);
if (unlikely (!sb)) return; if (unlikely (!sb)) return;
*sb = _.second; *sb = _.second;
} }
idx++; idx++;
}) })
; ;
} }
@ -131,8 +131,8 @@ struct hmtxvmtx
{ {
hb_codepoint_t old_gid; hb_codepoint_t old_gid;
if (c->plan->old_gid_for_new_gid (_, &old_gid)) if (c->plan->old_gid_for_new_gid (_, &old_gid))
return hb_pair (_mtx.get_advance (old_gid), _mtx.get_side_bearing (old_gid)); return hb_pair (_mtx.get_advance (old_gid), _mtx.get_side_bearing (old_gid));
else else
return hb_pair (0u, 0u); return hb_pair (0u, 0u);
}) })
; ;
@ -158,7 +158,7 @@ struct hmtxvmtx
friend struct hmtxvmtx; friend struct hmtxvmtx;
void init (hb_face_t *face, void init (hb_face_t *face,
unsigned int default_advance_ = 0) unsigned int default_advance_ = 0)
{ {
default_advance = default_advance_ ? default_advance_ : hb_face_get_upem (face); default_advance = default_advance_ ? default_advance_ : hb_face_get_upem (face);
@ -194,10 +194,10 @@ struct hmtxvmtx
unsigned int get_side_bearing (hb_codepoint_t glyph) const unsigned int get_side_bearing (hb_codepoint_t glyph) const
{ {
if (glyph < num_advances) if (glyph < num_advances)
return table->longMetricZ[glyph].sb; return table->longMetricZ[glyph].sb;
if (unlikely (glyph >= num_metrics)) if (unlikely (glyph >= num_metrics))
return 0; return 0;
const FWORD *bearings = (const FWORD *) &table->longMetricZ[num_advances]; const FWORD *bearings = (const FWORD *) &table->longMetricZ[num_advances];
return bearings[glyph - num_advances]; return bearings[glyph - num_advances];
@ -234,12 +234,12 @@ struct hmtxvmtx
{ {
unsigned int num_advances = plan->num_output_glyphs (); unsigned int num_advances = plan->num_output_glyphs ();
unsigned int last_advance = _advance_for_new_gid (plan, unsigned int last_advance = _advance_for_new_gid (plan,
num_advances - 1); num_advances - 1);
while (num_advances > 1 && while (num_advances > 1 &&
last_advance == _advance_for_new_gid (plan, last_advance == _advance_for_new_gid (plan,
num_advances - 2)) num_advances - 2))
{ {
num_advances--; num_advances--;
} }
return num_advances; return num_advances;
@ -247,11 +247,11 @@ struct hmtxvmtx
private: private:
unsigned int _advance_for_new_gid (const hb_subset_plan_t *plan, unsigned int _advance_for_new_gid (const hb_subset_plan_t *plan,
hb_codepoint_t new_gid) const hb_codepoint_t new_gid) const
{ {
hb_codepoint_t old_gid; hb_codepoint_t old_gid;
if (!plan->old_gid_for_new_gid (new_gid, &old_gid)) if (!plan->old_gid_for_new_gid (new_gid, &old_gid))
return 0; return 0;
return get_advance (old_gid); return get_advance (old_gid);
} }

View File

@ -895,7 +895,7 @@ struct CoverageFormat2
for (auto g: glyphs) for (auto g: glyphs)
{ {
if (last + 1 != g) if (last + 1 != g)
num_ranges++; num_ranges++;
last = g; last = g;
} }
@ -908,7 +908,7 @@ struct CoverageFormat2
{ {
if (last + 1 != g) if (last + 1 != g)
{ {
range++; range++;
rangeRecord[range].start = g; rangeRecord[range].start = g;
rangeRecord[range].value = count; rangeRecord[range].value = count;
} }
@ -1058,7 +1058,7 @@ struct Coverage
for (auto g: glyphs) for (auto g: glyphs)
{ {
if (last + 1 != g) if (last + 1 != g)
num_ranges++; num_ranges++;
last = g; last = g;
count++; count++;
} }
@ -1526,7 +1526,7 @@ struct ClassDef
num_ranges++; num_ranges++;
if (1 + (glyph_max - glyph_min + 1) < num_ranges * 3) if (1 + (glyph_max - glyph_min + 1) < num_ranges * 3)
format = 1; format = 1;
} }
u.format = format; u.format = format;
@ -1746,9 +1746,9 @@ struct VarData
} }
void get_scalars (int *coords, unsigned int coord_count, void get_scalars (int *coords, unsigned int coord_count,
const VarRegionList &regions, const VarRegionList &regions,
float *scalars /*OUT */, float *scalars /*OUT */,
unsigned int num_scalars) const unsigned int num_scalars) const
{ {
unsigned count = hb_min (num_scalars, regionIndices.len); unsigned count = hb_min (num_scalars, regionIndices.len);
for (unsigned int i = 0; i < count; i++) for (unsigned int i = 0; i < count; i++)
@ -1830,7 +1830,7 @@ struct VariationStore
#endif #endif
(this+dataSets[ivs]).get_scalars (coords, coord_count, this+regions, (this+dataSets[ivs]).get_scalars (coords, coord_count, this+regions,
&scalars[0], num_scalars); &scalars[0], num_scalars);
} }
protected: protected:

View File

@ -149,8 +149,8 @@ struct CaretValueFormat3
const VariationStore &var_store) const const VariationStore &var_store) const
{ {
return HB_DIRECTION_IS_HORIZONTAL (direction) ? return HB_DIRECTION_IS_HORIZONTAL (direction) ?
font->em_scale_x (coordinate) + (this+deviceTable).get_x_delta (font, var_store) : font->em_scale_x (coordinate) + (this+deviceTable).get_x_delta (font, var_store) :
font->em_scale_y (coordinate) + (this+deviceTable).get_y_delta (font, var_store); font->em_scale_y (coordinate) + (this+deviceTable).get_y_delta (font, var_store);
} }
bool sanitize (hb_sanitize_context_t *c) const bool sanitize (hb_sanitize_context_t *c) const

View File

@ -238,8 +238,8 @@ struct ValueFormat : HBUINT16
template<typename Iterator> template<typename Iterator>
static inline void SinglePos_serialize (hb_serialize_context_t *c, static inline void SinglePos_serialize (hb_serialize_context_t *c,
Iterator it, Iterator it,
ValueFormat valFormat); ValueFormat valFormat);
struct AnchorFormat1 struct AnchorFormat1
@ -513,10 +513,7 @@ struct SinglePosFormat1
auto vals = hb_second (*it); auto vals = hb_second (*it);
+ vals + vals
| hb_apply ([=] (const Value& _) | hb_apply ([=] (const Value& _) { c->copy (_); })
{
c->copy (_);
})
; ;
auto glyphs = auto glyphs =
@ -539,9 +536,9 @@ struct SinglePosFormat1
+ hb_iter (this+coverage) + hb_iter (this+coverage)
| hb_filter (glyphset) | hb_filter (glyphset)
| hb_map_retains_sorting ([&] (hb_codepoint_t p) | hb_map_retains_sorting ([&] (hb_codepoint_t p)
{ {
return hb_pair (glyph_map[p], values.as_array (length)); return hb_pair (glyph_map[p], values.as_array (length));
}) })
; ;
bool ret = bool (it); bool ret = bool (it);
@ -602,30 +599,27 @@ struct SinglePosFormat2
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,
Iterator it, Iterator it,
ValueFormat valFormat) ValueFormat valFormat)
{ {
if (unlikely (!c->extend_min (*this))) return; if (unlikely (!c->extend_min (*this))) return;
if (unlikely (!c->check_assign (valueFormat, valFormat))) return; if (unlikely (!c->check_assign (valueFormat, valFormat))) return;
if (unlikely (!c->check_assign (valueCount, it.len ()))) return; if (unlikely (!c->check_assign (valueCount, it.len ()))) return;
+ it + it
| hb_map (hb_second) | hb_map (hb_second)
| hb_apply ([=] (hb_array_t<const Value> val_iter) | hb_apply ([=] (hb_array_t<const Value> val_iter)
{ {
+ val_iter + val_iter
| hb_apply ([=] (const Value& _) | hb_apply ([=] (const Value& _) { c->copy (_); })
{ ;
c->copy (_); })
})
;
})
; ;
auto glyphs = auto glyphs =
+ it + it
| hb_map_retains_sorting (hb_first) | hb_map_retains_sorting (hb_first)
; ;
coverage.serialize (c, this).serialize (c, glyphs); coverage.serialize (c, this).serialize (c, glyphs);
} }
@ -642,9 +636,9 @@ struct SinglePosFormat2
+ hb_zip (this+coverage, hb_range ((unsigned) valueCount)) + hb_zip (this+coverage, hb_range ((unsigned) valueCount))
| hb_filter (glyphset, hb_first) | hb_filter (glyphset, hb_first)
| hb_map_retains_sorting ([&] (const hb_pair_t<hb_codepoint_t, unsigned>& _) | hb_map_retains_sorting ([&] (const hb_pair_t<hb_codepoint_t, unsigned>& _)
{ {
return hb_pair (glyph_map[_.first], values.as_array (total_length).sub_array (_.second * sub_length, sub_length)); return hb_pair (glyph_map[_.first], values.as_array (total_length).sub_array (_.second * sub_length, sub_length));
}) })
; ;
bool ret = bool (it); bool ret = bool (it);
@ -686,18 +680,18 @@ struct SinglePos
+ glyph_val_iter_pairs + glyph_val_iter_pairs
| hb_map (hb_second) | hb_map (hb_second)
| hb_apply ([&] (hb_array_t<const Value> val_iter) | hb_apply ([&] (hb_array_t<const Value> val_iter)
{ {
+ hb_zip (val_iter, first_val_iter) + hb_zip (val_iter, first_val_iter)
| hb_apply ([&] (const hb_pair_t<Value, Value>& _) | hb_apply ([&] (const hb_pair_t<Value, Value>& _)
{ {
if (_.first != _.second) if (_.first != _.second)
{ {
subset_format = 2; subset_format = 2;
return; return;
} }
}) })
; ;
}) })
; ;
return subset_format; return subset_format;
@ -708,7 +702,7 @@ struct SinglePos
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,
Iterator glyph_val_iter_pairs, Iterator glyph_val_iter_pairs,
ValueFormat valFormat) ValueFormat valFormat)
{ {
if (unlikely (!c->extend_min (u.format))) return; if (unlikely (!c->extend_min (u.format))) return;
unsigned format = 2; unsigned format = 2;
@ -718,9 +712,9 @@ struct SinglePos
u.format = format; u.format = format;
switch (u.format) { switch (u.format) {
case 1: u.format1.serialize (c, glyph_val_iter_pairs, valFormat); case 1: u.format1.serialize (c, glyph_val_iter_pairs, valFormat);
return; return;
case 2: u.format2.serialize (c, glyph_val_iter_pairs, valFormat); case 2: u.format2.serialize (c, glyph_val_iter_pairs, valFormat);
return; return;
default:return; default:return;
} }
} }
@ -748,8 +742,8 @@ struct SinglePos
template<typename Iterator> template<typename Iterator>
static inline void static inline void
SinglePos_serialize (hb_serialize_context_t *c, SinglePos_serialize (hb_serialize_context_t *c,
Iterator it, Iterator it,
ValueFormat valFormat) ValueFormat valFormat)
{ c->start_embed<SinglePos> ()->serialize (c, it, valFormat); } { c->start_embed<SinglePos> ()->serialize (c, it, valFormat); }

View File

@ -567,7 +567,7 @@ hb_ot_layout_table_select_script (hb_face_t *face,
if (g.find_script_index (script_tags[i], script_index)) if (g.find_script_index (script_tags[i], script_index))
{ {
if (chosen_script) if (chosen_script)
*chosen_script = script_tags[i]; *chosen_script = script_tags[i];
return true; return true;
} }
} }
@ -999,9 +999,9 @@ hb_ot_layout_table_get_lookup_count (hb_face_t *face,
struct hb_collect_features_context_t struct hb_collect_features_context_t
{ {
hb_collect_features_context_t (hb_face_t *face, hb_collect_features_context_t (hb_face_t *face,
hb_tag_t table_tag, hb_tag_t table_tag,
hb_set_t *feature_indexes_) hb_set_t *feature_indexes_)
: g (get_gsubgpos_table (face, table_tag)), : g (get_gsubgpos_table (face, table_tag)),
feature_indexes (feature_indexes_), feature_indexes (feature_indexes_),
script_count(0),langsys_count(0) {} script_count(0),langsys_count(0) {}
@ -1147,11 +1147,11 @@ script_collect_features (hb_collect_features_context_t *c,
**/ **/
void void
hb_ot_layout_collect_features (hb_face_t *face, hb_ot_layout_collect_features (hb_face_t *face,
hb_tag_t table_tag, hb_tag_t table_tag,
const hb_tag_t *scripts, const hb_tag_t *scripts,
const hb_tag_t *languages, const hb_tag_t *languages,
const hb_tag_t *features, const hb_tag_t *features,
hb_set_t *feature_indexes /* OUT */) hb_set_t *feature_indexes /* OUT */)
{ {
hb_collect_features_context_t c (face, table_tag, feature_indexes); hb_collect_features_context_t c (face, table_tag, feature_indexes);
if (!scripts) if (!scripts)
@ -1482,8 +1482,8 @@ hb_ot_layout_lookup_substitute_closure (hb_face_t *face,
**/ **/
void void
hb_ot_layout_lookups_substitute_closure (hb_face_t *face, hb_ot_layout_lookups_substitute_closure (hb_face_t *face,
const hb_set_t *lookups, const hb_set_t *lookups,
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);
@ -1497,12 +1497,12 @@ hb_ot_layout_lookups_substitute_closure (hb_face_t *face,
if (lookups != nullptr) if (lookups != nullptr)
{ {
for (hb_codepoint_t lookup_index = HB_SET_VALUE_INVALID; hb_set_next (lookups, &lookup_index);) for (hb_codepoint_t lookup_index = HB_SET_VALUE_INVALID; hb_set_next (lookups, &lookup_index);)
gsub.get_lookup (lookup_index).closure (&c, lookup_index); gsub.get_lookup (lookup_index).closure (&c, lookup_index);
} }
else else
{ {
for (unsigned int i = 0; i < gsub.get_lookup_count (); i++) for (unsigned int i = 0; i < gsub.get_lookup_count (); i++)
gsub.get_lookup (i).closure (&c, i); gsub.get_lookup (i).closure (&c, i);
} }
} while (iteration_count++ <= HB_CLOSURE_MAX_STAGES && } while (iteration_count++ <= HB_CLOSURE_MAX_STAGES &&
glyphs_length != glyphs->get_population ()); glyphs_length != glyphs->get_population ());

View File

@ -249,11 +249,11 @@ hb_ot_layout_table_get_lookup_count (hb_face_t *face,
HB_EXTERN void HB_EXTERN void
hb_ot_layout_collect_features (hb_face_t *face, hb_ot_layout_collect_features (hb_face_t *face,
hb_tag_t table_tag, hb_tag_t table_tag,
const hb_tag_t *scripts, const hb_tag_t *scripts,
const hb_tag_t *languages, const hb_tag_t *languages,
const hb_tag_t *features, const hb_tag_t *features,
hb_set_t *feature_indexes /* OUT */); hb_set_t *feature_indexes /* OUT */);
HB_EXTERN void HB_EXTERN void
hb_ot_layout_collect_lookups (hb_face_t *face, hb_ot_layout_collect_lookups (hb_face_t *face,
@ -333,14 +333,14 @@ hb_ot_layout_lookup_would_substitute (hb_face_t *face,
HB_EXTERN void HB_EXTERN 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 hb_set_t *glyphs
/*TODO , hb_bool_t inclusive */); /*TODO , hb_bool_t inclusive */);
HB_EXTERN void HB_EXTERN void
hb_ot_layout_lookups_substitute_closure (hb_face_t *face, hb_ot_layout_lookups_substitute_closure (hb_face_t *face,
const hb_set_t *lookups, const hb_set_t *lookups,
hb_set_t *glyphs); hb_set_t *glyphs);
#ifdef HB_NOT_IMPLEMENTED #ifdef HB_NOT_IMPLEMENTED

View File

@ -297,7 +297,7 @@ hb_ot_map_builder_t::compile (hb_ot_map_t &m,
global_bit_mask); global_bit_mask);
for (unsigned i = 0; i < m.features.length; i++) for (unsigned i = 0; i < m.features.length; i++)
if (m.features[i].stage[table_index] == stage) if (m.features[i].stage[table_index] == stage)
add_lookups (m, table_index, add_lookups (m, table_index,
m.features[i].index[table_index], m.features[i].index[table_index],
key.variations_index[table_index], key.variations_index[table_index],

View File

@ -108,7 +108,7 @@ struct maxp
if (unlikely (!dest_v1)) return_trace (false); if (unlikely (!dest_v1)) return_trace (false);
if (c->plan->drop_hints) if (c->plan->drop_hints)
drop_hint_fields (dest_v1); drop_hint_fields (dest_v1);
} }
return_trace (true); return_trace (true);

View File

@ -265,10 +265,10 @@ struct name
unsigned int j = 0; unsigned int j = 0;
for (unsigned int i = 0; i < this->names.length; i++) for (unsigned int i = 0; i < this->names.length; i++)
{ {
if (this->names[i].entry_score == UNSUPPORTED || if (this->names[i].entry_score == UNSUPPORTED ||
this->names[i].language == HB_LANGUAGE_INVALID) this->names[i].language == HB_LANGUAGE_INVALID)
continue; continue;
if (i && if (i &&
this->names[i - 1].name_id == this->names[i].name_id && this->names[i - 1].name_id == this->names[i].name_id &&
this->names[i - 1].language == this->names[i].language) this->names[i - 1].language == this->names[i].language)
continue; continue;
@ -295,10 +295,10 @@ struct name
sizeof (key), sizeof (key),
_hb_ot_name_entry_cmp_key); _hb_ot_name_entry_cmp_key);
if (!entry) if (!entry)
return -1; return -1;
if (width) if (width)
*width = entry->entry_score < 10 ? 2 : 1; *width = entry->entry_score < 10 ? 2 : 1;
return entry->entry_index; return entry->entry_index;
} }

View File

@ -90,7 +90,7 @@ hb_ot_name_convert_utf (hb_bytes_t bytes,
const typename in_utf_t::codepoint_t *src_next = in_utf_t::next (src, src_end, &unicode, replacement); const typename in_utf_t::codepoint_t *src_next = in_utf_t::next (src, src_end, &unicode, replacement);
typename out_utf_t::codepoint_t *dst_next = out_utf_t::encode (dst, dst_end, unicode); typename out_utf_t::codepoint_t *dst_next = out_utf_t::encode (dst, dst_end, unicode);
if (dst_next == dst) if (dst_next == dst)
break; /* Out-of-room. */ break; /* Out-of-room. */
dst = dst_next; dst = dst_next;
src = src_next; src = src_next;

View File

@ -476,13 +476,13 @@ apply_stch (const hb_ot_shape_plan_t *plan HB_UNUSED,
{ {
if (!hb_in_range<uint8_t> (info[i - 1].arabic_shaping_action(), STCH_FIXED, STCH_REPEATING)) if (!hb_in_range<uint8_t> (info[i - 1].arabic_shaping_action(), STCH_FIXED, STCH_REPEATING))
{ {
if (step == CUT) if (step == CUT)
{ {
--j; --j;
info[j] = info[i - 1]; info[j] = info[i - 1];
pos[j] = pos[i - 1]; pos[j] = pos[i - 1];
} }
continue; continue;
} }
/* Yay, justification! */ /* Yay, justification! */
@ -540,10 +540,10 @@ apply_stch (const hb_ot_shape_plan_t *plan HB_UNUSED,
hb_position_t shortfall = sign * w_remaining - sign * w_repeating * (n_copies + 1); hb_position_t shortfall = sign * w_remaining - sign * w_repeating * (n_copies + 1);
if (shortfall > 0 && n_repeating > 0) if (shortfall > 0 && n_repeating > 0)
{ {
++n_copies; ++n_copies;
hb_position_t excess = (n_copies + 1) * sign * w_repeating - sign * w_remaining; hb_position_t excess = (n_copies + 1) * sign * w_repeating - sign * w_remaining;
if (excess > 0) if (excess > 0)
extra_repeat_overlap = excess / (n_copies * n_repeating); extra_repeat_overlap = excess / (n_copies * n_repeating);
} }
if (step == MEASURE) if (step == MEASURE)
@ -583,7 +583,7 @@ apply_stch (const hb_ot_shape_plan_t *plan HB_UNUSED,
if (step == MEASURE) if (step == MEASURE)
{ {
if (unlikely (!buffer->ensure (count + extra_glyphs_needed))) if (unlikely (!buffer->ensure (count + extra_glyphs_needed)))
break; break;
} }
else else
{ {

View File

@ -204,7 +204,7 @@ preprocess_text_hangul (const hb_ot_shape_plan_t *plan HB_UNUSED,
if (start < end && end == buffer->out_len) if (start < end && end == buffer->out_len)
{ {
/* Tone mark follows a valid syllable; move it in front, unless it's zero width. */ /* Tone mark follows a valid syllable; move it in front, unless it's zero width. */
buffer->unsafe_to_break_from_outbuffer (start, buffer->idx); buffer->unsafe_to_break_from_outbuffer (start, buffer->idx);
buffer->next_glyph (); buffer->next_glyph ();
if (!is_zero_width_char (font, u)) if (!is_zero_width_char (font, u))
{ {
@ -354,9 +354,9 @@ preprocess_text_hangul (const hb_ot_shape_plan_t *plan HB_UNUSED,
*/ */
if (has_glyph && !tindex) if (has_glyph && !tindex)
{ {
buffer->next_glyph (); buffer->next_glyph ();
s_len++; s_len++;
} }
if (unlikely (!buffer->successful)) if (unlikely (!buffer->successful))
return; return;
@ -365,7 +365,7 @@ preprocess_text_hangul (const hb_ot_shape_plan_t *plan HB_UNUSED,
* that are now in buffer->out_info. * that are now in buffer->out_info.
*/ */
hb_glyph_info_t *info = buffer->out_info; hb_glyph_info_t *info = buffer->out_info;
end = start + s_len; end = start + s_len;
unsigned int i = start; unsigned int i = start;
info[i++].hangul_shaping_feature() = LJMO; info[i++].hangul_shaping_feature() = LJMO;
@ -383,7 +383,7 @@ preprocess_text_hangul (const hb_ot_shape_plan_t *plan HB_UNUSED,
if (has_glyph) if (has_glyph)
{ {
/* We didn't decompose the S, so just advance past it. */ /* We didn't decompose the S, so just advance past it. */
end = start + 1; end = start + 1;
buffer->next_glyph (); buffer->next_glyph ();
continue; continue;

View File

@ -540,7 +540,7 @@ initial_reordering_consonant_syllable (const hb_ot_shape_plan_t *plan,
case BASE_POS_LAST_SINHALA: case BASE_POS_LAST_SINHALA:
{ {
/* Sinhala base positioning is slightly different from main Indic, in that: /* Sinhala base positioning is slightly different from main Indic, in that:
* 1. Its ZWJ behavior is different, * 1. Its ZWJ behavior is different,
* 2. We don't need to look into the font for consonant positions. * 2. We don't need to look into the font for consonant positions.
*/ */
@ -669,8 +669,8 @@ initial_reordering_consonant_syllable (const hb_ot_shape_plan_t *plan,
for (unsigned int i = base + 1; i < end; i++) for (unsigned int i = base + 1; i < end; i++)
if (info[i].indic_category() == OT_H) if (info[i].indic_category() == OT_H)
{ {
unsigned int j; unsigned int j;
for (j = end - 1; j > i; j--) for (j = end - 1; j > i; j--)
if (is_consonant (info[j]) || if (is_consonant (info[j]) ||
(disallow_double_halants && info[j].indic_category() == OT_H)) (disallow_double_halants && info[j].indic_category() == OT_H))
break; break;
@ -680,7 +680,7 @@ initial_reordering_consonant_syllable (const hb_ot_shape_plan_t *plan,
memmove (&info[i], &info[i + 1], (j - i) * sizeof (info[0])); memmove (&info[i], &info[i + 1], (j - i) * sizeof (info[0]));
info[j] = t; info[j] = t;
} }
break; break;
} }
} }
@ -711,7 +711,7 @@ initial_reordering_consonant_syllable (const hb_ot_shape_plan_t *plan,
} }
} }
} else if (info[i].indic_position() != POS_SMVD) { } else if (info[i].indic_position() != POS_SMVD) {
last_pos = (indic_position_t) info[i].indic_position(); last_pos = (indic_position_t) info[i].indic_position();
} }
} }
} }
@ -727,7 +727,7 @@ initial_reordering_consonant_syllable (const hb_ot_shape_plan_t *plan,
info[j].indic_position() = info[i].indic_position(); info[j].indic_position() = info[i].indic_position();
last = i; last = i;
} else if (info[i].indic_category() == OT_M) } else if (info[i].indic_category() == OT_M)
last = i; last = i;
} }
@ -764,7 +764,7 @@ initial_reordering_consonant_syllable (const hb_ot_shape_plan_t *plan,
{ {
/* Note! syllable() is a one-byte field. */ /* Note! syllable() is a one-byte field. */
for (unsigned int i = base; i < end; i++) for (unsigned int i = base; i < end; i++)
if (info[i].syllable() != 255) if (info[i].syllable() != 255)
{ {
unsigned int max = i; unsigned int max = i;
unsigned int j = start + info[i].syllable(); unsigned int j = start + info[i].syllable();
@ -852,7 +852,7 @@ initial_reordering_consonant_syllable (const hb_ot_shape_plan_t *plan,
for (unsigned int i = base + 1; i + pref_len - 1 < end; i++) { for (unsigned int i = base + 1; i + pref_len - 1 < end; i++) {
hb_codepoint_t glyphs[2]; hb_codepoint_t glyphs[2];
for (unsigned int j = 0; j < pref_len; j++) for (unsigned int j = 0; j < pref_len; j++)
glyphs[j] = info[i + j].codepoint; glyphs[j] = info[i + j].codepoint;
if (indic_plan->pref.would_substitute (glyphs, pref_len, face)) if (indic_plan->pref.would_substitute (glyphs, pref_len, face))
{ {
for (unsigned int j = 0; j < pref_len; j++) for (unsigned int j = 0; j < pref_len; j++)
@ -983,7 +983,7 @@ insert_dotted_circles_indic (const hb_ot_shape_plan_t *plan HB_UNUSED,
while (buffer->idx < buffer->len && buffer->successful && while (buffer->idx < buffer->len && buffer->successful &&
last_syllable == buffer->cur().syllable() && last_syllable == buffer->cur().syllable() &&
buffer->cur().indic_category() == OT_Repha) buffer->cur().indic_category() == OT_Repha)
buffer->next_glyph (); buffer->next_glyph ();
buffer->output_info (ginfo); buffer->output_info (ginfo);
} }
@ -1029,7 +1029,7 @@ final_reordering_syllable_indic (const hb_ot_shape_plan_t *plan,
_hb_glyph_info_ligated (&info[i]) && _hb_glyph_info_ligated (&info[i]) &&
_hb_glyph_info_multiplied (&info[i])) _hb_glyph_info_multiplied (&info[i]))
{ {
/* This will make sure that this glyph passes is_halant() test. */ /* This will make sure that this glyph passes is_halant() test. */
info[i].indic_category() = OT_H; info[i].indic_category() = OT_H;
_hb_glyph_info_clear_ligated_and_multiplied (&info[i]); _hb_glyph_info_clear_ligated_and_multiplied (&info[i]);
} }
@ -1092,7 +1092,7 @@ final_reordering_syllable_indic (const hb_ot_shape_plan_t *plan,
} }
if (start < base && info[base].indic_position() > POS_BASE_C) if (start < base && info[base].indic_position() > POS_BASE_C)
base--; base--;
break; break;
} }
if (base == end && start < base && if (base == end && start < base &&
@ -1182,7 +1182,7 @@ final_reordering_syllable_indic (const hb_ot_shape_plan_t *plan,
} }
} }
else else
new_pos = start; /* No move. */ new_pos = start; /* No move. */
} }
if (start < new_pos && info[new_pos].indic_position () != POS_PRE_M) if (start < new_pos && info[new_pos].indic_position () != POS_PRE_M)
@ -1284,7 +1284,7 @@ final_reordering_syllable_indic (const hb_ot_shape_plan_t *plan,
while (new_reph_pos + 1 < end && info[new_reph_pos + 1].indic_position() <= POS_AFTER_MAIN) while (new_reph_pos + 1 < end && info[new_reph_pos + 1].indic_position() <= POS_AFTER_MAIN)
new_reph_pos++; new_reph_pos++;
if (new_reph_pos < end) if (new_reph_pos < end)
goto reph_move; goto reph_move;
} }
/* 4. If reph should be positioned before post-base consonant, find /* 4. If reph should be positioned before post-base consonant, find
@ -1300,7 +1300,7 @@ final_reordering_syllable_indic (const hb_ot_shape_plan_t *plan,
!( FLAG_UNSAFE (info[new_reph_pos + 1].indic_position()) & (FLAG (POS_POST_C) | FLAG (POS_AFTER_POST) | FLAG (POS_SMVD)))) !( FLAG_UNSAFE (info[new_reph_pos + 1].indic_position()) & (FLAG (POS_POST_C) | FLAG (POS_AFTER_POST) | FLAG (POS_SMVD))))
new_reph_pos++; new_reph_pos++;
if (new_reph_pos < end) if (new_reph_pos < end)
goto reph_move; goto reph_move;
} }
/* 5. If no consonant is found in steps 3 or 4, move reph to a position /* 5. If no consonant is found in steps 3 or 4, move reph to a position
@ -1382,7 +1382,7 @@ final_reordering_syllable_indic (const hb_ot_shape_plan_t *plan,
* of the <pref> feature. (Note that a font may shape a Ra consonant with * of the <pref> feature. (Note that a font may shape a Ra consonant with
* the feature generally but block it in certain contexts.) * the feature generally but block it in certain contexts.)
*/ */
/* Note: We just check that something got substituted. We don't check that /* Note: We just check that something got substituted. We don't check that
* the <pref> feature actually did it... * the <pref> feature actually did it...
* *
* Reorder pref only if it ligated. */ * Reorder pref only if it ligated. */
@ -1428,7 +1428,7 @@ final_reordering_syllable_indic (const hb_ot_shape_plan_t *plan,
} }
} }
break; break;
} }
} }
@ -1454,7 +1454,7 @@ final_reordering_syllable_indic (const hb_ot_shape_plan_t *plan,
{ {
case HB_SCRIPT_TAMIL: case HB_SCRIPT_TAMIL:
case HB_SCRIPT_SINHALA: case HB_SCRIPT_SINHALA:
break; break;
default: default:
/* Uniscribe merges the entire syllable into a single cluster... Except for Tamil & Sinhala. /* Uniscribe merges the entire syllable into a single cluster... Except for Tamil & Sinhala.

View File

@ -378,7 +378,7 @@ insert_dotted_circles_khmer (const hb_ot_shape_plan_t *plan HB_UNUSED,
while (buffer->idx < buffer->len && buffer->successful && while (buffer->idx < buffer->len && buffer->successful &&
last_syllable == buffer->cur().syllable() && last_syllable == buffer->cur().syllable() &&
buffer->cur().khmer_category() == OT_Repha) buffer->cur().khmer_category() == OT_Repha)
buffer->next_glyph (); buffer->next_glyph ();
buffer->output_info (ginfo); buffer->output_info (ginfo);
} }

View File

@ -239,7 +239,7 @@ initial_reordering_consonant_syllable (hb_buffer_t *buffer,
} }
if (pos == POS_BELOW_C && info[i].myanmar_category() != OT_A) if (pos == POS_BELOW_C && info[i].myanmar_category() != OT_A)
{ {
pos = POS_AFTER_SUB; pos = POS_AFTER_SUB;
info[i].myanmar_position() = pos; info[i].myanmar_position() = pos;
continue; continue;
} }

View File

@ -534,7 +534,7 @@ insert_dotted_circles_use (const hb_ot_shape_plan_t *plan HB_UNUSED,
while (buffer->idx < buffer->len && buffer->successful && while (buffer->idx < buffer->len && buffer->successful &&
last_syllable == buffer->cur().syllable() && last_syllable == buffer->cur().syllable() &&
buffer->cur().use_category() == USE_R) buffer->cur().use_category() == USE_R)
buffer->next_glyph (); buffer->next_glyph ();
buffer->output_info (ginfo); buffer->output_info (ginfo);
} }

View File

@ -45,30 +45,30 @@ recategorize_combining_class (hb_codepoint_t u,
{ {
switch (u) switch (u)
{ {
case 0x0E31u: case 0x0E31u:
case 0x0E34u: case 0x0E34u:
case 0x0E35u: case 0x0E35u:
case 0x0E36u: case 0x0E36u:
case 0x0E37u: case 0x0E37u:
case 0x0E47u: case 0x0E47u:
case 0x0E4Cu: case 0x0E4Cu:
case 0x0E4Du: case 0x0E4Du:
case 0x0E4Eu: case 0x0E4Eu:
klass = HB_UNICODE_COMBINING_CLASS_ABOVE_RIGHT; klass = HB_UNICODE_COMBINING_CLASS_ABOVE_RIGHT;
break; break;
case 0x0EB1u: case 0x0EB1u:
case 0x0EB4u: case 0x0EB4u:
case 0x0EB5u: case 0x0EB5u:
case 0x0EB6u: case 0x0EB6u:
case 0x0EB7u: case 0x0EB7u:
case 0x0EBBu: case 0x0EBBu:
case 0x0ECCu: case 0x0ECCu:
case 0x0ECDu: case 0x0ECDu:
klass = HB_UNICODE_COMBINING_CLASS_ABOVE; klass = HB_UNICODE_COMBINING_CLASS_ABOVE;
break; break;
case 0x0EBCu: case 0x0EBCu:
klass = HB_UNICODE_COMBINING_CLASS_BELOW; klass = HB_UNICODE_COMBINING_CLASS_BELOW;
break; break;
} }
@ -167,8 +167,8 @@ recategorize_combining_class (hb_codepoint_t u,
void void
_hb_ot_shape_fallback_mark_position_recategorize_marks (const hb_ot_shape_plan_t *plan HB_UNUSED, _hb_ot_shape_fallback_mark_position_recategorize_marks (const hb_ot_shape_plan_t *plan HB_UNUSED,
hb_font_t *font HB_UNUSED, hb_font_t *font HB_UNUSED,
hb_buffer_t *buffer) hb_buffer_t *buffer)
{ {
#ifdef HB_NO_OT_SHAPE_FALLBACK #ifdef HB_NO_OT_SHAPE_FALLBACK
return; return;
@ -232,10 +232,10 @@ position_mark (const hb_ot_shape_plan_t *plan HB_UNUSED,
case HB_UNICODE_COMBINING_CLASS_DOUBLE_ABOVE: case HB_UNICODE_COMBINING_CLASS_DOUBLE_ABOVE:
if (buffer->props.direction == HB_DIRECTION_LTR) { if (buffer->props.direction == HB_DIRECTION_LTR) {
pos.x_offset += base_extents.x_bearing + base_extents.width - mark_extents.width / 2 - mark_extents.x_bearing; pos.x_offset += base_extents.x_bearing + base_extents.width - mark_extents.width / 2 - mark_extents.x_bearing;
break; break;
} else if (buffer->props.direction == HB_DIRECTION_RTL) { } else if (buffer->props.direction == HB_DIRECTION_RTL) {
pos.x_offset += base_extents.x_bearing - mark_extents.width / 2 - mark_extents.x_bearing; pos.x_offset += base_extents.x_bearing - mark_extents.width / 2 - mark_extents.x_bearing;
break; break;
} }
HB_FALLTHROUGH; HB_FALLTHROUGH;
@ -387,7 +387,7 @@ position_around_base (const hb_ot_shape_plan_t *plan,
if (last_combining_class != this_combining_class) if (last_combining_class != this_combining_class)
{ {
last_combining_class = this_combining_class; last_combining_class = this_combining_class;
cluster_extents = component_extents; cluster_extents = component_extents;
} }
position_mark (plan, font, buffer, cluster_extents, i, this_combining_class); position_mark (plan, font, buffer, cluster_extents, i, this_combining_class);

View File

@ -233,7 +233,7 @@ handle_variation_selector_cluster (const hb_ot_shape_normalize_context_t *c,
} }
else else
{ {
/* Just pass on the two characters separately, let GSUB do its magic. */ /* Just pass on the two characters separately, let GSUB do its magic. */
set_glyph (buffer->cur(), font); set_glyph (buffer->cur(), font);
buffer->next_glyph (); buffer->next_glyph ();
set_glyph (buffer->cur(), font); set_glyph (buffer->cur(), font);
@ -343,7 +343,7 @@ _hb_ot_shape_normalize (const hb_ot_shape_plan_t *plan,
/* From idx to end are simple clusters. */ /* From idx to end are simple clusters. */
if (might_short_circuit) if (might_short_circuit)
{ {
unsigned int done = font->get_nominal_glyphs (end - buffer->idx, unsigned int done = font->get_nominal_glyphs (end - buffer->idx,
&buffer->cur().codepoint, &buffer->cur().codepoint,
sizeof (buffer->info[0]), sizeof (buffer->info[0]),
&buffer->cur().glyph_index(), &buffer->cur().glyph_index(),

View File

@ -489,7 +489,7 @@ hb_set_unicode_props (hb_buffer_t *buffer)
if (i + 1 < count && if (i + 1 < count &&
_hb_unicode_is_emoji_Extended_Pictographic (info[i + 1].codepoint)) _hb_unicode_is_emoji_Extended_Pictographic (info[i + 1].codepoint))
{ {
i++; i++;
_hb_glyph_info_set_unicode_props (&info[i], buffer); _hb_glyph_info_set_unicode_props (&info[i], buffer);
_hb_glyph_info_set_continuation (&info[i]); _hb_glyph_info_set_continuation (&info[i]);
} }
@ -650,19 +650,19 @@ hb_ot_shape_setup_masks_fraction (const hb_ot_shape_context_t *c)
while (start && while (start &&
_hb_glyph_info_get_general_category (&info[start - 1]) == _hb_glyph_info_get_general_category (&info[start - 1]) ==
HB_UNICODE_GENERAL_CATEGORY_DECIMAL_NUMBER) HB_UNICODE_GENERAL_CATEGORY_DECIMAL_NUMBER)
start--; start--;
while (end < count && while (end < count &&
_hb_glyph_info_get_general_category (&info[end]) == _hb_glyph_info_get_general_category (&info[end]) ==
HB_UNICODE_GENERAL_CATEGORY_DECIMAL_NUMBER) HB_UNICODE_GENERAL_CATEGORY_DECIMAL_NUMBER)
end++; end++;
buffer->unsafe_to_break (start, end); buffer->unsafe_to_break (start, end);
for (unsigned int j = start; j < i; j++) for (unsigned int j = start; j < i; j++)
info[j].mask |= pre_mask; info[j].mask |= pre_mask;
info[i].mask |= c->plan->frac_mask; info[i].mask |= c->plan->frac_mask;
for (unsigned int j = i + 1; j < end; j++) for (unsigned int j = i + 1; j < end; j++)
info[j].mask |= post_mask; info[j].mask |= post_mask;
i = end - 1; i = end - 1;
} }
@ -869,7 +869,7 @@ zero_mark_widths_by_gdef (hb_buffer_t *buffer, bool adjust_offsets)
if (_hb_glyph_info_is_mark (&info[i])) if (_hb_glyph_info_is_mark (&info[i]))
{ {
if (adjust_offsets) if (adjust_offsets)
adjust_mark_offsets (&buffer->pos[i]); adjust_mark_offsets (&buffer->pos[i]);
zero_mark_width (&buffer->pos[i]); zero_mark_width (&buffer->pos[i]);
} }
} }
@ -885,7 +885,7 @@ hb_ot_position_default (const hb_ot_shape_context_t *c)
if (HB_DIRECTION_IS_HORIZONTAL (direction)) if (HB_DIRECTION_IS_HORIZONTAL (direction))
{ {
c->font->get_glyph_h_advances (count, &info[0].codepoint, sizeof(info[0]), c->font->get_glyph_h_advances (count, &info[0].codepoint, sizeof(info[0]),
&pos[0].x_advance, sizeof(pos[0])); &pos[0].x_advance, sizeof(pos[0]));
/* The nil glyph_h_origin() func returns 0, so no need to apply it. */ /* The nil glyph_h_origin() func returns 0, so no need to apply it. */
if (c->font->has_glyph_h_origin_func ()) if (c->font->has_glyph_h_origin_func ())
for (unsigned int i = 0; i < count; i++) for (unsigned int i = 0; i < count; i++)
@ -896,7 +896,7 @@ hb_ot_position_default (const hb_ot_shape_context_t *c)
else else
{ {
c->font->get_glyph_v_advances (count, &info[0].codepoint, sizeof(info[0]), c->font->get_glyph_v_advances (count, &info[0].codepoint, sizeof(info[0]),
&pos[0].y_advance, sizeof(pos[0])); &pos[0].y_advance, sizeof(pos[0]));
for (unsigned int i = 0; i < count; i++) for (unsigned int i = 0; i < count; i++)
{ {
c->font->subtract_glyph_v_origin (info[i].codepoint, c->font->subtract_glyph_v_origin (info[i].codepoint,

View File

@ -304,8 +304,8 @@ struct STAT
protected: protected:
FixedVersion<>version; /* Version of the stat table FixedVersion<>version; /* Version of the stat table
* initially set to 0x00010002u */ * initially set to 0x00010002u */
HBUINT16 designAxisSize; /* The size in bytes of each axis record. */ HBUINT16 designAxisSize; /* The size in bytes of each axis record. */
HBUINT16 designAxisCount;/* The number of design axis records. In a HBUINT16 designAxisCount;/* The number of design axis records. In a
* font with an 'fvar' table, this value must be * font with an 'fvar' table, this value must be

View File

@ -120,7 +120,7 @@ struct avar
for (unsigned int i = 0; i < count; i++) for (unsigned int i = 0; i < count; i++)
{ {
if (unlikely (!map->sanitize (c))) if (unlikely (!map->sanitize (c)))
return_trace (false); return_trace (false);
map = &StructAfter<SegmentMaps> (*map); map = &StructAfter<SegmentMaps> (*map);
} }

View File

@ -199,7 +199,7 @@ struct fvar
for (unsigned int i = 0; i < count; i++) for (unsigned int i = 0; i < count; i++)
if (axes[i].axisTag == tag) if (axes[i].axisTag == tag)
{ {
if (axis_index) if (axis_index)
*axis_index = i; *axis_index = i;
get_axis_deprecated (i, info); get_axis_deprecated (i, info);
return true; return true;
@ -280,7 +280,7 @@ struct fvar
if (unlikely (!instance)) if (unlikely (!instance))
{ {
if (coords_length) if (coords_length)
*coords_length = 0; *coords_length = 0;
return 0; return 0;
} }
@ -289,7 +289,7 @@ struct fvar
hb_array_t<const Fixed> instanceCoords = instance->get_coordinates (axisCount) hb_array_t<const Fixed> instanceCoords = instance->get_coordinates (axisCount)
.sub_array (0, *coords_length); .sub_array (0, *coords_length);
for (unsigned int i = 0; i < instanceCoords.length; i++) for (unsigned int i = 0; i < instanceCoords.length; i++)
coords[i] = instanceCoords.arrayZ[i].to_float (); coords[i] = instanceCoords.arrayZ[i].to_float ();
} }
return axisCount; return axisCount;
} }

View File

@ -70,10 +70,10 @@ struct VORG
} }
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,
Iterator it, Iterator it,
FWORD defaultVertOriginY) FWORD defaultVertOriginY)
{ {
if (unlikely (!c->extend_min ((*this)))) return; if (unlikely (!c->extend_min ((*this)))) return;
@ -99,15 +99,15 @@ struct VORG
+ vertYOrigins.as_array () + vertYOrigins.as_array ()
| hb_filter (c->plan->glyphset (), &VertOriginMetric::glyph) | hb_filter (c->plan->glyphset (), &VertOriginMetric::glyph)
| hb_map ([&] (const VertOriginMetric& _) | hb_map ([&] (const VertOriginMetric& _)
{ {
hb_codepoint_t new_glyph = HB_SET_VALUE_INVALID; hb_codepoint_t new_glyph = HB_SET_VALUE_INVALID;
c->plan->new_gid_for_old_gid (_.glyph, &new_glyph); c->plan->new_gid_for_old_gid (_.glyph, &new_glyph);
VertOriginMetric metric; VertOriginMetric metric;
metric.glyph = new_glyph; metric.glyph = new_glyph;
metric.vertOriginY = _.vertOriginY; metric.vertOriginY = _.vertOriginY;
return metric; return metric;
}) })
; ;
/* serialize the new table */ /* serialize the new table */
@ -119,8 +119,8 @@ struct VORG
{ {
TRACE_SANITIZE (this); TRACE_SANITIZE (this);
return_trace (c->check_struct (this) && return_trace (c->check_struct (this) &&
version.major == 1 && version.major == 1 &&
vertYOrigins.sanitize (c)); vertYOrigins.sanitize (c));
} }
protected: protected:

View File

@ -84,7 +84,7 @@ struct hb_pool_t
T* thread () T* thread ()
{ {
for (unsigned i = 0; i < ARRAY_LENGTH (arrayZ) - 1; i++) for (unsigned i = 0; i < ARRAY_LENGTH (arrayZ) - 1; i++)
* (T**) &arrayZ[i] = &arrayZ[i + 1]; * (T**) &arrayZ[i] = &arrayZ[i + 1];
* (T**) &arrayZ[ARRAY_LENGTH (arrayZ) - 1] = nullptr; * (T**) &arrayZ[ARRAY_LENGTH (arrayZ) - 1] = nullptr;

View File

@ -326,8 +326,8 @@ struct hb_sanitize_context_t :
{ {
DEBUG_MSG_FUNC (SANITIZE, start, "passed first round with %d edits; going for second round", edit_count); DEBUG_MSG_FUNC (SANITIZE, start, "passed first round with %d edits; going for second round", edit_count);
/* sanitize again to ensure no toe-stepping */ /* sanitize again to ensure no toe-stepping */
edit_count = 0; edit_count = 0;
sane = t->sanitize (this); sane = t->sanitize (this);
if (edit_count) { if (edit_count) {
DEBUG_MSG_FUNC (SANITIZE, start, "requested %d edits in second round; FAILLING", edit_count); DEBUG_MSG_FUNC (SANITIZE, start, "requested %d edits in second round; FAILLING", edit_count);
@ -338,7 +338,7 @@ struct hb_sanitize_context_t :
else else
{ {
if (edit_count && !writable) { if (edit_count && !writable) {
start = hb_blob_get_data_writable (blob, nullptr); start = hb_blob_get_data_writable (blob, nullptr);
end = start + blob->length; end = start + blob->length;
if (start) if (start)

View File

@ -63,7 +63,7 @@ struct hb_set_t
bool is_empty () const bool is_empty () const
{ {
for (unsigned int i = 0; i < len (); i++) for (unsigned int i = 0; i < len (); i++)
if (v[i]) if (v[i])
return false; return false;
return true; return true;
} }
@ -77,7 +77,7 @@ struct hb_set_t
elt_t *la = &elt (a); elt_t *la = &elt (a);
elt_t *lb = &elt (b); elt_t *lb = &elt (b);
if (la == lb) if (la == lb)
*la |= (mask (b) << 1) - mask(a); *la |= (mask (b) << 1) - mask(a);
else else
{ {
*la |= ~(mask (a) - 1); *la |= ~(mask (a) - 1);
@ -98,7 +98,7 @@ struct hb_set_t
{ {
unsigned int pop = 0; unsigned int pop = 0;
for (unsigned int i = 0; i < len (); i++) for (unsigned int i = 0; i < len (); i++)
pop += hb_popcount (v[i]); pop += hb_popcount (v[i]);
return pop; return pop;
} }
@ -149,14 +149,14 @@ struct hb_set_t
hb_codepoint_t get_min () const hb_codepoint_t get_min () const
{ {
for (unsigned int i = 0; i < len (); i++) for (unsigned int i = 0; i < len (); i++)
if (v[i]) if (v[i])
return i * ELT_BITS + elt_get_min (v[i]); return i * ELT_BITS + elt_get_min (v[i]);
return INVALID; return INVALID;
} }
hb_codepoint_t get_max () const hb_codepoint_t get_max () const
{ {
for (int i = len () - 1; i >= 0; i--) for (int i = len () - 1; i >= 0; i--)
if (v[i]) if (v[i])
return i * ELT_BITS + elt_get_max (v[i]); return i * ELT_BITS + elt_get_max (v[i]);
return 0; return 0;
} }
@ -249,7 +249,7 @@ struct hb_set_t
unsigned int count = pages.length; unsigned int count = pages.length;
for (unsigned int i = 0; i < count; i++) for (unsigned int i = 0; i < count; i++)
if (!pages[i].is_empty ()) if (!pages[i].is_empty ())
return false; return false;
return true; return true;
} }
@ -333,9 +333,9 @@ struct hb_set_t
unsigned int end = major_start (m + 1); unsigned int end = major_start (m + 1);
do do
{ {
/* If we try harder we can change the following comparison to <=; /* If we try harder we can change the following comparison to <=;
* Not sure if it's worth it. */ * Not sure if it's worth it. */
if (g < last_g) return false; if (g < last_g) return false;
last_g = g; last_g = g;
page->add (g); page->add (g);
@ -415,7 +415,7 @@ struct hb_set_t
if (other->page_at (b).is_empty ()) { b++; continue; } if (other->page_at (b).is_empty ()) { b++; continue; }
if (page_map[a].major != other->page_map[b].major || if (page_map[a].major != other->page_map[b].major ||
!page_at (a).is_equal (&other->page_at (b))) !page_at (a).is_equal (&other->page_at (b)))
return false; return false;
a++; a++;
b++; b++;
} }
@ -436,7 +436,7 @@ struct hb_set_t
hb_codepoint_t c = INVALID; hb_codepoint_t c = INVALID;
while (next (&c)) while (next (&c))
if (!larger_set->has (c)) if (!larger_set->has (c))
return false; return false;
return true; return true;
} }
@ -458,21 +458,21 @@ struct hb_set_t
{ {
if (page_map[a].major == other->page_map[b].major) if (page_map[a].major == other->page_map[b].major)
{ {
count++; count++;
a++; a++;
b++; b++;
} }
else if (page_map[a].major < other->page_map[b].major) else if (page_map[a].major < other->page_map[b].major)
{ {
if (Op::passthru_left) if (Op::passthru_left)
count++; count++;
a++; a++;
} }
else else
{ {
if (Op::passthru_right) if (Op::passthru_right)
count++; count++;
b++; b++;
} }
} }
if (Op::passthru_left) if (Op::passthru_left)
@ -482,7 +482,7 @@ struct hb_set_t
if (count > pages.length) if (count > pages.length)
if (!resize (count)) if (!resize (count))
return; return;
newCount = count; newCount = count;
/* Process in-place backward. */ /* Process in-place backward. */
@ -673,7 +673,7 @@ struct hb_set_t
unsigned int count = pages.length; unsigned int count = pages.length;
for (unsigned int i = 0; i < count; i++) for (unsigned int i = 0; i < count; i++)
if (!page_at (i).is_empty ()) if (!page_at (i).is_empty ())
return page_map[i].major * page_t::PAGE_BITS + page_at (i).get_min (); return page_map[i].major * page_t::PAGE_BITS + page_at (i).get_min ();
return INVALID; return INVALID;
} }
hb_codepoint_t get_max () const hb_codepoint_t get_max () const
@ -681,7 +681,7 @@ struct hb_set_t
unsigned int count = pages.length; unsigned int count = pages.length;
for (int i = count - 1; i >= 0; i++) for (int i = count - 1; i >= 0; i++)
if (!page_at (i).is_empty ()) if (!page_at (i).is_empty ())
return page_map[(unsigned) i].major * page_t::PAGE_BITS + page_at (i).get_max (); return page_map[(unsigned) i].major * page_t::PAGE_BITS + page_at (i).get_max ();
return INVALID; return INVALID;
} }

View File

@ -164,13 +164,13 @@ hb_shape_plan_key_t::equal (const hb_shape_plan_key_t *other)
/** /**
* hb_shape_plan_create: (Xconstructor) * hb_shape_plan_create: (Xconstructor)
* @face: * @face:
* @props: * @props:
* @user_features: (array length=num_user_features): * @user_features: (array length=num_user_features):
* @num_user_features: * @num_user_features:
* @shaper_list: (array zero-terminated=1): * @shaper_list: (array zero-terminated=1):
* *
* *
* *
* Return value: (transfer full): * Return value: (transfer full):
* *
@ -248,7 +248,7 @@ bail:
/** /**
* hb_shape_plan_get_empty: * hb_shape_plan_get_empty:
* *
* *
* *
* Return value: (transfer full): * Return value: (transfer full):
* *
@ -264,7 +264,7 @@ hb_shape_plan_get_empty ()
* hb_shape_plan_reference: (skip) * hb_shape_plan_reference: (skip)
* @shape_plan: a shape plan. * @shape_plan: a shape plan.
* *
* *
* *
* Return value: (transfer full): * Return value: (transfer full):
* *
@ -280,7 +280,7 @@ hb_shape_plan_reference (hb_shape_plan_t *shape_plan)
* hb_shape_plan_destroy: (skip) * hb_shape_plan_destroy: (skip)
* @shape_plan: a shape plan. * @shape_plan: a shape plan.
* *
* *
* *
* Since: 0.9.7 * Since: 0.9.7
**/ **/
@ -299,14 +299,14 @@ hb_shape_plan_destroy (hb_shape_plan_t *shape_plan)
/** /**
* hb_shape_plan_set_user_data: (skip) * hb_shape_plan_set_user_data: (skip)
* @shape_plan: a shape plan. * @shape_plan: a shape plan.
* @key: * @key:
* @data: * @data:
* @destroy: * @destroy:
* @replace: * @replace:
* *
*
* *
* Return value: *
* Return value:
* *
* Since: 0.9.7 * Since: 0.9.7
**/ **/
@ -323,9 +323,9 @@ hb_shape_plan_set_user_data (hb_shape_plan_t *shape_plan,
/** /**
* hb_shape_plan_get_user_data: (skip) * hb_shape_plan_get_user_data: (skip)
* @shape_plan: a shape plan. * @shape_plan: a shape plan.
* @key: * @key:
*
* *
*
* *
* Return value: (transfer none): * Return value: (transfer none):
* *
@ -342,7 +342,7 @@ hb_shape_plan_get_user_data (hb_shape_plan_t *shape_plan,
* hb_shape_plan_get_shaper: * hb_shape_plan_get_shaper:
* @shape_plan: a shape plan. * @shape_plan: a shape plan.
* *
* *
* *
* Return value: (transfer none): * Return value: (transfer none):
* *
@ -361,11 +361,11 @@ hb_shape_plan_get_shaper (hb_shape_plan_t *shape_plan)
* @font: a font. * @font: a font.
* @buffer: a buffer. * @buffer: a buffer.
* @features: (array length=num_features): * @features: (array length=num_features):
* @num_features: * @num_features:
* *
*
* *
* Return value: *
* Return value:
* *
* Since: 0.9.7 * Since: 0.9.7
**/ **/
@ -420,13 +420,13 @@ hb_shape_plan_execute (hb_shape_plan_t *shape_plan,
/** /**
* hb_shape_plan_create_cached: * hb_shape_plan_create_cached:
* @face: * @face:
* @props: * @props:
* @user_features: (array length=num_user_features): * @user_features: (array length=num_user_features):
* @num_user_features: * @num_user_features:
* @shaper_list: (array zero-terminated=1): * @shaper_list: (array zero-terminated=1):
* *
* *
* *
* Return value: (transfer full): * Return value: (transfer full):
* *
@ -481,8 +481,8 @@ retry:
for (hb_face_t::plan_node_t *node = cached_plan_nodes; node; node = node->next) for (hb_face_t::plan_node_t *node = cached_plan_nodes; node; node = node->next)
if (node->shape_plan->key.equal (&key)) if (node->shape_plan->key.equal (&key))
{ {
DEBUG_MSG_FUNC (SHAPE_PLAN, node->shape_plan, "fulfilled from cache"); DEBUG_MSG_FUNC (SHAPE_PLAN, node->shape_plan, "fulfilled from cache");
return hb_shape_plan_reference (node->shape_plan); return hb_shape_plan_reference (node->shape_plan);
} }
} }

View File

@ -330,15 +330,15 @@ struct cff2_subset_plan {
{ {
subset_localsubrs[fd].init (); subset_localsubrs[fd].init ();
offsets.localSubrsInfos[fd].init (); offsets.localSubrsInfos[fd].init ();
if (!subr_subsetter.encode_localsubrs (fd, subset_localsubrs[fd])) if (!subr_subsetter.encode_localsubrs (fd, subset_localsubrs[fd]))
return false; return false;
unsigned int dataSize = subset_localsubrs[fd].total_size (); unsigned int dataSize = subset_localsubrs[fd].total_size ();
if (dataSize > 0) if (dataSize > 0)
{ {
offsets.localSubrsInfos[fd].offset = final_size; offsets.localSubrsInfos[fd].offset = final_size;
offsets.localSubrsInfos[fd].offSize = calcOffSize (dataSize); offsets.localSubrsInfos[fd].offSize = calcOffSize (dataSize);
offsets.localSubrsInfos[fd].size = CFF2Subrs::calculate_serialized_size (offsets.localSubrsInfos[fd].offSize, subset_localsubrs[fd].length, dataSize); offsets.localSubrsInfos[fd].size = CFF2Subrs::calculate_serialized_size (offsets.localSubrsInfos[fd].offSize, subset_localsubrs[fd].length, dataSize);
} }
} }
} }

View File

@ -172,7 +172,7 @@ hb_subset_input_get_drop_hints (hb_subset_input_t *subset_input)
HB_EXTERN void HB_EXTERN void
hb_subset_input_set_desubroutinize (hb_subset_input_t *subset_input, hb_subset_input_set_desubroutinize (hb_subset_input_t *subset_input,
hb_bool_t desubroutinize) hb_bool_t desubroutinize)
{ {
subset_input->desubroutinize = desubroutinize; subset_input->desubroutinize = desubroutinize;
} }

View File

@ -58,8 +58,8 @@ _add_gid_and_children (const OT::glyf::accelerator_t &glyf,
#ifndef HB_NO_SUBSET_CFF #ifndef HB_NO_SUBSET_CFF
static inline void static inline void
_add_cff_seac_components (const OT::cff1::accelerator_t &cff, _add_cff_seac_components (const OT::cff1::accelerator_t &cff,
hb_codepoint_t gid, hb_codepoint_t gid,
hb_set_t *gids_to_retain) hb_set_t *gids_to_retain)
{ {
hb_codepoint_t base_gid, accent_gid; hb_codepoint_t base_gid, accent_gid;
if (cff.get_seac_components (gid, &base_gid, &accent_gid)) if (cff.get_seac_components (gid, &base_gid, &accent_gid))
@ -102,7 +102,7 @@ _remove_invalid_gids (hb_set_t *glyphs,
static void static void
_populate_gids_to_retain (hb_subset_plan_t* plan, _populate_gids_to_retain (hb_subset_plan_t* plan,
const hb_set_t *unicodes, const hb_set_t *unicodes,
const hb_set_t *input_glyphs_to_retain, const hb_set_t *input_glyphs_to_retain,
bool close_over_gsub) bool close_over_gsub)
{ {
OT::cmap::accelerator_t cmap; OT::cmap::accelerator_t cmap;
@ -157,11 +157,11 @@ _populate_gids_to_retain (hb_subset_plan_t* plan,
static void static void
_create_old_gid_to_new_gid_map (const hb_face_t *face, _create_old_gid_to_new_gid_map (const hb_face_t *face,
bool retain_gids, bool retain_gids,
const hb_set_t *all_gids_to_retain, const hb_set_t *all_gids_to_retain,
hb_map_t *glyph_map, /* OUT */ hb_map_t *glyph_map, /* OUT */
hb_map_t *reverse_glyph_map, /* OUT */ hb_map_t *reverse_glyph_map, /* OUT */
unsigned int *num_glyphs /* OUT */) unsigned int *num_glyphs /* OUT */)
{ {
if (!retain_gids) if (!retain_gids)
{ {
@ -191,8 +191,8 @@ _create_old_gid_to_new_gid_map (const hb_face_t *face,
} }
static void static void
_nameid_closure (hb_face_t *face, _nameid_closure (hb_face_t *face,
hb_set_t *nameids) hb_set_t *nameids)
{ {
#ifndef HB_NO_STAT #ifndef HB_NO_STAT
face->table.STAT->collect_name_ids (nameids); face->table.STAT->collect_name_ids (nameids);
@ -213,8 +213,8 @@ _nameid_closure (hb_face_t *face,
* Since: 1.7.5 * Since: 1.7.5
**/ **/
hb_subset_plan_t * hb_subset_plan_t *
hb_subset_plan_create (hb_face_t *face, hb_subset_plan_create (hb_face_t *face,
hb_subset_input_t *input) hb_subset_input_t *input)
{ {
hb_subset_plan_t *plan = hb_object_create<hb_subset_plan_t> (); hb_subset_plan_t *plan = hb_object_create<hb_subset_plan_t> ();
@ -235,16 +235,16 @@ hb_subset_plan_create (hb_face_t *face,
plan->reverse_glyph_map = hb_map_create (); plan->reverse_glyph_map = hb_map_create ();
_populate_gids_to_retain (plan, _populate_gids_to_retain (plan,
input->unicodes, input->unicodes,
input->glyphs, input->glyphs,
!input->drop_tables->has (HB_OT_TAG_GSUB)); !input->drop_tables->has (HB_OT_TAG_GSUB));
_create_old_gid_to_new_gid_map (face, _create_old_gid_to_new_gid_map (face,
input->retain_gids, input->retain_gids,
plan->_glyphset, plan->_glyphset,
plan->glyph_map, plan->glyph_map,
plan->reverse_glyph_map, plan->reverse_glyph_map,
&plan->_num_output_glyphs); &plan->_num_output_glyphs);
return plan; return plan;
} }

View File

@ -108,7 +108,7 @@ struct hb_subset_plan_t
} }
inline bool new_gid_for_codepoint (hb_codepoint_t codepoint, inline bool new_gid_for_codepoint (hb_codepoint_t codepoint,
hb_codepoint_t *new_gid) const hb_codepoint_t *new_gid) const
{ {
hb_codepoint_t old_gid = codepoint_to_glyph->get (codepoint); hb_codepoint_t old_gid = codepoint_to_glyph->get (codepoint);
if (old_gid == HB_MAP_VALUE_INVALID) if (old_gid == HB_MAP_VALUE_INVALID)
@ -118,7 +118,7 @@ struct hb_subset_plan_t
} }
inline bool new_gid_for_old_gid (hb_codepoint_t old_gid, inline bool new_gid_for_old_gid (hb_codepoint_t old_gid,
hb_codepoint_t *new_gid) const hb_codepoint_t *new_gid) const
{ {
hb_codepoint_t gid = glyph_map->get (old_gid); hb_codepoint_t gid = glyph_map->get (old_gid);
if (gid == HB_MAP_VALUE_INVALID) if (gid == HB_MAP_VALUE_INVALID)
@ -129,7 +129,7 @@ struct hb_subset_plan_t
} }
inline bool old_gid_for_new_gid (hb_codepoint_t new_gid, inline bool old_gid_for_new_gid (hb_codepoint_t new_gid,
hb_codepoint_t *old_gid) const hb_codepoint_t *old_gid) const
{ {
hb_codepoint_t gid = reverse_glyph_map->get (new_gid); hb_codepoint_t gid = reverse_glyph_map->get (new_gid);
if (gid == HB_MAP_VALUE_INVALID) if (gid == HB_MAP_VALUE_INVALID)
@ -157,7 +157,7 @@ typedef struct hb_subset_plan_t hb_subset_plan_t;
HB_INTERNAL hb_subset_plan_t * HB_INTERNAL hb_subset_plan_t *
hb_subset_plan_create (hb_face_t *face, hb_subset_plan_create (hb_face_t *face,
hb_subset_input_t *input); hb_subset_input_t *input);
HB_INTERNAL void HB_INTERNAL void
hb_subset_plan_destroy (hb_subset_plan_t *plan); hb_subset_plan_destroy (hb_subset_plan_t *plan);

View File

@ -68,7 +68,7 @@ hb_subset_input_get_drop_hints (hb_subset_input_t *subset_input);
HB_EXTERN void HB_EXTERN void
hb_subset_input_set_desubroutinize (hb_subset_input_t *subset_input, hb_subset_input_set_desubroutinize (hb_subset_input_t *subset_input,
hb_bool_t desubroutinize); hb_bool_t desubroutinize);
HB_EXTERN hb_bool_t HB_EXTERN hb_bool_t
hb_subset_input_get_desubroutinize (hb_subset_input_t *subset_input); hb_subset_input_get_desubroutinize (hb_subset_input_t *subset_input);

View File

@ -385,8 +385,8 @@ _hb_rename_font (hb_blob_t *blob, wchar_t *new_name)
static const uint16_t name_IDs[] = { 1, 2, 3, 4, 6 }; static const uint16_t name_IDs[] = { 1, 2, 3, 4, 6 };
unsigned int name_table_length = OT::name::min_size + unsigned int name_table_length = OT::name::min_size +
ARRAY_LENGTH (name_IDs) * OT::NameRecord::static_size + ARRAY_LENGTH (name_IDs) * OT::NameRecord::static_size +
name_str_len * 2; /* for name data in UTF16BE form */ name_str_len * 2; /* for name data in UTF16BE form */
unsigned int padded_name_table_length = ((name_table_length + 3) & ~3); unsigned int padded_name_table_length = ((name_table_length + 3) & ~3);
unsigned int name_table_offset = (length + 3) & ~3; unsigned int name_table_offset = (length + 3) & ~3;
@ -666,7 +666,7 @@ _hb_uniscribe_shape (hb_shape_plan_t *shape_plan,
if (event->index != last_index) if (event->index != last_index)
{ {
/* Save a snapshot of active features and the range. */ /* Save a snapshot of active features and the range. */
range_record_t *range = range_records.push (); range_record_t *range = range_records.push ();
unsigned int offset = feature_records.length; unsigned int offset = feature_records.length;
@ -701,7 +701,7 @@ _hb_uniscribe_shape (hb_shape_plan_t *shape_plan,
} }
else else
{ {
active_feature_t *feature = active_features.find (&event->feature); active_feature_t *feature = active_features.find (&event->feature);
if (feature) if (feature)
active_features.remove (feature - active_features.arrayZ); active_features.remove (feature - active_features.arrayZ);
} }

View File

@ -235,10 +235,10 @@ struct hb_utf16_xe_t
hb_codepoint_t h = text[-1]; hb_codepoint_t h = text[-1];
if (likely (hb_in_range<hb_codepoint_t> (h, 0xD800u, 0xDBFFu))) if (likely (hb_in_range<hb_codepoint_t> (h, 0xD800u, 0xDBFFu)))
{ {
/* High-surrogate in h */ /* High-surrogate in h */
*unicode = (h << 10) + c - ((0xD800u << 10) - 0x10000u + 0xDC00u); *unicode = (h << 10) + c - ((0xD800u << 10) - 0x10000u + 0xDC00u);
text--; text--;
return text; return text;
} }
} }

View File

@ -290,7 +290,7 @@ struct hb_sorted_vector_t : hb_vector_t<Type>
typedef hb_sorted_array_t< Type> iter_t; typedef hb_sorted_array_t< Type> iter_t;
const_iter_t iter () const { return as_array (); } const_iter_t iter () const { return as_array (); }
const_iter_t citer () const { return as_array (); } const_iter_t citer () const { return as_array (); }
iter_t iter () { return as_array (); } iter_t iter () { return as_array (); }
operator iter_t () { return iter (); } operator iter_t () { return iter (); }
operator const_iter_t () const { return iter (); } operator const_iter_t () const { return iter (); }

View File

@ -526,7 +526,7 @@ struct BEInt<Type, 2>
#endif #endif
#endif #endif
return (v[0] << 8) return (v[0] << 8)
+ (v[1] ); + (v[1] );
} }
private: uint8_t v[2]; private: uint8_t v[2];
}; };
@ -544,8 +544,8 @@ struct BEInt<Type, 3>
operator Type () const operator Type () const
{ {
return (v[0] << 16) return (v[0] << 16)
+ (v[1] << 8) + (v[1] << 8)
+ (v[2] ); + (v[2] );
} }
private: uint8_t v[3]; private: uint8_t v[3];
}; };
@ -564,9 +564,9 @@ struct BEInt<Type, 4>
operator Type () const operator Type () const
{ {
return (v[0] << 24) return (v[0] << 24)
+ (v[1] << 16) + (v[1] << 16)
+ (v[2] << 8) + (v[2] << 8)
+ (v[3] ); + (v[3] );
} }
private: uint8_t v[4]; private: uint8_t v[4];
}; };

View File

@ -330,8 +330,8 @@ main (int argc, char **argv)
// disabled when color font as cairo rendering of NotoColorEmoji is soooo slow // disabled when color font as cairo rendering of NotoColorEmoji is soooo slow
if (!hb_ot_color_has_layers (face) && if (!hb_ot_color_has_layers (face) &&
!hb_ot_color_has_png (face) && !hb_ot_color_has_png (face) &&
!hb_ot_color_has_svg (face)) !hb_ot_color_has_svg (face))
dump_glyphs (cairo_face, upem, num_glyphs, face_index); dump_glyphs (cairo_face, upem, num_glyphs, face_index);
hb_font_destroy (font); hb_font_destroy (font);

View File

@ -33,9 +33,9 @@ test (hb_codepoint_t cp, unsigned int bit)
if (OT::_hb_ot_os2_get_unicode_range_bit (cp) != bit) if (OT::_hb_ot_os2_get_unicode_range_bit (cp) != bit)
{ {
fprintf (stderr, "got incorrect bit (%d) for cp 0x%X. Should have been %d.", fprintf (stderr, "got incorrect bit (%d) for cp 0x%X. Should have been %d.",
OT::_hb_ot_os2_get_unicode_range_bit (cp), OT::_hb_ot_os2_get_unicode_range_bit (cp),
cp, cp,
bit); bit);
abort(); abort();
} }
} }

View File

@ -76,7 +76,7 @@ hb_subset_test_create_input_from_nameids (const hb_set_t *name_ids)
static inline hb_face_t * static inline hb_face_t *
hb_subset_test_create_subset (hb_face_t *source, hb_subset_test_create_subset (hb_face_t *source,
hb_subset_input_t *input) hb_subset_input_t *input)
{ {
hb_face_t *subset = hb_subset (source, input); hb_face_t *subset = hb_subset (source, input);
g_assert (subset); g_assert (subset);
@ -87,8 +87,8 @@ hb_subset_test_create_subset (hb_face_t *source,
static inline void static inline void
hb_subset_test_check (hb_face_t *expected, hb_subset_test_check (hb_face_t *expected,
hb_face_t *actual, hb_face_t *actual,
hb_tag_t table) hb_tag_t table)
{ {
hb_blob_t *expected_blob, *actual_blob; hb_blob_t *expected_blob, *actual_blob;
expected_blob = hb_face_reference_table (expected, table); expected_blob = hb_face_reference_table (expected, table);

View File

@ -208,7 +208,7 @@ test_buffer_contents (fixture_t *fixture, gconstpointer user_data)
if (buffer_type == BUFFER_UTF16) if (buffer_type == BUFFER_UTF16)
cluster++; cluster++;
else if (buffer_type == BUFFER_UTF8) else if (buffer_type == BUFFER_UTF8)
cluster += 3; cluster += 3;
} }
g_assert_cmphex (glyphs[i].codepoint, ==, utf32[1+i]); g_assert_cmphex (glyphs[i].codepoint, ==, utf32[1+i]);
g_assert_cmphex (glyphs[i].cluster, ==, cluster); g_assert_cmphex (glyphs[i].cluster, ==, cluster);

View File

@ -345,7 +345,7 @@ test_object (void)
if (!obj) if (!obj)
continue; continue;
if (obj == o->get_empty ()) if (obj == o->get_empty ())
continue; /* Tested already */ continue; /* Tested already */
g_assert (obj == o->reference (obj)); g_assert (obj == o->reference (obj));
o->destroy (obj); o->destroy (obj);

View File

@ -457,41 +457,41 @@ test_get_glyph_variants (void)
g_assert(hb_font_get_glyph_from_name (hb_font, "arrowleft", -1, &glyph)); g_assert(hb_font_get_glyph_from_name (hb_font, "arrowleft", -1, &glyph));
g_assert_cmpint(hb_ot_math_get_glyph_variants (hb_font, g_assert_cmpint(hb_ot_math_get_glyph_variants (hb_font,
glyph, glyph,
HB_DIRECTION_BTT, HB_DIRECTION_BTT,
0, 0,
NULL, NULL,
NULL), ==, 0); NULL), ==, 0);
g_assert_cmpint(hb_ot_math_get_glyph_variants (hb_font, g_assert_cmpint(hb_ot_math_get_glyph_variants (hb_font,
glyph, glyph,
HB_DIRECTION_RTL, HB_DIRECTION_RTL,
0, 0,
NULL, NULL,
NULL), ==, 3); NULL), ==, 3);
g_assert(hb_font_get_glyph_from_name (hb_font, "arrowup", -1, &glyph)); g_assert(hb_font_get_glyph_from_name (hb_font, "arrowup", -1, &glyph));
g_assert_cmpint(hb_ot_math_get_glyph_variants (hb_font, g_assert_cmpint(hb_ot_math_get_glyph_variants (hb_font,
glyph, glyph,
HB_DIRECTION_BTT, HB_DIRECTION_BTT,
0, 0,
NULL, NULL,
NULL), ==, 4); NULL), ==, 4);
g_assert_cmpint(hb_ot_math_get_glyph_variants (hb_font, g_assert_cmpint(hb_ot_math_get_glyph_variants (hb_font,
glyph, glyph,
HB_DIRECTION_RTL, HB_DIRECTION_RTL,
0, 0,
NULL, NULL,
NULL), ==, 0); NULL), ==, 0);
g_assert(hb_font_get_glyph_from_name (hb_font, "arrowleft", -1, &glyph)); g_assert(hb_font_get_glyph_from_name (hb_font, "arrowleft", -1, &glyph));
do { do {
count = variantsSize; count = variantsSize;
hb_ot_math_get_glyph_variants (hb_font, hb_ot_math_get_glyph_variants (hb_font,
glyph, glyph,
HB_DIRECTION_RTL, HB_DIRECTION_RTL,
offset, offset,
&count, &count,
variants); variants);
offset += count; offset += count;
} while (count == variantsSize); } while (count == variantsSize);
g_assert_cmpint(offset, ==, 3); g_assert_cmpint(offset, ==, 3);
@ -510,11 +510,11 @@ test_get_glyph_variants (void)
do { do {
count = variantsSize; count = variantsSize;
hb_ot_math_get_glyph_variants (hb_font, hb_ot_math_get_glyph_variants (hb_font,
glyph, glyph,
HB_DIRECTION_BTT, HB_DIRECTION_BTT,
offset, offset,
&count, &count,
variants); variants);
offset += count; offset += count;
} while (count == variantsSize); } while (count == variantsSize);
g_assert_cmpint(offset, ==, 4); g_assert_cmpint(offset, ==, 4);
@ -581,46 +581,46 @@ test_get_glyph_assembly (void)
g_assert(hb_font_get_glyph_from_name (hb_font, "arrowright", -1, &glyph)); g_assert(hb_font_get_glyph_from_name (hb_font, "arrowright", -1, &glyph));
g_assert_cmpint(hb_ot_math_get_glyph_assembly (hb_font, g_assert_cmpint(hb_ot_math_get_glyph_assembly (hb_font,
glyph, glyph,
HB_DIRECTION_BTT, HB_DIRECTION_BTT,
0, 0,
NULL, NULL,
NULL, NULL,
NULL), ==, 0); NULL), ==, 0);
g_assert_cmpint(hb_ot_math_get_glyph_assembly (hb_font, g_assert_cmpint(hb_ot_math_get_glyph_assembly (hb_font,
glyph, glyph,
HB_DIRECTION_RTL, HB_DIRECTION_RTL,
0, 0,
NULL, NULL,
NULL, NULL,
NULL), ==, 3); NULL), ==, 3);
g_assert(hb_font_get_glyph_from_name (hb_font, "arrowdown", -1, &glyph)); g_assert(hb_font_get_glyph_from_name (hb_font, "arrowdown", -1, &glyph));
g_assert_cmpint(hb_ot_math_get_glyph_assembly (hb_font, g_assert_cmpint(hb_ot_math_get_glyph_assembly (hb_font,
glyph, glyph,
HB_DIRECTION_BTT, HB_DIRECTION_BTT,
0, 0,
NULL, NULL,
NULL, NULL,
NULL), ==, 5); NULL), ==, 5);
g_assert_cmpint(hb_ot_math_get_glyph_assembly (hb_font, g_assert_cmpint(hb_ot_math_get_glyph_assembly (hb_font,
glyph, glyph,
HB_DIRECTION_RTL, HB_DIRECTION_RTL,
0, 0,
NULL, NULL,
NULL, NULL,
NULL), ==, 0); NULL), ==, 0);
g_assert(hb_font_get_glyph_from_name (hb_font, "arrowright", -1, &glyph)); g_assert(hb_font_get_glyph_from_name (hb_font, "arrowright", -1, &glyph));
do { do {
count = partsSize; count = partsSize;
hb_ot_math_get_glyph_assembly (hb_font, hb_ot_math_get_glyph_assembly (hb_font,
glyph, glyph,
HB_DIRECTION_RTL, HB_DIRECTION_RTL,
offset, offset,
&count, &count,
parts, parts,
NULL); NULL);
offset += count; offset += count;
} while (count == partsSize); } while (count == partsSize);
g_assert_cmpint(offset, ==, 3); g_assert_cmpint(offset, ==, 3);
@ -648,12 +648,12 @@ test_get_glyph_assembly (void)
do { do {
count = partsSize; count = partsSize;
hb_ot_math_get_glyph_assembly (hb_font, hb_ot_math_get_glyph_assembly (hb_font,
glyph, glyph,
HB_DIRECTION_BTT, HB_DIRECTION_BTT,
offset, offset,
&count, &count,
parts, parts,
NULL); NULL);
offset += count; offset += count;
} while (count == partsSize); } while (count == partsSize);
g_assert_cmpint(offset, ==, 5); g_assert_cmpint(offset, ==, 5);

View File

@ -62,8 +62,8 @@ static void free_up (void *p)
static hb_script_t static hb_script_t
simple_get_script (hb_unicode_funcs_t *ufuncs, simple_get_script (hb_unicode_funcs_t *ufuncs,
hb_codepoint_t codepoint, hb_codepoint_t codepoint,
void *user_data) void *user_data)
{ {
data_t *data = (data_t *) user_data; data_t *data = (data_t *) user_data;
@ -79,8 +79,8 @@ simple_get_script (hb_unicode_funcs_t *ufuncs,
static hb_script_t static hb_script_t
a_is_for_arabic_get_script (hb_unicode_funcs_t *ufuncs, a_is_for_arabic_get_script (hb_unicode_funcs_t *ufuncs,
hb_codepoint_t codepoint, hb_codepoint_t codepoint,
void *user_data) void *user_data)
{ {
data_t *data = (data_t *) user_data; data_t *data = (data_t *) user_data;
@ -751,7 +751,7 @@ test_unicode_subclassing_nil (data_fixture_t *f, gconstpointer user_data HB_UNUS
hb_unicode_funcs_destroy (uf); hb_unicode_funcs_destroy (uf);
hb_unicode_funcs_set_script_func (aa, a_is_for_arabic_get_script, hb_unicode_funcs_set_script_func (aa, a_is_for_arabic_get_script,
&f->data[1], free_up); &f->data[1], free_up);
g_assert_cmphex (hb_unicode_script (aa, 'a'), ==, HB_SCRIPT_ARABIC); g_assert_cmphex (hb_unicode_script (aa, 'a'), ==, HB_SCRIPT_ARABIC);
g_assert_cmphex (hb_unicode_script (aa, 'b'), ==, HB_SCRIPT_UNKNOWN); g_assert_cmphex (hb_unicode_script (aa, 'b'), ==, HB_SCRIPT_UNKNOWN);
@ -770,7 +770,7 @@ test_unicode_subclassing_default (data_fixture_t *f, gconstpointer user_data HB_
aa = hb_unicode_funcs_create (uf); aa = hb_unicode_funcs_create (uf);
hb_unicode_funcs_set_script_func (aa, a_is_for_arabic_get_script, hb_unicode_funcs_set_script_func (aa, a_is_for_arabic_get_script,
&f->data[1], free_up); &f->data[1], free_up);
g_assert_cmphex (hb_unicode_script (aa, 'a'), ==, HB_SCRIPT_ARABIC); g_assert_cmphex (hb_unicode_script (aa, 'a'), ==, HB_SCRIPT_ARABIC);
g_assert_cmphex (hb_unicode_script (aa, 'b'), ==, HB_SCRIPT_LATIN); g_assert_cmphex (hb_unicode_script (aa, 'b'), ==, HB_SCRIPT_LATIN);
@ -788,7 +788,7 @@ test_unicode_subclassing_deep (data_fixture_t *f, gconstpointer user_data HB_UNU
uf = hb_unicode_funcs_create (NULL); uf = hb_unicode_funcs_create (NULL);
hb_unicode_funcs_set_script_func (uf, simple_get_script, hb_unicode_funcs_set_script_func (uf, simple_get_script,
&f->data[0], free_up); &f->data[0], free_up);
aa = hb_unicode_funcs_create (uf); aa = hb_unicode_funcs_create (uf);
@ -798,7 +798,7 @@ test_unicode_subclassing_deep (data_fixture_t *f, gconstpointer user_data HB_UNU
g_assert (!f->data[0].freed); g_assert (!f->data[0].freed);
hb_unicode_funcs_set_script_func (aa, a_is_for_arabic_get_script, hb_unicode_funcs_set_script_func (aa, a_is_for_arabic_get_script,
&f->data[1], free_up); &f->data[1], free_up);
g_assert_cmphex (hb_unicode_script (aa, 'a'), ==, HB_SCRIPT_ARABIC); g_assert_cmphex (hb_unicode_script (aa, 'a'), ==, HB_SCRIPT_ARABIC);
g_assert_cmphex (hb_unicode_script (aa, 'b'), ==, HB_SCRIPT_LATIN); g_assert_cmphex (hb_unicode_script (aa, 'b'), ==, HB_SCRIPT_LATIN);

View File

@ -133,7 +133,7 @@ struct image_t
for (unsigned int col = 0; col < w; col++) for (unsigned int col = 0; col < w; col++)
*q++ = *p++; *q++ = *p++;
else { else {
unsigned int limit = width - x; unsigned int limit = width - x;
for (unsigned int col = 0; col < limit; col++) for (unsigned int col = 0; col < limit; col++)
*q++ = *p++; *q++ = *p++;
p--; p--;
@ -171,17 +171,17 @@ struct biimage_t
int freq[8] = {0}; int freq[8] = {0};
for (unsigned int y = 0; y < height; y++) for (unsigned int y = 0; y < height; y++)
for (unsigned int x = 0; x < width; x++) { for (unsigned int x = 0; x < width; x++) {
color_t c = image (x, y); color_t c = image (x, y);
freq[c.to_ansi ()]++; freq[c.to_ansi ()]++;
} }
bg = 0; bg = 0;
for (unsigned int i = 1; i < 8; i++) for (unsigned int i = 1; i < 8; i++)
if (freq[bg] < freq[i]) if (freq[bg] < freq[i])
bg = i; bg = i;
fg = 0; fg = 0;
for (unsigned int i = 1; i < 8; i++) for (unsigned int i = 1; i < 8; i++)
if (i != bg && freq[fg] < freq[i]) if (i != bg && freq[fg] < freq[i])
fg = i; fg = i;
if (fg == bg || freq[fg] == 0) { if (fg == bg || freq[fg] == 0) {
fg = bg; fg = bg;
unicolor = true; unicolor = true;
@ -202,7 +202,7 @@ struct biimage_t
int dd = diff.dot (diff); int dd = diff.dot (diff);
for (unsigned int y = 0; y < height; y++) for (unsigned int y = 0; y < height; y++)
for (unsigned int x = 0; x < width; x++) { for (unsigned int x = 0; x < width; x++) {
int d = diff.dot (image (x, y).diff (bgc)); int d = diff.dot (image (x, y).diff (bgc));
(*this)(x, y) = d < 0 ? 0 : d > dd ? 255 : lround (d * 255. / dd); (*this)(x, y) = d < 0 ? 0 : d > dd ? 255 : lround (d * 255. / dd);
} }
} }
@ -287,13 +287,13 @@ block_best (const biimage_t &bi, bool *inverse)
unsigned int s; unsigned int s;
s = row_sum[i] + total_i - row_sum_i[i]; s = row_sum[i] + total_i - row_sum_i[i];
if (s < best_s) { if (s < best_s) {
best_s = s; best_s = s;
best_i = i; best_i = i;
best_inv = false; best_inv = false;
} }
s = row_sum_i[i] + total - row_sum[i]; s = row_sum_i[i] + total - row_sum[i];
if (s < best_s) { if (s < best_s) {
best_s = s; best_s = s;
best_i = i; best_i = i;
best_inv = true; best_inv = true;
} }
@ -319,13 +319,13 @@ block_best (const biimage_t &bi, bool *inverse)
unsigned int s; unsigned int s;
s = col_sum[i] + total_i - col_sum_i[i]; s = col_sum[i] + total_i - col_sum_i[i];
if (s < best_s) { if (s < best_s) {
best_s = s; best_s = s;
best_i = i; best_i = i;
best_inv = true; best_inv = true;
} }
s = col_sum_i[i] + total - col_sum[i]; s = col_sum_i[i] + total - col_sum[i];
if (s < best_s) { if (s < best_s) {
best_s = s; best_s = s;
best_i = i; best_i = i;
best_inv = false; best_inv = false;
} }
@ -396,15 +396,15 @@ ansi_print_image_rgb24 (const uint32_t *data,
image.copy_sub_image (cell, col * CELL_W, row * CELL_H, CELL_W, CELL_H); image.copy_sub_image (cell, col * CELL_W, row * CELL_H, CELL_W, CELL_H);
bi.set (cell); bi.set (cell);
if (bi.unicolor) { if (bi.unicolor) {
if (last_bg != bi.bg) { if (last_bg != bi.bg) {
printf ("%c[%dm", ESC_E, 40 + bi.bg); printf ("%c[%dm", ESC_E, 40 + bi.bg);
last_bg = bi.bg; last_bg = bi.bg;
} }
printf (" "); printf (" ");
} else { } else {
/* Figure out the closest character to the biimage */ /* Figure out the closest character to the biimage */
bool inverse = false; bool inverse = false;
const char *c = block_best (bi, &inverse); const char *c = block_best (bi, &inverse);
if (inverse) { if (inverse) {
if (last_bg != bi.fg || last_fg != bi.bg) { if (last_bg != bi.fg || last_fg != bi.bg) {
printf ("%c[%d;%dm", ESC_E, 30 + bi.bg, 40 + bi.fg); printf ("%c[%d;%dm", ESC_E, 30 + bi.bg, 40 + bi.fg);

View File

@ -171,7 +171,7 @@ main (int argc, char **argv)
os = FcObjectSetBuild (FC_FAMILY, FC_STYLE, FC_FILE, (char *) 0); os = FcObjectSetBuild (FC_FAMILY, FC_STYLE, FC_FILE, (char *) 0);
FcObjectSetAdd (os, FC_CHARSET); FcObjectSetAdd (os, FC_CHARSET);
if (!format) if (!format)
format = (const FcChar8 *) "%{=fclist}\n"; format = (const FcChar8 *) "%{=fclist}\n";
fs = FcFontList (0, pat, os); fs = FcFontList (0, pat, os);
if (os) if (os)
FcObjectSetDestroy (os); FcObjectSetDestroy (os);

View File

@ -55,9 +55,9 @@ hb_fc_get_glyph (hb_font_t *font /*HB_UNUSED*/,
{ {
unsigned int var_num = 0; unsigned int var_num = 0;
if (variation_selector - 0xFE00u < 16) if (variation_selector - 0xFE00u < 16)
var_num = variation_selector - 0xFE00 + 1; var_num = variation_selector - 0xFE00 + 1;
else if (variation_selector - 0xE0100u < (256 - 16)) else if (variation_selector - 0xE0100u < (256 - 16))
var_num = variation_selector - 0xE0100 + 17; var_num = variation_selector - 0xE0100 + 17;
*glyph = (var_num << 21) | unicode; *glyph = (var_num << 21) | unicode;
} }
else else

View File

@ -181,7 +181,7 @@ main (int argc, char **argv)
fflush (stdout); fflush (stdout);
if (ret) if (ret)
break; break;
} }
return ret; return ret;
} }

View File

@ -40,16 +40,16 @@ struct subset_consumer_t
: failed (false), options (parser), subset_options (parser), font (nullptr), input (nullptr) {} : failed (false), options (parser), subset_options (parser), font (nullptr), input (nullptr) {}
void init (hb_buffer_t *buffer_, void init (hb_buffer_t *buffer_,
const font_options_t *font_opts) const font_options_t *font_opts)
{ {
font = hb_font_reference (font_opts->get_font ()); font = hb_font_reference (font_opts->get_font ());
input = hb_subset_input_reference (subset_options.input); input = hb_subset_input_reference (subset_options.input);
} }
void consume_line (const char *text, void consume_line (const char *text,
unsigned int text_len, unsigned int text_len,
const char *text_before, const char *text_before,
const char *text_after) const char *text_after)
{ {
// TODO(Q1) does this only get called with at least 1 codepoint? // TODO(Q1) does this only get called with at least 1 codepoint?
hb_set_t *codepoints = hb_subset_input_unicode_set (input); hb_set_t *codepoints = hb_subset_input_unicode_set (input);
@ -88,7 +88,7 @@ struct subset_consumer_t
} }
if ((unsigned int) bytes_written != data_length) { if ((unsigned int) bytes_written != data_length) {
fprintf(stderr, "Expected %u bytes written, got %d\n", data_length, fprintf(stderr, "Expected %u bytes written, got %d\n", data_length,
bytes_written); bytes_written);
return false; return false;
} }
return true; return true;

View File

@ -71,7 +71,7 @@ helper_cairo_surface_write_to_ansi_stream (cairo_surface_t *surface,
unsigned int i; unsigned int i;
for (i = 0; i < width; i++) for (i = 0; i < width; i++)
if (data[i] != bg_color) if (data[i] != bg_color)
break; break;
if (i < width) if (i < width)
break; break;
data += stride / 4; data += stride / 4;
@ -86,7 +86,7 @@ helper_cairo_surface_write_to_ansi_stream (cairo_surface_t *surface,
unsigned int i; unsigned int i;
for (i = 0; i < width; i++) for (i = 0; i < width; i++)
if (row[i] != bg_color) if (row[i] != bg_color)
break; break;
if (i < width) if (i < width)
break; break;
height--; height--;

View File

@ -97,7 +97,7 @@ helper_cairo_create_scaled_font (const font_options_t *font_opts)
if (FT_New_Memory_Face (ft_library, if (FT_New_Memory_Face (ft_library,
(const FT_Byte *) blob_data, (const FT_Byte *) blob_data,
blob_length, blob_length,
font_opts->face_index, font_opts->face_index,
&ft_face)) &ft_face))
fail (false, "FT_New_Memory_Face fail"); fail (false, "FT_New_Memory_Face fail");

View File

@ -30,9 +30,9 @@
static gboolean static gboolean
parse_nameids (const char *name, parse_nameids (const char *name,
const char *arg, const char *arg,
gpointer data, gpointer data,
GError **error G_GNUC_UNUSED) GError **error G_GNUC_UNUSED)
{ {
subset_options_t *subset_opts = (subset_options_t *) data; subset_options_t *subset_opts = (subset_options_t *) data;
hb_set_t *name_ids = subset_opts->input->name_ids; hb_set_t *name_ids = subset_opts->input->name_ids;
@ -46,7 +46,7 @@ parse_nameids (const char *name,
{ {
if (last_name_char == '-') if (last_name_char == '-')
hb_set_del_range (name_ids, 0, 0x7FFF); hb_set_del_range (name_ids, 0, 0x7FFF);
else else
hb_set_add_range (name_ids, 0, 0x7FFF); hb_set_add_range (name_ids, 0, 0x7FFF);
return true; return true;
} }
@ -67,7 +67,7 @@ parse_nameids (const char *name,
{ {
hb_set_destroy (name_ids); hb_set_destroy (name_ids);
g_set_error (error, G_OPTION_ERROR, G_OPTION_ERROR_BAD_VALUE, g_set_error (error, G_OPTION_ERROR, G_OPTION_ERROR_BAD_VALUE,
"Failed parsing nameID values at: '%s'", s); "Failed parsing nameID values at: '%s'", s);
return false; return false;
} }
@ -86,9 +86,9 @@ parse_nameids (const char *name,
static gboolean static gboolean
parse_drop_tables (const char *name, parse_drop_tables (const char *name,
const char *arg, const char *arg,
gpointer data, gpointer data,
GError **error G_GNUC_UNUSED) GError **error G_GNUC_UNUSED)
{ {
subset_options_t *subset_opts = (subset_options_t *) data; subset_options_t *subset_opts = (subset_options_t *) data;
hb_set_t *drop_tables = subset_opts->input->drop_tables; hb_set_t *drop_tables = subset_opts->input->drop_tables;
@ -104,7 +104,7 @@ parse_drop_tables (const char *name,
if (strlen (s) > 4) // Table tags are at most 4 bytes. if (strlen (s) > 4) // Table tags are at most 4 bytes.
{ {
g_set_error (error, G_OPTION_ERROR, G_OPTION_ERROR_BAD_VALUE, g_set_error (error, G_OPTION_ERROR, G_OPTION_ERROR_BAD_VALUE,
"Failed parsing table tag values at: '%s'", s); "Failed parsing table tag values at: '%s'", s);
return false; return false;
} }
@ -137,8 +137,8 @@ subset_options_t::add_options (option_parser_t *parser)
{nullptr} {nullptr}
}; };
parser->add_group (entries, parser->add_group (entries,
"subset", "subset",
"Subset options:", "Subset options:",
"Options subsetting", "Options subsetting",
this); this);
} }

View File

@ -196,8 +196,8 @@ parse_shapers (const char *name G_GNUC_UNUSED,
bool found = false; bool found = false;
for (const char **hb_shaper = hb_shape_list_shapers (); *hb_shaper; hb_shaper++) { for (const char **hb_shaper = hb_shape_list_shapers (); *hb_shaper; hb_shaper++) {
if (strcmp (*shaper, *hb_shaper) == 0) { if (strcmp (*shaper, *hb_shaper) == 0) {
found = true; found = true;
break; break;
} }
} }
if (!found) { if (!found) {
@ -228,9 +228,9 @@ list_shapers (const char *name G_GNUC_UNUSED,
static gboolean static gboolean
parse_features (const char *name G_GNUC_UNUSED, parse_features (const char *name G_GNUC_UNUSED,
const char *arg, const char *arg,
gpointer data, gpointer data,
GError **error G_GNUC_UNUSED) GError **error G_GNUC_UNUSED)
{ {
shape_options_t *shape_opts = (shape_options_t *) data; shape_options_t *shape_opts = (shape_options_t *) data;
char *s = (char *) arg; char *s = (char *) arg;
@ -271,9 +271,9 @@ parse_features (const char *name G_GNUC_UNUSED,
static gboolean static gboolean
parse_variations (const char *name G_GNUC_UNUSED, parse_variations (const char *name G_GNUC_UNUSED,
const char *arg, const char *arg,
gpointer data, gpointer data,
GError **error G_GNUC_UNUSED) GError **error G_GNUC_UNUSED)
{ {
font_options_t *font_opts = (font_options_t *) data; font_options_t *font_opts = (font_options_t *) data;
char *s = (char *) arg; char *s = (char *) arg;
@ -335,9 +335,9 @@ parse_text (const char *name G_GNUC_UNUSED,
static gboolean static gboolean
parse_unicodes (const char *name G_GNUC_UNUSED, parse_unicodes (const char *name G_GNUC_UNUSED,
const char *arg, const char *arg,
gpointer data, gpointer data,
GError **error G_GNUC_UNUSED) GError **error G_GNUC_UNUSED)
{ {
text_options_t *text_opts = (text_options_t *) data; text_options_t *text_opts = (text_options_t *) data;
@ -349,7 +349,7 @@ parse_unicodes (const char *name G_GNUC_UNUSED,
} }
GString *gs = g_string_new (nullptr); GString *gs = g_string_new (nullptr);
if (0 == strcmp (arg, "*")) if (0 == strcmp (arg, "*"))
{ {
g_string_append_c (gs, '*'); g_string_append_c (gs, '*');
} }
@ -358,26 +358,26 @@ parse_unicodes (const char *name G_GNUC_UNUSED,
char *s = (char *) arg; char *s = (char *) arg;
char *p; char *p;
while (s && *s) while (s && *s)
{ {
while (*s && strchr (DELIMITERS, *s)) while (*s && strchr (DELIMITERS, *s))
s++; s++;
if (!*s) if (!*s)
break; break;
errno = 0; errno = 0;
hb_codepoint_t u = strtoul (s, &p, 16); hb_codepoint_t u = strtoul (s, &p, 16);
if (errno || s == p) if (errno || s == p)
{ {
g_string_free (gs, TRUE); g_string_free (gs, TRUE);
g_set_error (error, G_OPTION_ERROR, G_OPTION_ERROR_BAD_VALUE, g_set_error (error, G_OPTION_ERROR, G_OPTION_ERROR_BAD_VALUE,
"Failed parsing Unicode values at: '%s'", s); "Failed parsing Unicode values at: '%s'", s);
return false; return false;
} }
g_string_append_unichar (gs, u); g_string_append_unichar (gs, u);
s = p; s = p;
} }
} }
@ -716,7 +716,7 @@ font_options_t::get_font () const
GString *s = g_string_new (nullptr); GString *s = g_string_new (nullptr);
for (unsigned int i = 0; i < ARRAY_LENGTH (supported_font_funcs); i++) for (unsigned int i = 0; i < ARRAY_LENGTH (supported_font_funcs); i++)
{ {
if (i) if (i)
g_string_append_c (s, '/'); g_string_append_c (s, '/');
g_string_append (s, supported_font_funcs[i].name); g_string_append (s, supported_font_funcs[i].name);
} }
@ -877,9 +877,9 @@ format_options_t::add_options (option_parser_t *parser)
parser->add_group (entries, parser->add_group (entries,
"output-syntax", "output-syntax",
"Output syntax:\n" "Output syntax:\n"
" text: [<glyph name or index>=<glyph cluster index within input>@<horizontal displacement>,<vertical displacement>+<horizontal advance>,<vertical advance>|...]\n" " text: [<glyph name or index>=<glyph cluster index within input>@<horizontal displacement>,<vertical displacement>+<horizontal advance>,<vertical advance>|...]\n"
" json: [{\"g\": <glyph name or index>, \"ax\": <horizontal advance>, \"ay\": <vertical advance>, \"dx\": <horizontal displacement>, \"dy\": <vertical displacement>, \"cl\": <glyph cluster index within input>}, ...]\n" " json: [{\"g\": <glyph name or index>, \"ax\": <horizontal advance>, \"ay\": <vertical advance>, \"dx\": <horizontal displacement>, \"dy\": <vertical displacement>, \"cl\": <glyph cluster index within input>}, ...]\n"
"\nOutput syntax options:", "\nOutput syntax options:",
"Options for the syntax of the output", "Options for the syntax of the output",
this); this);
} }

View File

@ -242,7 +242,7 @@ struct shape_options_t : option_group_t
if (!hb_shape_full (font, buffer, features, num_features, shapers)) if (!hb_shape_full (font, buffer, features, num_features, shapers))
{ {
if (error) if (error)
*error = "all shapers failed."; *error = "all shapers failed.";
goto fail; goto fail;
} }
@ -341,7 +341,7 @@ struct shape_options_t : option_group_t
/* Shape segment corresponding to glyphs start..end. */ /* Shape segment corresponding to glyphs start..end. */
if (end == num_glyphs) if (end == num_glyphs)
{ {
if (forward) if (forward)
text_end = num_chars; text_end = num_chars;
else else
text_start = 0; text_start = 0;
@ -372,9 +372,9 @@ struct shape_options_t : option_group_t
/* TODO: Add pre/post context text. */ /* TODO: Add pre/post context text. */
hb_buffer_flags_t flags = hb_buffer_get_flags (fragment); hb_buffer_flags_t flags = hb_buffer_get_flags (fragment);
if (0 < text_start) if (0 < text_start)
flags = (hb_buffer_flags_t) (flags & ~HB_BUFFER_FLAG_BOT); flags = (hb_buffer_flags_t) (flags & ~HB_BUFFER_FLAG_BOT);
if (text_end < num_chars) if (text_end < num_chars)
flags = (hb_buffer_flags_t) (flags & ~HB_BUFFER_FLAG_EOT); flags = (hb_buffer_flags_t) (flags & ~HB_BUFFER_FLAG_EOT);
hb_buffer_set_flags (fragment, flags); hb_buffer_set_flags (fragment, flags);
hb_buffer_append (fragment, text_buffer, text_start, text_end); hb_buffer_append (fragment, text_buffer, text_start, text_end);