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

View File

@ -226,7 +226,7 @@ struct ContextualSubtable
hb_buffer_t *buffer = driver->buffer;
if (buffer->idx == buffer->len && !mark_set)
return false;
return false;
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
* end-of-text if mark was not explicitly set. */
if (buffer->idx == buffer->len && !mark_set)
return;
return;
const GlyphID *replacement;
@ -488,7 +488,7 @@ struct LigatureSubtable
unsigned int ligature_idx = 0;
unsigned int action;
do
do
{
if (unlikely (!cursor))
{
@ -976,12 +976,12 @@ struct Chain
bool reverse;
if (!(subtable->subFeatureFlags & flags))
goto skip;
goto skip;
if (!(subtable->get_coverage() & ChainSubtable<Types>::AllDirections) &&
HB_DIRECTION_IS_VERTICAL (c->buffer->props.direction) !=
bool (subtable->get_coverage() & ChainSubtable<Types>::Vertical))
goto skip;
goto skip;
/* Buffer contents is always in logical direction. Determine if
* we need to reverse before applying this subtable. We reverse
@ -1016,15 +1016,15 @@ struct Chain
HB_DIRECTION_IS_BACKWARD (c->buffer->props.direction);
if (!c->buffer->message (c->font, "start chain subtable %d", c->lookup_index))
goto skip;
goto skip;
if (reverse)
c->buffer->reverse ();
c->buffer->reverse ();
subtable->apply (c);
if (reverse)
c->buffer->reverse ();
c->buffer->reverse ();
(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;
for (size_index = 0; size_index < sizes - 1; size_index++)
if (size_table[size_index].to_float () >= ptem)
break;
break;
return roundf (interpolate_at (size_index ? size_index - 1 : 0, ptem,
*trackTableEntry, base));
@ -176,7 +176,7 @@ struct trak
hb_position_t advance_to_add = c->font->em_scalef_x (tracking);
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_offset += offset_to_add;
}
@ -189,7 +189,7 @@ struct trak
hb_position_t advance_to_add = c->font->em_scalef_y (tracking);
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_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 c = array[mid].cmp (x);
if (c < 0)
max = mid - 1;
max = mid - 1;
else if (c > 0)
min = mid + 1;
min = mid + 1;
else
{
if (i)

View File

@ -592,7 +592,7 @@ fail_without_close:
ceparams.lpSecurityAttributes = nullptr;
ceparams.hTemplateFile = nullptr;
fd = CreateFile2 (wchar_file_name, GENERIC_READ, FILE_SHARE_READ,
OPEN_EXISTING, &ceparams);
OPEN_EXISTING, &ceparams);
}
#else
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,
(hb_destroy_func_t) free);
(hb_destroy_func_t) free);
fread_fail:
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));
*p++ = '"';
for (char *q = g; *q; q++) {
if (*q == '"')
if (*q == '"')
*p++ = '\\';
*p++ = *q;
}

View File

@ -648,8 +648,8 @@ hb_buffer_t::guess_segment_properties ()
if (likely (script != HB_SCRIPT_COMMON &&
script != HB_SCRIPT_INHERITED &&
script != HB_SCRIPT_UNKNOWN)) {
props.script = script;
break;
props.script = script;
break;
}
}
}
@ -1388,7 +1388,7 @@ hb_buffer_get_length (hb_buffer_t *buffer)
**/
hb_glyph_info_t *
hb_buffer_get_glyph_infos (hb_buffer_t *buffer,
unsigned int *length)
unsigned int *length)
{
if (length)
*length = buffer->len;
@ -1412,7 +1412,7 @@ hb_buffer_get_glyph_infos (hb_buffer_t *buffer,
**/
hb_glyph_position_t *
hb_buffer_get_glyph_positions (hb_buffer_t *buffer,
unsigned int *length)
unsigned int *length)
{
if (!buffer->have_positions)
buffer->clear_positions ();
@ -1936,9 +1936,9 @@ hb_buffer_diff (hb_buffer_t *buffer,
for (i = 0; i < count; i++)
{
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)
result |= HB_BUFFER_DIFF_FLAG_NOTDEF_PRESENT;
result |= HB_BUFFER_DIFF_FLAG_NOTDEF_PRESENT;
}
result |= HB_BUFFER_DIFF_FLAG_LENGTH_MISMATCH;
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++)
{
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->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_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->y_offset - ref_pos->y_offset) > position_fuzz)
{
result |= HB_BUFFER_DIFF_FLAG_POSITION_MISMATCH;
break;
result |= HB_BUFFER_DIFF_FLAG_POSITION_MISMATCH;
break;
}
buf_pos++;
ref_pos++;

View File

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

View File

@ -67,7 +67,7 @@ _hb_options_init ()
{
const char *p = strchr (c, ':');
if (!p)
p = c + strlen (c);
p = c + strlen (c);
#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)
@ -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_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.
* If there was an equal-sign, then there *must* be a value.
* 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)
{
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);
}
@ -233,21 +233,21 @@ create_ct_font (CGFontRef cg_font, CGFloat font_size)
atsFont = CTFontGetPlatformFont (new_ct_font, NULL);
status = ATSFontGetFileReference (atsFont, &fsref);
if (status == noErr)
new_url = CFURLCreateFromFSRef (NULL, &fsref);
new_url = CFURLCreateFromFSRef (NULL, &fsref);
#else
new_url = (CFURLRef) CTFontCopyAttribute (new_ct_font, kCTFontURLAttribute);
#endif
// 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
if (!original_url || !new_url || CFEqual (original_url, new_url)) {
CFRelease (ct_font);
ct_font = new_ct_font;
CFRelease (ct_font);
ct_font = new_ct_font;
} else {
CFRelease (new_ct_font);
DEBUG_MSG (CORETEXT, ct_font, "Discarding reconfigured CTFont, location changed.");
CFRelease (new_ct_font);
DEBUG_MSG (CORETEXT, ct_font, "Discarding reconfigured CTFont, location changed.");
}
if (new_url)
CFRelease (new_url);
CFRelease (new_url);
}
else
DEBUG_MSG (CORETEXT, ct_font, "Font copy with empty cascade list failed");
@ -433,9 +433,9 @@ struct range_record_t {
hb_bool_t
_hb_coretext_shape (hb_shape_plan_t *shape_plan,
hb_font_t *font,
hb_buffer_t *buffer,
const hb_feature_t *features,
unsigned int num_features)
hb_buffer_t *buffer,
const hb_feature_t *features,
unsigned int num_features)
{
hb_face_t *face = font->face;
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);
if (!mapping)
continue;
continue;
active_feature_t feature;
feature.rec.feature = mapping->aatFeatureType;
@ -519,7 +519,7 @@ _hb_coretext_shape (hb_shape_plan_t *shape_plan,
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 ();
if (active_features.length)
@ -580,9 +580,9 @@ _hb_coretext_shape (hb_shape_plan_t *shape_plan,
if (event->start)
{
active_features.push (event->feature);
active_features.push (event->feature);
} else {
active_feature_t *feature = active_features.find (&event->feature);
active_feature_t *feature = active_features.find (&event->feature);
if (feature)
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
# define kCTLanguageAttributeName CFSTR ("NSLanguage")
#endif
CFStringRef lang = CFStringCreateWithCStringNoCopy (kCFAllocatorDefault,
CFStringRef lang = CFStringCreateWithCStringNoCopy (kCFAllocatorDefault,
hb_language_to_string (buffer->props.language),
kCFStringEncodingUTF8,
kCFAllocatorNull);
if (unlikely (!lang))
{
{
CFRelease (attr_string);
FAIL ("CFStringCreateWithCStringNoCopy failed");
}
}
CFAttributedStringSetAttribute (attr_string, CFRangeMake (0, chars_len),
kCTLanguageAttributeName, lang);
CFRelease (lang);
@ -757,7 +757,7 @@ resize_and_retry:
feature.start < chars_len && feature.start < feature.end)
{
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)
CFAttributedStringRemoveAttribute (attr_string, feature_range, kCTKernAttributeName);
else
@ -781,8 +781,8 @@ resize_and_retry:
CFRelease (level_number);
if (unlikely (!options))
{
CFRelease (attr_string);
FAIL ("CFDictionaryCreate failed");
CFRelease (attr_string);
FAIL ("CFDictionaryCreate failed");
}
CTTypesetterRef typesetter = CTTypesetterCreateWithAttributedStringAndOptions (attr_string, options);
@ -893,7 +893,7 @@ resize_and_retry:
if (!matched)
{
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);
if (!buffer->ensure_inplace (buffer->len + range.length))
goto resize_and_retry;
@ -921,7 +921,7 @@ resize_and_retry:
continue;
}
if (buffer->unicode->is_default_ignorable (ch))
continue;
continue;
info->codepoint = notdef;
info->cluster = log_clusters[j];
@ -966,7 +966,7 @@ resize_and_retry:
scratch = scratch_saved
{ /* Setup glyphs */
SCRATCH_SAVE();
SCRATCH_SAVE();
const CGGlyph* glyphs = USE_PTR ? CTRunGetGlyphsPtr (run) : nullptr;
if (!glyphs) {
ALLOCATE_ARRAY (CGGlyph, glyph_buf, num_glyphs, goto resize_and_retry);
@ -989,12 +989,12 @@ resize_and_retry:
SCRATCH_RESTORE();
}
{
/* Setup positions.
/* Setup positions.
* 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
* advance (in the advance direction only), and for last glyph we set
* whatever is needed to make the whole run's advance add up. */
SCRATCH_SAVE();
SCRATCH_SAVE();
const CGPoint* positions = USE_PTR ? CTRunGetPositionsPtr (run) : nullptr;
if (!positions) {
ALLOCATE_ARRAY (CGPoint, position_buf, num_glyphs, goto resize_and_retry);

View File

@ -41,7 +41,7 @@ struct hb_dispatch_context_t
private:
/* https://en.wikipedia.org/wiki/Curiously_recurring_template_pattern */
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:
static constexpr unsigned max_debug_depth = MaxDebugDepth;
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) \
\
\
void \
hb_font_funcs_set_##name##_func (hb_font_funcs_t *ffuncs, \
hb_font_get_##name##_func_t func, \
void *user_data, \
hb_destroy_func_t destroy) \
hb_font_get_##name##_func_t func, \
void *user_data, \
hb_destroy_func_t destroy) \
{ \
if (hb_object_is_immutable (ffuncs)) { \
if (destroy) \
destroy (user_data); \
return; \
} \
\
\
if (ffuncs->destroy.name) \
ffuncs->destroy.name (ffuncs->user_data.name); \
\
\
if (func) { \
ffuncs->get.f.name = func; \
ffuncs->user_data.name = user_data; \
@ -1676,8 +1676,8 @@ hb_font_set_funcs (hb_font_t *font,
**/
void
hb_font_set_funcs_data (hb_font_t *font,
void *font_data,
hb_destroy_func_t destroy)
void *font_data,
hb_destroy_func_t destroy)
{
/* Destroy user_data? */
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. */
char buf[128];
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;
}

View File

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

View File

@ -72,7 +72,7 @@ struct hb_iter_t
private:
/* https://en.wikipedia.org/wiki/Curiously_recurring_template_pattern */
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:
/* TODO:
@ -183,7 +183,7 @@ struct hb_iter_fallback_mixin_t
private:
/* https://en.wikipedia.org/wiki/Curiously_recurring_template_pattern */
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:
/* Access: Implement __item__(), or __item_at__() if random-access. */

View File

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

View File

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

View File

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

View File

@ -92,9 +92,9 @@ typedef struct OffsetTable
if (table_count)
{
if (start_offset >= tables.len)
*table_count = 0;
*table_count = 0;
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;
unsigned int count = *table_count;

View File

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

View File

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

View File

@ -251,7 +251,7 @@ struct IndexSubtableArray
unsigned int firstGlyphIndex = indexSubtablesZ[i].firstGlyphIndex;
unsigned int lastGlyphIndex = indexSubtablesZ[i].lastGlyphIndex;
if (firstGlyphIndex <= glyph && glyph <= lastGlyphIndex)
return &indexSubtablesZ[i];
return &indexSubtablesZ[i];
}
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);
*color_count = count;
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;
}

View File

@ -173,11 +173,11 @@ struct sbix
{
unsigned count = table->strikes.len;
if (unlikely (!count))
return Null(SBIXStrike);
return Null(SBIXStrike);
unsigned int requested_ppem = hb_max (font->x_ppem, font->y_ppem);
if (!requested_ppem)
requested_ppem = 1<<30; /* Choose largest strike. */
requested_ppem = 1<<30; /* Choose largest strike. */
/* TODO Add DPI sensitivity as well? */
unsigned int best_i = 0;
unsigned int best_ppem = table->get_strike (0).ppem;
@ -201,7 +201,7 @@ struct sbix
HBUINT8 signature[8];
struct
{
struct
struct
{
HBUINT32 length;
Tag type;
@ -226,7 +226,7 @@ struct sbix
/* Following code is safe to call even without data.
* But faster to short-circuit. */
if (!has_data ())
return false;
return false;
int x_offset = 0, y_offset = 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
static hb_bool_t
hb_ot_get_glyph_name (hb_font_t *font HB_UNUSED,
void *font_data,
hb_codepoint_t glyph,
char *name, unsigned int size,
void *user_data HB_UNUSED)
void *font_data,
hb_codepoint_t glyph,
char *name, unsigned int size,
void *user_data HB_UNUSED)
{
const hb_ot_face_t *ot_face = (const hb_ot_face_t *) font_data;
return ot_face->post->get_glyph_name (glyph, name, size);
}
static hb_bool_t
hb_ot_get_glyph_from_name (hb_font_t *font HB_UNUSED,
void *font_data,
const char *name, int len,
hb_codepoint_t *glyph,
void *user_data HB_UNUSED)
void *font_data,
const char *name, int len,
hb_codepoint_t *glyph,
void *user_data HB_UNUSED)
{
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);

View File

@ -66,7 +66,7 @@ struct hmtxvmtx
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 *dest_blob = hb_blob_copy_writable_or_fail (src_blob);
@ -87,30 +87,30 @@ struct hmtxvmtx
}
template<typename Iterator,
hb_requires (hb_is_iterator (Iterator))>
hb_requires (hb_is_iterator (Iterator))>
void serialize (hb_serialize_context_t *c,
Iterator it,
unsigned num_advances)
Iterator it,
unsigned num_advances)
{
unsigned idx = 0;
+ it
| hb_apply ([c, &idx, num_advances] (const hb_item_type<Iterator>& _)
{
if (idx < num_advances)
{
LongMetric lm;
lm.advance = _.first;
lm.sb = _.second;
if (unlikely (!c->embed<LongMetric> (&lm))) return;
}
else
{
FWORD *sb = c->allocate_size<FWORD> (FWORD::static_size);
if (unlikely (!sb)) return;
*sb = _.second;
}
idx++;
})
{
if (idx < num_advances)
{
LongMetric lm;
lm.advance = _.first;
lm.sb = _.second;
if (unlikely (!c->embed<LongMetric> (&lm))) return;
}
else
{
FWORD *sb = c->allocate_size<FWORD> (FWORD::static_size);
if (unlikely (!sb)) return;
*sb = _.second;
}
idx++;
})
;
}
@ -131,8 +131,8 @@ struct hmtxvmtx
{
hb_codepoint_t 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));
else
return hb_pair (_mtx.get_advance (old_gid), _mtx.get_side_bearing (old_gid));
else
return hb_pair (0u, 0u);
})
;
@ -158,7 +158,7 @@ struct hmtxvmtx
friend struct hmtxvmtx;
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);
@ -194,10 +194,10 @@ struct hmtxvmtx
unsigned int get_side_bearing (hb_codepoint_t glyph) const
{
if (glyph < num_advances)
return table->longMetricZ[glyph].sb;
return table->longMetricZ[glyph].sb;
if (unlikely (glyph >= num_metrics))
return 0;
return 0;
const FWORD *bearings = (const FWORD *) &table->longMetricZ[num_advances];
return bearings[glyph - num_advances];
@ -234,12 +234,12 @@ struct hmtxvmtx
{
unsigned int num_advances = plan->num_output_glyphs ();
unsigned int last_advance = _advance_for_new_gid (plan,
num_advances - 1);
num_advances - 1);
while (num_advances > 1 &&
last_advance == _advance_for_new_gid (plan,
num_advances - 2))
last_advance == _advance_for_new_gid (plan,
num_advances - 2))
{
num_advances--;
num_advances--;
}
return num_advances;
@ -247,11 +247,11 @@ struct hmtxvmtx
private:
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;
if (!plan->old_gid_for_new_gid (new_gid, &old_gid))
return 0;
return 0;
return get_advance (old_gid);
}

View File

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

View File

@ -149,8 +149,8 @@ struct CaretValueFormat3
const VariationStore &var_store) const
{
return HB_DIRECTION_IS_HORIZONTAL (direction) ?
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_x (coordinate) + (this+deviceTable).get_x_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

View File

@ -238,8 +238,8 @@ struct ValueFormat : HBUINT16
template<typename Iterator>
static inline void SinglePos_serialize (hb_serialize_context_t *c,
Iterator it,
ValueFormat valFormat);
Iterator it,
ValueFormat valFormat);
struct AnchorFormat1
@ -513,10 +513,7 @@ struct SinglePosFormat1
auto vals = hb_second (*it);
+ vals
| hb_apply ([=] (const Value& _)
{
c->copy (_);
})
| hb_apply ([=] (const Value& _) { c->copy (_); })
;
auto glyphs =
@ -539,9 +536,9 @@ struct SinglePosFormat1
+ hb_iter (this+coverage)
| hb_filter (glyphset)
| 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);
@ -602,30 +599,27 @@ struct SinglePosFormat2
hb_requires (hb_is_iterator (Iterator))>
void serialize (hb_serialize_context_t *c,
Iterator it,
ValueFormat valFormat)
ValueFormat valFormat)
{
if (unlikely (!c->extend_min (*this))) return;
if (unlikely (!c->check_assign (valueFormat, valFormat))) return;
if (unlikely (!c->check_assign (valueCount, it.len ()))) return;
+ it
| hb_map (hb_second)
| hb_apply ([=] (hb_array_t<const Value> val_iter)
{
+ val_iter
| hb_apply ([=] (const Value& _)
{
c->copy (_);
})
;
})
{
+ val_iter
| hb_apply ([=] (const Value& _) { c->copy (_); })
;
})
;
auto glyphs =
+ it
| hb_map_retains_sorting (hb_first)
;
coverage.serialize (c, this).serialize (c, glyphs);
}
@ -642,9 +636,9 @@ struct SinglePosFormat2
+ hb_zip (this+coverage, hb_range ((unsigned) valueCount))
| hb_filter (glyphset, hb_first)
| 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);
@ -686,18 +680,18 @@ struct SinglePos
+ glyph_val_iter_pairs
| hb_map (hb_second)
| hb_apply ([&] (hb_array_t<const Value> val_iter)
{
+ hb_zip (val_iter, first_val_iter)
| hb_apply ([&] (const hb_pair_t<Value, Value>& _)
{
if (_.first != _.second)
{
subset_format = 2;
return;
}
})
;
})
{
+ hb_zip (val_iter, first_val_iter)
| hb_apply ([&] (const hb_pair_t<Value, Value>& _)
{
if (_.first != _.second)
{
subset_format = 2;
return;
}
})
;
})
;
return subset_format;
@ -708,7 +702,7 @@ struct SinglePos
hb_requires (hb_is_iterator (Iterator))>
void serialize (hb_serialize_context_t *c,
Iterator glyph_val_iter_pairs,
ValueFormat valFormat)
ValueFormat valFormat)
{
if (unlikely (!c->extend_min (u.format))) return;
unsigned format = 2;
@ -718,9 +712,9 @@ struct SinglePos
u.format = format;
switch (u.format) {
case 1: u.format1.serialize (c, glyph_val_iter_pairs, valFormat);
return;
return;
case 2: u.format2.serialize (c, glyph_val_iter_pairs, valFormat);
return;
return;
default:return;
}
}
@ -748,8 +742,8 @@ struct SinglePos
template<typename Iterator>
static inline void
SinglePos_serialize (hb_serialize_context_t *c,
Iterator it,
ValueFormat valFormat)
Iterator it,
ValueFormat 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 (chosen_script)
*chosen_script = script_tags[i];
*chosen_script = script_tags[i];
return true;
}
}
@ -999,9 +999,9 @@ hb_ot_layout_table_get_lookup_count (hb_face_t *face,
struct hb_collect_features_context_t
{
hb_collect_features_context_t (hb_face_t *face,
hb_tag_t table_tag,
hb_set_t *feature_indexes_)
hb_collect_features_context_t (hb_face_t *face,
hb_tag_t table_tag,
hb_set_t *feature_indexes_)
: g (get_gsubgpos_table (face, table_tag)),
feature_indexes (feature_indexes_),
script_count(0),langsys_count(0) {}
@ -1147,11 +1147,11 @@ script_collect_features (hb_collect_features_context_t *c,
**/
void
hb_ot_layout_collect_features (hb_face_t *face,
hb_tag_t table_tag,
const hb_tag_t *scripts,
const hb_tag_t *languages,
const hb_tag_t *features,
hb_set_t *feature_indexes /* OUT */)
hb_tag_t table_tag,
const hb_tag_t *scripts,
const hb_tag_t *languages,
const hb_tag_t *features,
hb_set_t *feature_indexes /* OUT */)
{
hb_collect_features_context_t c (face, table_tag, feature_indexes);
if (!scripts)
@ -1482,8 +1482,8 @@ hb_ot_layout_lookup_substitute_closure (hb_face_t *face,
**/
void
hb_ot_layout_lookups_substitute_closure (hb_face_t *face,
const hb_set_t *lookups,
hb_set_t *glyphs /* OUT */)
const hb_set_t *lookups,
hb_set_t *glyphs /* OUT */)
{
hb_map_t 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)
{
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
{
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 &&
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_ot_layout_collect_features (hb_face_t *face,
hb_tag_t table_tag,
const hb_tag_t *scripts,
const hb_tag_t *languages,
const hb_tag_t *features,
hb_set_t *feature_indexes /* OUT */);
hb_tag_t table_tag,
const hb_tag_t *scripts,
const hb_tag_t *languages,
const hb_tag_t *features,
hb_set_t *feature_indexes /* OUT */);
HB_EXTERN void
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_ot_layout_lookup_substitute_closure (hb_face_t *face,
unsigned int lookup_index,
hb_set_t *glyphs
unsigned int lookup_index,
hb_set_t *glyphs
/*TODO , hb_bool_t inclusive */);
HB_EXTERN void
hb_ot_layout_lookups_substitute_closure (hb_face_t *face,
const hb_set_t *lookups,
hb_set_t *glyphs);
const hb_set_t *lookups,
hb_set_t *glyphs);
#ifdef HB_NOT_IMPLEMENTED

View File

@ -297,7 +297,7 @@ hb_ot_map_builder_t::compile (hb_ot_map_t &m,
global_bit_mask);
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,
m.features[i].index[table_index],
key.variations_index[table_index],

View File

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

View File

@ -265,10 +265,10 @@ struct name
unsigned int j = 0;
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)
continue;
if (i &&
if (i &&
this->names[i - 1].name_id == this->names[i].name_id &&
this->names[i - 1].language == this->names[i].language)
continue;
@ -295,10 +295,10 @@ struct name
sizeof (key),
_hb_ot_name_entry_cmp_key);
if (!entry)
return -1;
return -1;
if (width)
*width = entry->entry_score < 10 ? 2 : 1;
*width = entry->entry_score < 10 ? 2 : 1;
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);
typename out_utf_t::codepoint_t *dst_next = out_utf_t::encode (dst, dst_end, unicode);
if (dst_next == dst)
break; /* Out-of-room. */
break; /* Out-of-room. */
dst = dst_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 (step == CUT)
if (step == CUT)
{
--j;
info[j] = info[i - 1];
pos[j] = pos[i - 1];
}
continue;
continue;
}
/* 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);
if (shortfall > 0 && n_repeating > 0)
{
++n_copies;
hb_position_t excess = (n_copies + 1) * sign * w_repeating - sign * w_remaining;
if (excess > 0)
extra_repeat_overlap = excess / (n_copies * n_repeating);
++n_copies;
hb_position_t excess = (n_copies + 1) * sign * w_repeating - sign * w_remaining;
if (excess > 0)
extra_repeat_overlap = excess / (n_copies * n_repeating);
}
if (step == MEASURE)
@ -583,7 +583,7 @@ apply_stch (const hb_ot_shape_plan_t *plan HB_UNUSED,
if (step == MEASURE)
{
if (unlikely (!buffer->ensure (count + extra_glyphs_needed)))
break;
break;
}
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)
{
/* 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 ();
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)
{
buffer->next_glyph ();
s_len++;
}
buffer->next_glyph ();
s_len++;
}
if (unlikely (!buffer->successful))
return;
@ -365,7 +365,7 @@ preprocess_text_hangul (const hb_ot_shape_plan_t *plan HB_UNUSED,
* that are now in buffer->out_info.
*/
hb_glyph_info_t *info = buffer->out_info;
end = start + s_len;
end = start + s_len;
unsigned int i = start;
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)
{
/* 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;
buffer->next_glyph ();
continue;

View File

@ -540,7 +540,7 @@ initial_reordering_consonant_syllable (const hb_ot_shape_plan_t *plan,
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,
* 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++)
if (info[i].indic_category() == OT_H)
{
unsigned int j;
for (j = end - 1; j > i; j--)
unsigned int j;
for (j = end - 1; j > i; j--)
if (is_consonant (info[j]) ||
(disallow_double_halants && info[j].indic_category() == OT_H))
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]));
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) {
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();
last = i;
} 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. */
for (unsigned int i = base; i < end; i++)
if (info[i].syllable() != 255)
if (info[i].syllable() != 255)
{
unsigned int max = i;
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++) {
hb_codepoint_t glyphs[2];
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))
{
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 &&
last_syllable == buffer->cur().syllable() &&
buffer->cur().indic_category() == OT_Repha)
buffer->next_glyph ();
buffer->next_glyph ();
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_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;
_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)
base--;
base--;
break;
}
if (base == end && start < base &&
@ -1182,7 +1182,7 @@ final_reordering_syllable_indic (const hb_ot_shape_plan_t *plan,
}
}
else
new_pos = start; /* No move. */
new_pos = start; /* No move. */
}
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)
new_reph_pos++;
if (new_reph_pos < end)
goto reph_move;
goto reph_move;
}
/* 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))))
new_reph_pos++;
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
@ -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
* 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...
*
* 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_SINHALA:
break;
break;
default:
/* 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 &&
last_syllable == buffer->cur().syllable() &&
buffer->cur().khmer_category() == OT_Repha)
buffer->next_glyph ();
buffer->next_glyph ();
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)
{
pos = POS_AFTER_SUB;
pos = POS_AFTER_SUB;
info[i].myanmar_position() = pos;
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 &&
last_syllable == buffer->cur().syllable() &&
buffer->cur().use_category() == USE_R)
buffer->next_glyph ();
buffer->next_glyph ();
buffer->output_info (ginfo);
}

View File

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

View File

@ -233,7 +233,7 @@ handle_variation_selector_cluster (const hb_ot_shape_normalize_context_t *c,
}
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);
buffer->next_glyph ();
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. */
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,
sizeof (buffer->info[0]),
&buffer->cur().glyph_index(),

View File

@ -489,7 +489,7 @@ hb_set_unicode_props (hb_buffer_t *buffer)
if (i + 1 < count &&
_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_continuation (&info[i]);
}
@ -650,19 +650,19 @@ hb_ot_shape_setup_masks_fraction (const hb_ot_shape_context_t *c)
while (start &&
_hb_glyph_info_get_general_category (&info[start - 1]) ==
HB_UNICODE_GENERAL_CATEGORY_DECIMAL_NUMBER)
start--;
start--;
while (end < count &&
_hb_glyph_info_get_general_category (&info[end]) ==
HB_UNICODE_GENERAL_CATEGORY_DECIMAL_NUMBER)
end++;
end++;
buffer->unsafe_to_break (start, end);
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;
for (unsigned int j = i + 1; j < end; j++)
info[j].mask |= post_mask;
info[j].mask |= post_mask;
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 (adjust_offsets)
adjust_mark_offsets (&buffer->pos[i]);
adjust_mark_offsets (&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))
{
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. */
if (c->font->has_glyph_h_origin_func ())
for (unsigned int i = 0; i < count; i++)
@ -896,7 +896,7 @@ hb_ot_position_default (const hb_ot_shape_context_t *c)
else
{
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++)
{
c->font->subtract_glyph_v_origin (info[i].codepoint,

View File

@ -304,8 +304,8 @@ struct STAT
protected:
FixedVersion<>version; /* Version of the stat table
* initially set to 0x00010002u */
FixedVersion<>version; /* Version of the stat table
* initially set to 0x00010002u */
HBUINT16 designAxisSize; /* The size in bytes of each axis record. */
HBUINT16 designAxisCount;/* The number of design axis records. In a
* 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++)
{
if (unlikely (!map->sanitize (c)))
return_trace (false);
return_trace (false);
map = &StructAfter<SegmentMaps> (*map);
}

View File

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

View File

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

View File

@ -84,7 +84,7 @@ struct hb_pool_t
T* thread ()
{
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;

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);
/* sanitize again to ensure no toe-stepping */
edit_count = 0;
/* sanitize again to ensure no toe-stepping */
edit_count = 0;
sane = t->sanitize (this);
if (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
{
if (edit_count && !writable) {
start = hb_blob_get_data_writable (blob, nullptr);
start = hb_blob_get_data_writable (blob, nullptr);
end = start + blob->length;
if (start)

View File

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

View File

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

View File

@ -330,15 +330,15 @@ struct cff2_subset_plan {
{
subset_localsubrs[fd].init ();
offsets.localSubrsInfos[fd].init ();
if (!subr_subsetter.encode_localsubrs (fd, subset_localsubrs[fd]))
return false;
if (!subr_subsetter.encode_localsubrs (fd, subset_localsubrs[fd]))
return false;
unsigned int dataSize = subset_localsubrs[fd].total_size ();
if (dataSize > 0)
{
offsets.localSubrsInfos[fd].offset = final_size;
offsets.localSubrsInfos[fd].offSize = calcOffSize (dataSize);
offsets.localSubrsInfos[fd].size = CFF2Subrs::calculate_serialized_size (offsets.localSubrsInfos[fd].offSize, subset_localsubrs[fd].length, dataSize);
unsigned int dataSize = subset_localsubrs[fd].total_size ();
if (dataSize > 0)
{
offsets.localSubrsInfos[fd].offset = final_size;
offsets.localSubrsInfos[fd].offSize = calcOffSize (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_subset_input_set_desubroutinize (hb_subset_input_t *subset_input,
hb_bool_t desubroutinize)
hb_bool_t 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
static inline void
_add_cff_seac_components (const OT::cff1::accelerator_t &cff,
hb_codepoint_t gid,
hb_set_t *gids_to_retain)
hb_codepoint_t gid,
hb_set_t *gids_to_retain)
{
hb_codepoint_t 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
_populate_gids_to_retain (hb_subset_plan_t* plan,
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)
{
OT::cmap::accelerator_t cmap;
@ -157,11 +157,11 @@ _populate_gids_to_retain (hb_subset_plan_t* plan,
static void
_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,
hb_map_t *glyph_map, /* OUT */
hb_map_t *reverse_glyph_map, /* OUT */
unsigned int *num_glyphs /* OUT */)
hb_map_t *glyph_map, /* OUT */
hb_map_t *reverse_glyph_map, /* OUT */
unsigned int *num_glyphs /* OUT */)
{
if (!retain_gids)
{
@ -191,8 +191,8 @@ _create_old_gid_to_new_gid_map (const hb_face_t *face,
}
static void
_nameid_closure (hb_face_t *face,
hb_set_t *nameids)
_nameid_closure (hb_face_t *face,
hb_set_t *nameids)
{
#ifndef HB_NO_STAT
face->table.STAT->collect_name_ids (nameids);
@ -213,8 +213,8 @@ _nameid_closure (hb_face_t *face,
* Since: 1.7.5
**/
hb_subset_plan_t *
hb_subset_plan_create (hb_face_t *face,
hb_subset_input_t *input)
hb_subset_plan_create (hb_face_t *face,
hb_subset_input_t *input)
{
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 ();
_populate_gids_to_retain (plan,
input->unicodes,
input->glyphs,
!input->drop_tables->has (HB_OT_TAG_GSUB));
input->unicodes,
input->glyphs,
!input->drop_tables->has (HB_OT_TAG_GSUB));
_create_old_gid_to_new_gid_map (face,
input->retain_gids,
input->retain_gids,
plan->_glyphset,
plan->glyph_map,
plan->reverse_glyph_map,
&plan->_num_output_glyphs);
plan->reverse_glyph_map,
&plan->_num_output_glyphs);
return plan;
}

View File

@ -108,7 +108,7 @@ struct hb_subset_plan_t
}
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);
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,
hb_codepoint_t *new_gid) const
hb_codepoint_t *new_gid) const
{
hb_codepoint_t gid = glyph_map->get (old_gid);
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,
hb_codepoint_t *old_gid) const
hb_codepoint_t *old_gid) const
{
hb_codepoint_t gid = reverse_glyph_map->get (new_gid);
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_subset_plan_create (hb_face_t *face,
hb_subset_input_t *input);
hb_subset_input_t *input);
HB_INTERNAL void
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_subset_input_set_desubroutinize (hb_subset_input_t *subset_input,
hb_bool_t desubroutinize);
hb_bool_t desubroutinize);
HB_EXTERN hb_bool_t
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 };
unsigned int name_table_length = OT::name::min_size +
ARRAY_LENGTH (name_IDs) * OT::NameRecord::static_size +
name_str_len * 2; /* for name data in UTF16BE form */
ARRAY_LENGTH (name_IDs) * OT::NameRecord::static_size +
name_str_len * 2; /* for name data in UTF16BE form */
unsigned int padded_name_table_length = ((name_table_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)
{
/* 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 ();
unsigned int offset = feature_records.length;
@ -701,7 +701,7 @@ _hb_uniscribe_shape (hb_shape_plan_t *shape_plan,
}
else
{
active_feature_t *feature = active_features.find (&event->feature);
active_feature_t *feature = active_features.find (&event->feature);
if (feature)
active_features.remove (feature - active_features.arrayZ);
}

View File

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

View File

@ -526,7 +526,7 @@ struct BEInt<Type, 2>
#endif
#endif
return (v[0] << 8)
+ (v[1] );
+ (v[1] );
}
private: uint8_t v[2];
};
@ -544,8 +544,8 @@ struct BEInt<Type, 3>
operator Type () const
{
return (v[0] << 16)
+ (v[1] << 8)
+ (v[2] );
+ (v[1] << 8)
+ (v[2] );
}
private: uint8_t v[3];
};
@ -564,9 +564,9 @@ struct BEInt<Type, 4>
operator Type () const
{
return (v[0] << 24)
+ (v[1] << 16)
+ (v[2] << 8)
+ (v[3] );
+ (v[1] << 16)
+ (v[2] << 8)
+ (v[3] );
}
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
if (!hb_ot_color_has_layers (face) &&
!hb_ot_color_has_png (face) &&
!hb_ot_color_has_svg (face))
!hb_ot_color_has_png (face) &&
!hb_ot_color_has_svg (face))
dump_glyphs (cairo_face, upem, num_glyphs, face_index);
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)
{
fprintf (stderr, "got incorrect bit (%d) for cp 0x%X. Should have been %d.",
OT::_hb_ot_os2_get_unicode_range_bit (cp),
cp,
bit);
OT::_hb_ot_os2_get_unicode_range_bit (cp),
cp,
bit);
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 *
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);
g_assert (subset);
@ -87,8 +87,8 @@ hb_subset_test_create_subset (hb_face_t *source,
static inline void
hb_subset_test_check (hb_face_t *expected,
hb_face_t *actual,
hb_tag_t table)
hb_face_t *actual,
hb_tag_t table)
{
hb_blob_t *expected_blob, *actual_blob;
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)
cluster++;
else if (buffer_type == BUFFER_UTF8)
cluster += 3;
cluster += 3;
}
g_assert_cmphex (glyphs[i].codepoint, ==, utf32[1+i]);
g_assert_cmphex (glyphs[i].cluster, ==, cluster);

View File

@ -345,7 +345,7 @@ test_object (void)
if (!obj)
continue;
if (obj == o->get_empty ())
continue; /* Tested already */
continue; /* Tested already */
g_assert (obj == o->reference (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_cmpint(hb_ot_math_get_glyph_variants (hb_font,
glyph,
HB_DIRECTION_BTT,
0,
NULL,
NULL), ==, 0);
glyph,
HB_DIRECTION_BTT,
0,
NULL,
NULL), ==, 0);
g_assert_cmpint(hb_ot_math_get_glyph_variants (hb_font,
glyph,
HB_DIRECTION_RTL,
0,
NULL,
NULL), ==, 3);
glyph,
HB_DIRECTION_RTL,
0,
NULL,
NULL), ==, 3);
g_assert(hb_font_get_glyph_from_name (hb_font, "arrowup", -1, &glyph));
g_assert_cmpint(hb_ot_math_get_glyph_variants (hb_font,
glyph,
HB_DIRECTION_BTT,
0,
NULL,
NULL), ==, 4);
glyph,
HB_DIRECTION_BTT,
0,
NULL,
NULL), ==, 4);
g_assert_cmpint(hb_ot_math_get_glyph_variants (hb_font,
glyph,
HB_DIRECTION_RTL,
0,
NULL,
NULL), ==, 0);
glyph,
HB_DIRECTION_RTL,
0,
NULL,
NULL), ==, 0);
g_assert(hb_font_get_glyph_from_name (hb_font, "arrowleft", -1, &glyph));
do {
count = variantsSize;
hb_ot_math_get_glyph_variants (hb_font,
glyph,
HB_DIRECTION_RTL,
offset,
&count,
variants);
glyph,
HB_DIRECTION_RTL,
offset,
&count,
variants);
offset += count;
} while (count == variantsSize);
g_assert_cmpint(offset, ==, 3);
@ -510,11 +510,11 @@ test_get_glyph_variants (void)
do {
count = variantsSize;
hb_ot_math_get_glyph_variants (hb_font,
glyph,
HB_DIRECTION_BTT,
offset,
&count,
variants);
glyph,
HB_DIRECTION_BTT,
offset,
&count,
variants);
offset += count;
} while (count == variantsSize);
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_cmpint(hb_ot_math_get_glyph_assembly (hb_font,
glyph,
HB_DIRECTION_BTT,
0,
NULL,
NULL,
NULL), ==, 0);
glyph,
HB_DIRECTION_BTT,
0,
NULL,
NULL,
NULL), ==, 0);
g_assert_cmpint(hb_ot_math_get_glyph_assembly (hb_font,
glyph,
HB_DIRECTION_RTL,
0,
NULL,
NULL,
NULL), ==, 3);
glyph,
HB_DIRECTION_RTL,
0,
NULL,
NULL,
NULL), ==, 3);
g_assert(hb_font_get_glyph_from_name (hb_font, "arrowdown", -1, &glyph));
g_assert_cmpint(hb_ot_math_get_glyph_assembly (hb_font,
glyph,
HB_DIRECTION_BTT,
0,
NULL,
NULL,
NULL), ==, 5);
glyph,
HB_DIRECTION_BTT,
0,
NULL,
NULL,
NULL), ==, 5);
g_assert_cmpint(hb_ot_math_get_glyph_assembly (hb_font,
glyph,
HB_DIRECTION_RTL,
0,
NULL,
NULL,
NULL), ==, 0);
glyph,
HB_DIRECTION_RTL,
0,
NULL,
NULL,
NULL), ==, 0);
g_assert(hb_font_get_glyph_from_name (hb_font, "arrowright", -1, &glyph));
do {
count = partsSize;
hb_ot_math_get_glyph_assembly (hb_font,
glyph,
HB_DIRECTION_RTL,
offset,
&count,
parts,
NULL);
glyph,
HB_DIRECTION_RTL,
offset,
&count,
parts,
NULL);
offset += count;
} while (count == partsSize);
g_assert_cmpint(offset, ==, 3);
@ -648,12 +648,12 @@ test_get_glyph_assembly (void)
do {
count = partsSize;
hb_ot_math_get_glyph_assembly (hb_font,
glyph,
HB_DIRECTION_BTT,
offset,
&count,
parts,
NULL);
glyph,
HB_DIRECTION_BTT,
offset,
&count,
parts,
NULL);
offset += count;
} while (count == partsSize);
g_assert_cmpint(offset, ==, 5);

View File

@ -62,8 +62,8 @@ static void free_up (void *p)
static hb_script_t
simple_get_script (hb_unicode_funcs_t *ufuncs,
hb_codepoint_t codepoint,
void *user_data)
hb_codepoint_t codepoint,
void *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
a_is_for_arabic_get_script (hb_unicode_funcs_t *ufuncs,
hb_codepoint_t codepoint,
void *user_data)
hb_codepoint_t codepoint,
void *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_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, '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);
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, '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);
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);
@ -798,7 +798,7 @@ test_unicode_subclassing_deep (data_fixture_t *f, gconstpointer user_data HB_UNU
g_assert (!f->data[0].freed);
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, 'b'), ==, HB_SCRIPT_LATIN);

View File

@ -133,7 +133,7 @@ struct image_t
for (unsigned int col = 0; col < w; col++)
*q++ = *p++;
else {
unsigned int limit = width - x;
unsigned int limit = width - x;
for (unsigned int col = 0; col < limit; col++)
*q++ = *p++;
p--;
@ -171,17 +171,17 @@ struct biimage_t
int freq[8] = {0};
for (unsigned int y = 0; y < height; y++)
for (unsigned int x = 0; x < width; x++) {
color_t c = image (x, y);
freq[c.to_ansi ()]++;
color_t c = image (x, y);
freq[c.to_ansi ()]++;
}
bg = 0;
for (unsigned int i = 1; i < 8; i++)
if (freq[bg] < freq[i])
bg = i;
bg = i;
fg = 0;
for (unsigned int i = 1; i < 8; i++)
if (i != bg && freq[fg] < freq[i])
fg = i;
fg = i;
if (fg == bg || freq[fg] == 0) {
fg = bg;
unicolor = true;
@ -202,7 +202,7 @@ struct biimage_t
int dd = diff.dot (diff);
for (unsigned int y = 0; y < height; y++)
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);
}
}
@ -287,13 +287,13 @@ block_best (const biimage_t &bi, bool *inverse)
unsigned int s;
s = row_sum[i] + total_i - row_sum_i[i];
if (s < best_s) {
best_s = s;
best_s = s;
best_i = i;
best_inv = false;
}
s = row_sum_i[i] + total - row_sum[i];
if (s < best_s) {
best_s = s;
best_s = s;
best_i = i;
best_inv = true;
}
@ -319,13 +319,13 @@ block_best (const biimage_t &bi, bool *inverse)
unsigned int s;
s = col_sum[i] + total_i - col_sum_i[i];
if (s < best_s) {
best_s = s;
best_s = s;
best_i = i;
best_inv = true;
}
s = col_sum_i[i] + total - col_sum[i];
if (s < best_s) {
best_s = s;
best_s = s;
best_i = i;
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);
bi.set (cell);
if (bi.unicolor) {
if (last_bg != bi.bg) {
if (last_bg != bi.bg) {
printf ("%c[%dm", ESC_E, 40 + bi.bg);
last_bg = bi.bg;
}
printf (" ");
} else {
/* Figure out the closest character to the biimage */
/* Figure out the closest character to the biimage */
bool inverse = false;
const char *c = block_best (bi, &inverse);
const char *c = block_best (bi, &inverse);
if (inverse) {
if (last_bg != bi.fg || last_fg != bi.bg) {
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);
FcObjectSetAdd (os, FC_CHARSET);
if (!format)
format = (const FcChar8 *) "%{=fclist}\n";
format = (const FcChar8 *) "%{=fclist}\n";
fs = FcFontList (0, pat, os);
if (os)
FcObjectSetDestroy (os);

View File

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

View File

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

View File

@ -40,16 +40,16 @@ struct subset_consumer_t
: failed (false), options (parser), subset_options (parser), font (nullptr), input (nullptr) {}
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 ());
input = hb_subset_input_reference (subset_options.input);
}
void consume_line (const char *text,
unsigned int text_len,
const char *text_before,
const char *text_after)
unsigned int text_len,
const char *text_before,
const char *text_after)
{
// TODO(Q1) does this only get called with at least 1 codepoint?
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) {
fprintf(stderr, "Expected %u bytes written, got %d\n", data_length,
bytes_written);
bytes_written);
return false;
}
return true;

View File

@ -71,7 +71,7 @@ helper_cairo_surface_write_to_ansi_stream (cairo_surface_t *surface,
unsigned int i;
for (i = 0; i < width; i++)
if (data[i] != bg_color)
break;
break;
if (i < width)
break;
data += stride / 4;
@ -86,7 +86,7 @@ helper_cairo_surface_write_to_ansi_stream (cairo_surface_t *surface,
unsigned int i;
for (i = 0; i < width; i++)
if (row[i] != bg_color)
break;
break;
if (i < width)
break;
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,
(const FT_Byte *) blob_data,
blob_length,
blob_length,
font_opts->face_index,
&ft_face))
fail (false, "FT_New_Memory_Face fail");

View File

@ -30,9 +30,9 @@
static gboolean
parse_nameids (const char *name,
const char *arg,
gpointer data,
GError **error G_GNUC_UNUSED)
const char *arg,
gpointer data,
GError **error G_GNUC_UNUSED)
{
subset_options_t *subset_opts = (subset_options_t *) data;
hb_set_t *name_ids = subset_opts->input->name_ids;
@ -46,7 +46,7 @@ parse_nameids (const char *name,
{
if (last_name_char == '-')
hb_set_del_range (name_ids, 0, 0x7FFF);
else
else
hb_set_add_range (name_ids, 0, 0x7FFF);
return true;
}
@ -67,7 +67,7 @@ parse_nameids (const char *name,
{
hb_set_destroy (name_ids);
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;
}
@ -86,9 +86,9 @@ parse_nameids (const char *name,
static gboolean
parse_drop_tables (const char *name,
const char *arg,
gpointer data,
GError **error G_GNUC_UNUSED)
const char *arg,
gpointer data,
GError **error G_GNUC_UNUSED)
{
subset_options_t *subset_opts = (subset_options_t *) data;
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.
{
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;
}
@ -137,8 +137,8 @@ subset_options_t::add_options (option_parser_t *parser)
{nullptr}
};
parser->add_group (entries,
"subset",
"Subset options:",
"Options subsetting",
this);
"subset",
"Subset options:",
"Options subsetting",
this);
}

View File

@ -196,8 +196,8 @@ parse_shapers (const char *name G_GNUC_UNUSED,
bool found = false;
for (const char **hb_shaper = hb_shape_list_shapers (); *hb_shaper; hb_shaper++) {
if (strcmp (*shaper, *hb_shaper) == 0) {
found = true;
break;
found = true;
break;
}
}
if (!found) {
@ -228,9 +228,9 @@ list_shapers (const char *name G_GNUC_UNUSED,
static gboolean
parse_features (const char *name G_GNUC_UNUSED,
const char *arg,
gpointer data,
GError **error G_GNUC_UNUSED)
const char *arg,
gpointer data,
GError **error G_GNUC_UNUSED)
{
shape_options_t *shape_opts = (shape_options_t *) data;
char *s = (char *) arg;
@ -271,9 +271,9 @@ parse_features (const char *name G_GNUC_UNUSED,
static gboolean
parse_variations (const char *name G_GNUC_UNUSED,
const char *arg,
gpointer data,
GError **error G_GNUC_UNUSED)
const char *arg,
gpointer data,
GError **error G_GNUC_UNUSED)
{
font_options_t *font_opts = (font_options_t *) data;
char *s = (char *) arg;
@ -335,9 +335,9 @@ parse_text (const char *name G_GNUC_UNUSED,
static gboolean
parse_unicodes (const char *name G_GNUC_UNUSED,
const char *arg,
gpointer data,
GError **error G_GNUC_UNUSED)
const char *arg,
gpointer data,
GError **error G_GNUC_UNUSED)
{
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);
if (0 == strcmp (arg, "*"))
if (0 == strcmp (arg, "*"))
{
g_string_append_c (gs, '*');
}
@ -358,26 +358,26 @@ parse_unicodes (const char *name G_GNUC_UNUSED,
char *s = (char *) arg;
char *p;
while (s && *s)
{
while (*s && strchr (DELIMITERS, *s))
s++;
s++;
if (!*s)
break;
break;
errno = 0;
hb_codepoint_t u = strtoul (s, &p, 16);
if (errno || s == p)
{
g_string_free (gs, TRUE);
g_set_error (error, G_OPTION_ERROR, G_OPTION_ERROR_BAD_VALUE,
g_string_free (gs, TRUE);
g_set_error (error, G_OPTION_ERROR, G_OPTION_ERROR_BAD_VALUE,
"Failed parsing Unicode values at: '%s'", s);
return false;
return false;
}
g_string_append_unichar (gs, u);
s = p;
}
}
@ -716,7 +716,7 @@ font_options_t::get_font () const
GString *s = g_string_new (nullptr);
for (unsigned int i = 0; i < ARRAY_LENGTH (supported_font_funcs); i++)
{
if (i)
if (i)
g_string_append_c (s, '/');
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,
"output-syntax",
"Output syntax:\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"
"\nOutput syntax options:",
" 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"
"\nOutput syntax options:",
"Options for the syntax of the output",
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 (error)
*error = "all shapers failed.";
*error = "all shapers failed.";
goto fail;
}
@ -341,7 +341,7 @@ struct shape_options_t : option_group_t
/* Shape segment corresponding to glyphs start..end. */
if (end == num_glyphs)
{
if (forward)
if (forward)
text_end = num_chars;
else
text_start = 0;
@ -372,9 +372,9 @@ struct shape_options_t : option_group_t
/* TODO: Add pre/post context text. */
hb_buffer_flags_t flags = hb_buffer_get_flags (fragment);
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)
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_append (fragment, text_buffer, text_start, text_end);