Minor, tweak spaces

This commit is contained in:
Ebrahim Byagowi 2019-10-01 13:49:55 +03:30
parent 51b720f686
commit 0558413f27
25 changed files with 101 additions and 96 deletions

View File

@ -733,8 +733,8 @@ struct KerxSubTableHeader
{
typedef ExtendedTypes Types;
unsigned int tuple_count () const { return tupleCount; }
bool is_horizontal () const { return !(coverage & Vertical); }
unsigned tuple_count () const { return tupleCount; }
bool is_horizontal () const { return !(coverage & Vertical); }
enum Coverage
{

View File

@ -281,8 +281,8 @@ struct hb_sorted_array_t :
}
template <typename T>
bool bfind (const T &x, unsigned int *i = nullptr,
hb_bfind_not_found_t not_found = HB_BFIND_NOT_FOUND_DONT_STORE,
unsigned int to_store = (unsigned int) -1) const
hb_bfind_not_found_t not_found = HB_BFIND_NOT_FOUND_DONT_STORE,
unsigned int to_store = (unsigned int) -1) const
{
int min = 0, max = (int) this->length - 1;
const Type *array = this->arrayZ;

View File

@ -408,8 +408,7 @@ struct hb_buffer_t
}
}
void unsafe_to_break_all ()
{ unsafe_to_break_impl (0, len); }
void unsafe_to_break_all () { unsafe_to_break_impl (0, len); }
void safe_to_break_all ()
{
for (unsigned int i = 0; i < len; i++)

View File

@ -649,8 +649,8 @@ hb_font_set_funcs (hb_font_t *font,
/* Be *very* careful with this function! */
HB_EXTERN 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);
HB_EXTERN void

View File

@ -216,7 +216,7 @@ struct hb_font_t
}
hb_bool_t get_nominal_glyph (hb_codepoint_t unicode,
hb_codepoint_t *glyph)
hb_codepoint_t *glyph)
{
*glyph = 0;
return klass->get.f.nominal_glyph (this, user_data,
@ -286,7 +286,7 @@ struct hb_font_t
}
hb_bool_t get_glyph_h_origin (hb_codepoint_t glyph,
hb_position_t *x, hb_position_t *y)
hb_position_t *x, hb_position_t *y)
{
*x = *y = 0;
return klass->get.f.glyph_h_origin (this, user_data,
@ -328,7 +328,7 @@ struct hb_font_t
}
hb_bool_t get_glyph_extents (hb_codepoint_t glyph,
hb_glyph_extents_t *extents)
hb_glyph_extents_t *extents)
{
memset (extents, 0, sizeof (*extents));
return klass->get.f.glyph_extents (this, user_data,
@ -499,7 +499,7 @@ struct hb_font_t
}
void subtract_glyph_h_origin (hb_codepoint_t glyph,
hb_position_t *x, hb_position_t *y)
hb_position_t *x, hb_position_t *y)
{
hb_position_t origin_x, origin_y;

View File

@ -287,7 +287,7 @@ struct ResourceRecord
{ return CastR<OpenTypeFontFace> ((data_base+offset).arrayZ); }
bool sanitize (hb_sanitize_context_t *c,
const void *data_base) const
const void *data_base) const
{
TRACE_SANITIZE (this);
return_trace (c->check_struct (this) &&

View File

@ -264,8 +264,8 @@ struct _hb_has_null
template <typename Type>
struct _hb_has_null<Type, true>
{
static const Type *get_null () { return &Null(Type); }
static Type *get_crap () { return &Crap(Type); }
static const Type *get_null () { return &Null (Type); }
static Type *get_crap () { return &Crap (Type); }
};
template <typename Type, typename OffsetType=HBUINT16, bool has_null=true>
@ -423,7 +423,7 @@ struct UnsizedArrayOf
{ return hb_array (arrayZ, len); }
hb_array_t<const Type> as_array (unsigned int len) const
{ return hb_array (arrayZ, len); }
operator hb_array_t<Type> () { return as_array (); }
operator hb_array_t< Type> () { return as_array (); }
operator hb_array_t<const Type> () const { return as_array (); }
template <typename T>
@ -902,8 +902,8 @@ struct SortedArrayOf : ArrayOf<Type, LenType>
{ return *as_array ().bsearch (x, &not_found); }
template <typename T>
bool bfind (const T &x, unsigned int *i = nullptr,
hb_bfind_not_found_t not_found = HB_BFIND_NOT_FOUND_DONT_STORE,
unsigned int to_store = (unsigned int) -1) const
hb_bfind_not_found_t not_found = HB_BFIND_NOT_FOUND_DONT_STORE,
unsigned int to_store = (unsigned int) -1) const
{ return as_array ().bfind (x, i, not_found, to_store); }
};

View File

@ -569,8 +569,8 @@ struct FDSelect3_4
GID_TYPE &nRanges () { return ranges.len; }
GID_TYPE nRanges () const { return ranges.len; }
GID_TYPE &sentinel () { return StructAfter<GID_TYPE> (ranges[nRanges () - 1]); }
const GID_TYPE &sentinel () const { return StructAfter<GID_TYPE> (ranges[nRanges () - 1]); }
GID_TYPE &sentinel () { return StructAfter<GID_TYPE> (ranges[nRanges () - 1]); }
const GID_TYPE &sentinel () const { return StructAfter<GID_TYPE> (ranges[nRanges () - 1]); }
ArrayOf<FDSelect3_4_Range<GID_TYPE, FD_TYPE>, GID_TYPE> ranges;
/* GID_TYPE sentinel */

View File

@ -203,8 +203,7 @@ struct bounds_t
}
}
bool empty () const
{ return (min.x >= max.x) || (min.y >= max.y); }
bool empty () const { return (min.x >= max.x) || (min.y >= max.y); }
point_t min;
point_t max;
@ -219,12 +218,12 @@ struct cff1_extents_param_t
bounds.init ();
}
void start_path () { path_open = true; }
void end_path () { path_open = false; }
void start_path () { path_open = true; }
void end_path () { path_open = false; }
bool is_path_open () const { return path_open; }
bool path_open;
bounds_t bounds;
bool path_open;
bounds_t bounds;
const OT::cff1::accelerator_t *cff;
};

View File

@ -1155,7 +1155,7 @@ struct cff1
}
bool is_valid () const { return blob != nullptr; }
bool is_CID () const { return topDict.is_CID (); }
bool is_CID () const { return topDict.is_CID (); }
bool is_predef_charset () const { return topDict.CharsetOffset <= ExpertSubsetCharset; }
@ -1225,25 +1225,25 @@ struct cff1
bool is_predef_encoding () const { return topDict.EncodingOffset <= ExpertEncoding; }
hb_codepoint_t glyph_to_code (hb_codepoint_t glyph) const
hb_codepoint_t glyph_to_code (hb_codepoint_t glyph) const
{
if (encoding != &Null(Encoding))
return encoding->get_code (glyph);
else
{
hb_codepoint_t sid = glyph_to_sid (glyph);
hb_codepoint_t sid = glyph_to_sid (glyph);
if (sid == 0) return 0;
hb_codepoint_t code = 0;
hb_codepoint_t code = 0;
switch (topDict.EncodingOffset)
{
case StandardEncoding:
code = lookup_standard_encoding_for_code (sid);
break;
case ExpertEncoding:
code = lookup_expert_encoding_for_code (sid);
break;
default:
break;
case StandardEncoding:
code = lookup_standard_encoding_for_code (sid);
break;
case ExpertEncoding:
code = lookup_expert_encoding_for_code (sid);
break;
default:
break;
}
return code;
}

View File

@ -44,8 +44,8 @@ struct cff2_extents_param_t
max_y.set_int (INT_MIN);
}
void start_path () { path_open = true; }
void end_path () { path_open = false; }
void start_path () { path_open = true; }
void end_path () { path_open = false; }
bool is_path_open () const { return path_open; }
void update_bounds (const point_t &pt)

View File

@ -736,9 +736,7 @@ struct DefaultUVS : SortedArrayOf<UnicodeValueRange, HBUINT32>
struct UVSMapping
{
int cmp (const hb_codepoint_t &codepoint) const
{
return unicodeValue.cmp (codepoint);
}
{ return unicodeValue.cmp (codepoint); }
bool sanitize (hb_sanitize_context_t *c) const
{
@ -1170,7 +1168,7 @@ struct cmap
return true;
return false;
})
})
;

View File

@ -453,7 +453,7 @@ struct CBDT
}
hb_blob_t* reference_png (hb_font_t *font,
hb_codepoint_t glyph) const
hb_codepoint_t glyph) const
{
const void *base;
const BitmapSizeTable &strike = this->cblc->choose_strike (font);

View File

@ -115,7 +115,7 @@ struct CPAL
{ return min_size + numPalettes * sizeof (colorRecordIndicesZ[0]); }
unsigned int get_palette_count () const { return numPalettes; }
unsigned int get_color_count () const { return numColors; }
unsigned int get_color_count () const { return numColors; }
hb_ot_color_palette_flags_t get_palette_flags (unsigned int palette_index) const
{ return v1 ().get_palette_flags (this, palette_index, numPalettes); }

View File

@ -167,8 +167,8 @@ struct KernOTSubTableHeader
static constexpr bool apple = false;
typedef AAT::ObsoleteTypes Types;
unsigned int tuple_count () const { return 0; }
bool is_horizontal () const { return (coverage & Horizontal); }
unsigned tuple_count () const { return 0; }
bool is_horizontal () const { return (coverage & Horizontal); }
enum Coverage
{
@ -222,8 +222,8 @@ struct KernAATSubTableHeader
static constexpr bool apple = true;
typedef AAT::ObsoleteTypes Types;
unsigned int tuple_count () const { return 0; }
bool is_horizontal () const { return !(coverage & Vertical); }
unsigned tuple_count () const { return 0; }
bool is_horizontal () const { return !(coverage & Vertical); }
enum Coverage
{
@ -275,8 +275,8 @@ struct kern
{
static constexpr hb_tag_t tableTag = HB_OT_TAG_kern;
bool has_data () const { return u.version32; }
unsigned int get_type () const { return u.major; }
bool has_data () const { return u.version32; }
unsigned get_type () const { return u.major; }
bool has_state_machine () const
{

View File

@ -1970,7 +1970,7 @@ struct VariationStore
.serialize (c, &(src+src->dataSets[i]), inner_maps[i], region_map)))
return_trace (false);
}
return_trace (true);
}

View File

@ -101,10 +101,10 @@ struct ValueFormat : HBUINT16
unsigned int get_len () const { return hb_popcount ((unsigned int) *this); }
unsigned int get_size () const { return get_len () * Value::static_size; }
bool apply_value (hb_ot_apply_context_t *c,
const void *base,
const Value *values,
hb_glyph_position_t &glyph_pos) const
bool apply_value (hb_ot_apply_context_t *c,
const void *base,
const Value *values,
hb_glyph_position_t &glyph_pos) const
{
bool ret = false;
unsigned int format = *this;
@ -257,7 +257,7 @@ struct AnchorFormat1
TRACE_SANITIZE (this);
return_trace (c->check_struct (this));
}
AnchorFormat1* copy (hb_serialize_context_t *c) const
{
TRACE_SERIALIZE (this);
@ -1242,7 +1242,7 @@ struct CursivePosFormat1
hb_requires (hb_is_iterator (Iterator))>
void serialize (hb_serialize_context_t *c,
Iterator it,
const void *src_base)
const void *src_base)
{
if (unlikely (!c->extend_min ((*this)))) return;
this->format = 1;
@ -1273,7 +1273,7 @@ struct CursivePosFormat1
+ hb_zip (this+coverage, entryExitRecord)
| hb_filter (glyphset, hb_first)
| hb_map_retains_sorting ([&] (hb_pair_t<hb_codepoint_t, const EntryExitRecord&> p) -> hb_pair_t<hb_codepoint_t, const EntryExitRecord&>
{ return hb_pair (glyph_map[p.first], p.second);})
{ return hb_pair (glyph_map[p.first], p.second);})
;
bool ret = bool (it);

View File

@ -134,8 +134,8 @@ struct OS2
OBLIQUE = 1u<<9
};
bool is_italic () const { return fsSelection & ITALIC; }
bool is_oblique () const { return fsSelection & OBLIQUE; }
bool is_italic () const { return fsSelection & ITALIC; }
bool is_oblique () const { return fsSelection & OBLIQUE; }
bool use_typo_metrics () const { return fsSelection & USE_TYPO_METRICS; }
enum width_class_t {

View File

@ -116,8 +116,8 @@ enum myanmar_syllable_type_t {
static void
setup_masks_myanmar (const hb_ot_shape_plan_t *plan HB_UNUSED,
hb_buffer_t *buffer,
hb_font_t *font HB_UNUSED)
hb_buffer_t *buffer,
hb_font_t *font HB_UNUSED)
{
HB_BUFFER_ALLOCATE_VAR (buffer, myanmar_category);
HB_BUFFER_ALLOCATE_VAR (buffer, myanmar_position);

View File

@ -548,7 +548,7 @@ struct subr_remap_t : hb_inc_bimap_t
/* create a remapping of subroutine numbers from old to new.
* no optimization based on usage counts. fonttools doesn't appear doing that either.
*/
hb_codepoint_t old_num = HB_SET_VALUE_INVALID;
while (hb_set_next (closure, &old_num))
add (old_num);

View File

@ -270,9 +270,9 @@ hb_unicode_funcs_destroy (hb_unicode_funcs_t *ufuncs)
**/
hb_bool_t
hb_unicode_funcs_set_user_data (hb_unicode_funcs_t *ufuncs,
hb_user_data_key_t *key,
void * data,
hb_destroy_func_t destroy,
hb_user_data_key_t *key,
void * data,
hb_destroy_func_t destroy,
hb_bool_t replace)
{
return hb_object_set_user_data (ufuncs, key, data, destroy, replace);
@ -291,7 +291,7 @@ hb_unicode_funcs_set_user_data (hb_unicode_funcs_t *ufuncs,
**/
void *
hb_unicode_funcs_get_user_data (hb_unicode_funcs_t *ufuncs,
hb_user_data_key_t *key)
hb_user_data_key_t *key)
{
return hb_object_get_user_data (ufuncs, key);
}

View File

@ -200,15 +200,15 @@ hb_unicode_funcs_destroy (hb_unicode_funcs_t *ufuncs);
HB_EXTERN hb_bool_t
hb_unicode_funcs_set_user_data (hb_unicode_funcs_t *ufuncs,
hb_user_data_key_t *key,
void * data,
hb_destroy_func_t destroy,
hb_user_data_key_t *key,
void * data,
hb_destroy_func_t destroy,
hb_bool_t replace);
HB_EXTERN void *
hb_unicode_funcs_get_user_data (hb_unicode_funcs_t *ufuncs,
hb_user_data_key_t *key);
hb_user_data_key_t *key);
HB_EXTERN void
@ -260,7 +260,7 @@ typedef hb_bool_t (*hb_unicode_decompose_func_t) (hb_unicode_funcs_t *ufuncs,
* @user_data:
* @destroy:
*
*
*
*
* Since: 0.9.2
**/
@ -276,7 +276,7 @@ hb_unicode_funcs_set_combining_class_func (hb_unicode_funcs_t *ufuncs,
* @user_data:
* @destroy:
*
*
*
*
* Since: 0.9.2
**/
@ -292,7 +292,7 @@ hb_unicode_funcs_set_general_category_func (hb_unicode_funcs_t *ufuncs,
* @user_data:
* @destroy:
*
*
*
*
* Since: 0.9.2
**/
@ -308,7 +308,7 @@ hb_unicode_funcs_set_mirroring_func (hb_unicode_funcs_t *ufuncs,
* @user_data:
* @destroy:
*
*
*
*
* Since: 0.9.2
**/
@ -324,7 +324,7 @@ hb_unicode_funcs_set_script_func (hb_unicode_funcs_t *ufuncs,
* @user_data:
* @destroy:
*
*
*
*
* Since: 0.9.2
**/
@ -340,7 +340,7 @@ hb_unicode_funcs_set_compose_func (hb_unicode_funcs_t *ufuncs,
* @user_data:
* @destroy:
*
*
*
*
* Since: 0.9.2
**/

View File

@ -302,8 +302,8 @@ struct hb_sorted_vector_t : hb_vector_t<Type>
{ return as_array ().bsearch (x, not_found); }
template <typename T>
bool bfind (const T &x, unsigned int *i = nullptr,
hb_bfind_not_found_t not_found = HB_BFIND_NOT_FOUND_DONT_STORE,
unsigned int to_store = (unsigned int) -1) const
hb_bfind_not_found_t not_found = HB_BFIND_NOT_FOUND_DONT_STORE,
unsigned int to_store = (unsigned int) -1) const
{ return as_array ().bfind (x, i, not_found, to_store); }
};

View File

@ -45,7 +45,8 @@ using namespace OT;
int
main (int argc, char **argv)
{
if (argc != 2) {
if (argc != 2)
{
fprintf (stderr, "usage: %s font-file.ttf\n", argv[0]);
exit (1);
}
@ -65,7 +66,8 @@ main (int argc, char **argv)
const OpenTypeFontFile& ot = *sanitized;
switch (ot.get_tag ()) {
switch (ot.get_tag ())
{
case OpenTypeFontFile::TrueTypeTag:
printf ("OpenType font with TrueType outlines\n");
break;
@ -91,20 +93,23 @@ main (int argc, char **argv)
int num_fonts = ot.get_face_count ();
printf ("%d font(s) found in file\n", num_fonts);
for (int n_font = 0; n_font < num_fonts; n_font++) {
for (int n_font = 0; n_font < num_fonts; n_font++)
{
const OpenTypeFontFace &font = ot.get_face (n_font);
printf ("Font %d of %d:\n", n_font, num_fonts);
int num_tables = font.get_table_count ();
printf (" %d table(s) found in font\n", num_tables);
for (int n_table = 0; n_table < num_tables; n_table++) {
for (int n_table = 0; n_table < num_tables; n_table++)
{
const OpenTypeTable &table = font.get_table (n_table);
printf (" Table %2d of %2d: %.4s (0x%08x+0x%08x)\n", n_table, num_tables,
(const char *) table.tag,
(unsigned int) table.offset,
(unsigned int) table.length);
switch (table.tag) {
switch (table.tag)
{
case HB_OT_TAG_GSUB:
case HB_OT_TAG_GPOS:
@ -114,10 +119,11 @@ main (int argc, char **argv)
int num_scripts = g.get_script_count ();
printf (" %d script(s) found in table\n", num_scripts);
for (int n_script = 0; n_script < num_scripts; n_script++) {
for (int n_script = 0; n_script < num_scripts; n_script++)
{
const Script &script = g.get_script (n_script);
printf (" Script %2d of %2d: %.4s\n", n_script, num_scripts,
(const char *)g.get_script_tag(n_script));
(const char *)g.get_script_tag(n_script));
if (!script.has_default_lang_sys())
printf (" No default language system\n");
@ -140,34 +146,37 @@ main (int argc, char **argv)
int num_features = langsys.get_feature_count ();
printf (" %d feature(s) found in language system\n", num_features);
for (int n_feature = 0; n_feature < num_features; n_feature++) {
for (int n_feature = 0; n_feature < num_features; n_feature++)
{
printf (" Feature index %2d of %2d: %d\n", n_feature, num_features,
langsys.get_feature_index (n_feature));
langsys.get_feature_index (n_feature));
}
}
}
int num_features = g.get_feature_count ();
printf (" %d feature(s) found in table\n", num_features);
for (int n_feature = 0; n_feature < num_features; n_feature++) {
for (int n_feature = 0; n_feature < num_features; n_feature++)
{
const Feature &feature = g.get_feature (n_feature);
int num_lookups = feature.get_lookup_count ();
printf (" Feature %2d of %2d: %c%c%c%c\n", n_feature, num_features,
HB_UNTAG(g.get_feature_tag(n_feature)));
HB_UNTAG(g.get_feature_tag(n_feature)));
printf (" %d lookup(s) found in feature\n", num_lookups);
for (int n_lookup = 0; n_lookup < num_lookups; n_lookup++) {
printf (" Lookup index %2d of %2d: %d\n", n_lookup, num_lookups,
feature.get_lookup_index (n_lookup));
feature.get_lookup_index (n_lookup));
}
}
int num_lookups = g.get_lookup_count ();
printf (" %d lookup(s) found in table\n", num_lookups);
for (int n_lookup = 0; n_lookup < num_lookups; n_lookup++) {
for (int n_lookup = 0; n_lookup < num_lookups; n_lookup++)
{
const Lookup &lookup = g.get_lookup (n_lookup);
printf (" Lookup %2d of %2d: type %d, props 0x%04X\n", n_lookup, num_lookups,
lookup.get_type(), lookup.get_props());
lookup.get_type(), lookup.get_props());
}
}

View File

@ -234,7 +234,7 @@ main (int argc, char **argv)
{
hb_set_t *set = hb_set_create ();
for (unsigned int i = 0; i < temp1; ++i)
hb_set_add (set, i);
hb_set_add (set, i);
temp1++;
return set;
})