Cosmetic and minor changes

This commit is contained in:
Ebrahim Byagowi 2018-10-13 14:00:05 +03:30 committed by Behdad Esfahbod
parent c0a6814b49
commit 63109432cf
9 changed files with 93 additions and 106 deletions

View File

@ -440,8 +440,8 @@ hb_bool_t
hb_buffer_deserialize_glyphs (hb_buffer_t *buffer, hb_buffer_deserialize_glyphs (hb_buffer_t *buffer,
const char *buf, const char *buf,
int buf_len, /* -1 means nul-terminated */ int buf_len, /* -1 means nul-terminated */
const char **end_ptr, /* May be nullptr */ const char **end_ptr, /* May be NULL */
hb_font_t *font, /* May be nullptr */ hb_font_t *font, /* May be NULL */
hb_buffer_serialize_format_t format) hb_buffer_serialize_format_t format)
{ {
const char *end; const char *end;

View File

@ -473,7 +473,7 @@ struct FeatureParamsCharacterVariants
* specifies a string (or strings, * specifies a string (or strings,
* for multiple languages) for a * for multiple languages) for a
* user-interface label for this * user-interface label for this
* feature. (May be nullptr.) */ * feature. (May be NULL.) */
NameID featUITooltipTextNameID;/* The name table name ID that NameID featUITooltipTextNameID;/* The name table name ID that
* specifies a string (or strings, * specifies a string (or strings,
* for multiple languages) that an * for multiple languages) that an
@ -483,7 +483,7 @@ struct FeatureParamsCharacterVariants
NameID sampleTextNameID; /* The name table name ID that NameID sampleTextNameID; /* The name table name ID that
* specifies sample text that * specifies sample text that
* illustrates the effect of this * illustrates the effect of this
* feature. (May be nullptr.) */ * feature. (May be NULL.) */
HBUINT16 numNamedParameters; /* Number of named parameters. (May HBUINT16 numNamedParameters; /* Number of named parameters. (May
* be zero.) */ * be zero.) */
NameID firstParamUILabelNameID;/* The first name table name ID NameID firstParamUILabelNameID;/* The first name table name ID

View File

@ -214,10 +214,10 @@ struct hb_collect_glyphs_context_t :
unsigned int debug_depth; unsigned int debug_depth;
hb_collect_glyphs_context_t (hb_face_t *face_, hb_collect_glyphs_context_t (hb_face_t *face_,
hb_set_t *glyphs_before, /* OUT. May be nullptr */ hb_set_t *glyphs_before, /* OUT. May be NULL */
hb_set_t *glyphs_input, /* OUT. May be nullptr */ hb_set_t *glyphs_input, /* OUT. May be NULL */
hb_set_t *glyphs_after, /* OUT. May be nullptr */ hb_set_t *glyphs_after, /* OUT. May be NULL */
hb_set_t *glyphs_output, /* OUT. May be nullptr */ hb_set_t *glyphs_output, /* OUT. May be NULL */
unsigned int nesting_level_left_ = HB_MAX_NESTING_LEVEL) : unsigned int nesting_level_left_ = HB_MAX_NESTING_LEVEL) :
face (face_), face (face_),
before (glyphs_before ? glyphs_before : hb_set_get_empty ()), before (glyphs_before ? glyphs_before : hb_set_get_empty ()),

View File

@ -872,10 +872,10 @@ void
hb_ot_layout_lookup_collect_glyphs (hb_face_t *face, hb_ot_layout_lookup_collect_glyphs (hb_face_t *face,
hb_tag_t table_tag, hb_tag_t table_tag,
unsigned int lookup_index, unsigned int lookup_index,
hb_set_t *glyphs_before, /* OUT. May be nullptr */ hb_set_t *glyphs_before, /* OUT. May be NULL */
hb_set_t *glyphs_input, /* OUT. May be nullptr */ hb_set_t *glyphs_input, /* OUT. May be NULL */
hb_set_t *glyphs_after, /* OUT. May be nullptr */ hb_set_t *glyphs_after, /* OUT. May be NULL */
hb_set_t *glyphs_output /* OUT. May be nullptr */) hb_set_t *glyphs_output /* OUT. May be NULL */)
{ {
if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return; if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return;
@ -1073,11 +1073,11 @@ hb_ot_layout_position_finish_offsets (hb_font_t *font, hb_buffer_t *buffer)
**/ **/
hb_bool_t hb_bool_t
hb_ot_layout_get_size_params (hb_face_t *face, hb_ot_layout_get_size_params (hb_face_t *face,
unsigned int *design_size, /* OUT. May be nullptr */ unsigned int *design_size, /* OUT. May be NULL */
unsigned int *subfamily_id, /* OUT. May be nullptr */ unsigned int *subfamily_id, /* OUT. May be NULL */
unsigned int *subfamily_name_id, /* OUT. May be nullptr */ unsigned int *subfamily_name_id, /* OUT. May be NULL */
unsigned int *range_start, /* OUT. May be nullptr */ unsigned int *range_start, /* OUT. May be NULL */
unsigned int *range_end /* OUT. May be nullptr */) unsigned int *range_end /* OUT. May be NULL */)
{ {
const OT::GPOS &gpos = _get_gpos (face); const OT::GPOS &gpos = _get_gpos (face);
const hb_tag_t tag = HB_TAG ('s','i','z','e'); const hb_tag_t tag = HB_TAG ('s','i','z','e');
@ -1092,26 +1092,22 @@ hb_ot_layout_get_size_params (hb_face_t *face,
if (params.designSize) if (params.designSize)
{ {
#define PARAM(a, A) if (a) *a = params.A if (design_size) *design_size = params.designSize;
PARAM (design_size, designSize); if (subfamily_id) *subfamily_id = params.subfamilyID;
PARAM (subfamily_id, subfamilyID); if (subfamily_name_id) *subfamily_name_id = params.subfamilyNameID;
PARAM (subfamily_name_id, subfamilyNameID); if (range_start) *range_start = params.rangeStart;
PARAM (range_start, rangeStart); if (range_end) *range_end = params.rangeEnd;
PARAM (range_end, rangeEnd);
#undef PARAM
return true; return true;
} }
} }
} }
#define PARAM(a, A) if (a) *a = 0 if (design_size) *design_size = 0;
PARAM (design_size, designSize); if (subfamily_id) *subfamily_id = 0;
PARAM (subfamily_id, subfamilyID); if (subfamily_name_id) *subfamily_name_id = 0;
PARAM (subfamily_name_id, subfamilyNameID); if (range_start) *range_start = 0;
PARAM (range_start, rangeStart); if (range_end) *range_end = 0;
PARAM (range_end, rangeEnd);
#undef PARAM
return false; return false;
} }
@ -1162,34 +1158,32 @@ hb_ot_layout_feature_get_name_ids (hb_face_t *face,
feature_params.get_stylistic_set_params (feature_tag); feature_params.get_stylistic_set_params (feature_tag);
if (&ss_params != &Null (OT::FeatureParamsStylisticSet)) /* ssXX */ if (&ss_params != &Null (OT::FeatureParamsStylisticSet)) /* ssXX */
{ {
#define PARAM(a, A) if (a) *a = A if (label_id) *label_id = ss_params.uiNameID;
PARAM(label_id, ss_params.uiNameID);
// ssXX features don't have the rest // ssXX features don't have the rest
PARAM(tooltip_id, HB_NAME_ID_INVALID); if (tooltip_id) *tooltip_id = HB_NAME_ID_INVALID;
PARAM(sample_id, HB_NAME_ID_INVALID); if (sample_id) *sample_id = HB_NAME_ID_INVALID;
PARAM(num_named_parameters, 0); if (num_named_parameters) *num_named_parameters = 0;
PARAM(first_param_id, HB_NAME_ID_INVALID); if (first_param_id) *first_param_id = HB_NAME_ID_INVALID;
return true; return true;
} }
const OT::FeatureParamsCharacterVariants& cv_params = const OT::FeatureParamsCharacterVariants& cv_params =
feature_params.get_character_variants_params (feature_tag); feature_params.get_character_variants_params (feature_tag);
if (&cv_params != &Null (OT::FeatureParamsCharacterVariants)) /* cvXX */ if (&cv_params != &Null (OT::FeatureParamsCharacterVariants)) /* cvXX */
{ {
PARAM(label_id, cv_params.featUILableNameID); if (label_id) *label_id = cv_params.featUILableNameID;
PARAM(tooltip_id, cv_params.featUITooltipTextNameID); if (tooltip_id) *tooltip_id = cv_params.featUITooltipTextNameID;
PARAM(sample_id, cv_params.sampleTextNameID); if (sample_id) *sample_id = cv_params.sampleTextNameID;
PARAM(num_named_parameters, cv_params.numNamedParameters); if (num_named_parameters) *num_named_parameters = cv_params.numNamedParameters;
PARAM(first_param_id, cv_params.firstParamUILabelNameID); if (first_param_id) *first_param_id = cv_params.firstParamUILabelNameID;
return true; return true;
} }
} }
PARAM(label_id, HB_NAME_ID_INVALID); if (label_id) *label_id = HB_NAME_ID_INVALID;
PARAM(tooltip_id, HB_NAME_ID_INVALID); if (tooltip_id) *tooltip_id = HB_NAME_ID_INVALID;
PARAM(sample_id, HB_NAME_ID_INVALID); if (sample_id) *sample_id = HB_NAME_ID_INVALID;
PARAM(num_named_parameters, 0); if (num_named_parameters) *num_named_parameters = 0;
PARAM(first_param_id, HB_NAME_ID_INVALID); if (first_param_id) *first_param_id = HB_NAME_ID_INVALID;
#undef PARAM
return false; return false;
} }
@ -1232,8 +1226,7 @@ hb_ot_layout_feature_get_characters (hb_face_t *face,
const OT::FeatureParamsCharacterVariants& cv_params = const OT::FeatureParamsCharacterVariants& cv_params =
feature_params.get_character_variants_params(feature_tag); feature_params.get_character_variants_params(feature_tag);
if (&cv_params != &Null (OT::FeatureParamsCharacterVariants))
{
unsigned int len = 0; unsigned int len = 0;
if (char_count && characters && start_offset < cv_params.characters.len) if (char_count && characters && start_offset < cv_params.characters.len)
{ {
@ -1241,15 +1234,9 @@ hb_ot_layout_feature_get_characters (hb_face_t *face,
for (unsigned int i = 0; i < len; ++i) for (unsigned int i = 0; i < len; ++i)
characters[i] = cv_params.characters[start_offset + i]; characters[i] = cv_params.characters[start_offset + i];
} }
#define PARAM(a, A) if (a) *a = A if (char_count) *char_count = len;
PARAM(char_count, len);
return cv_params.characters.len; return cv_params.characters.len;
} }
PARAM(char_count, 0);
PARAM(characters, 0);
#undef PARAM
return 0;
}
/* /*

View File

@ -331,6 +331,7 @@ hb_ot_layout_get_size_params (hb_face_t *face,
unsigned int *range_start, /* OUT. May be NULL */ unsigned int *range_start, /* OUT. May be NULL */
unsigned int *range_end /* OUT. May be NULL */); unsigned int *range_end /* OUT. May be NULL */);
HB_EXTERN hb_bool_t HB_EXTERN hb_bool_t
hb_ot_layout_feature_get_name_ids (hb_face_t *face, hb_ot_layout_feature_get_name_ids (hb_face_t *face,
hb_tag_t table_tag, hb_tag_t table_tag,

View File

@ -50,7 +50,7 @@ struct MathValueRecord
protected: protected:
HBINT16 value; /* The X or Y value in design units */ HBINT16 value; /* The X or Y value in design units */
OffsetTo<Device> deviceTable; /* Offset to the device table - from the OffsetTo<Device> deviceTable; /* Offset to the device table - from the
* beginning of parent table. May be nullptr. * beginning of parent table. May be NULL.
* Suggested format for device table is 1. */ * Suggested format for device table is 1. */
public: public:
@ -318,7 +318,7 @@ struct MathKernInfoRecord
protected: protected:
/* Offset to MathKern table for each corner - /* Offset to MathKern table for each corner -
* from the beginning of MathKernInfo table. May be nullptr. */ * from the beginning of MathKernInfo table. May be NULL. */
OffsetTo<MathKern> mathKern[4]; OffsetTo<MathKern> mathKern[4];
public: public:
@ -401,7 +401,7 @@ struct MathGlyphInfo
* from the beginning of MathGlyphInfo table. When the left or right glyph of * from the beginning of MathGlyphInfo table. When the left or right glyph of
* a box is an extended shape variant, the (ink) box (and not the default * a box is an extended shape variant, the (ink) box (and not the default
* position defined by values in MathConstants table) should be used for * position defined by values in MathConstants table) should be used for
* vertical positioning purposes. May be nullptr.. */ * vertical positioning purposes. May be NULL.. */
OffsetTo<Coverage> extendedShapeCoverage; OffsetTo<Coverage> extendedShapeCoverage;
/* Offset to MathKernInfo table - /* Offset to MathKernInfo table -
@ -570,7 +570,7 @@ struct MathGlyphConstruction
protected: protected:
/* Offset to MathGlyphAssembly table for this shape - from the beginning of /* Offset to MathGlyphAssembly table for this shape - from the beginning of
MathGlyphConstruction table. May be nullptr. */ MathGlyphConstruction table. May be NULL. */
OffsetTo<MathGlyphAssembly> glyphAssembly; OffsetTo<MathGlyphAssembly> glyphAssembly;
/* MathGlyphVariantRecords for alternative variants of the glyphs. */ /* MathGlyphVariantRecords for alternative variants of the glyphs. */

View File

@ -48,7 +48,6 @@ typedef unsigned int hb_name_id_t;
**/ **/
#define HB_NAME_ID_INVALID 0xFFFF #define HB_NAME_ID_INVALID 0xFFFF
HB_END_DECLS HB_END_DECLS
#endif /* HB_OT_NAME_H */ #endif /* HB_OT_NAME_H */

View File

@ -69,7 +69,7 @@ struct hb_ot_complex_shaper_t
/* collect_features() /* collect_features()
* Called during shape_plan(). * Called during shape_plan().
* Shapers should use plan->map to add their features and callbacks. * Shapers should use plan->map to add their features and callbacks.
* May be nullptr. * May be NULL.
*/ */
void (*collect_features) (hb_ot_shape_planner_t *plan); void (*collect_features) (hb_ot_shape_planner_t *plan);
@ -77,7 +77,7 @@ struct hb_ot_complex_shaper_t
* Called during shape_plan(). * Called during shape_plan().
* Shapers should use plan->map to override features and add callbacks after * Shapers should use plan->map to override features and add callbacks after
* common features are added. * common features are added.
* May be nullptr. * May be NULL.
*/ */
void (*override_features) (hb_ot_shape_planner_t *plan); void (*override_features) (hb_ot_shape_planner_t *plan);
@ -93,7 +93,7 @@ struct hb_ot_complex_shaper_t
* Called when the shape_plan is being destroyed. * Called when the shape_plan is being destroyed.
* plan->data is passed here for destruction. * plan->data is passed here for destruction.
* If nullptr is returned, means a plan failure. * If nullptr is returned, means a plan failure.
* May be nullptr. * May be NULL.
*/ */
void (*data_destroy) (void *data); void (*data_destroy) (void *data);
@ -101,7 +101,7 @@ struct hb_ot_complex_shaper_t
/* preprocess_text() /* preprocess_text()
* Called during shape(). * Called during shape().
* Shapers can use to modify text before shaping starts. * Shapers can use to modify text before shaping starts.
* May be nullptr. * May be NULL.
*/ */
void (*preprocess_text) (const hb_ot_shape_plan_t *plan, void (*preprocess_text) (const hb_ot_shape_plan_t *plan,
hb_buffer_t *buffer, hb_buffer_t *buffer,
@ -110,7 +110,7 @@ struct hb_ot_complex_shaper_t
/* postprocess_glyphs() /* postprocess_glyphs()
* Called during shape(). * Called during shape().
* Shapers can use to modify glyphs after shaping ends. * Shapers can use to modify glyphs after shaping ends.
* May be nullptr. * May be NULL.
*/ */
void (*postprocess_glyphs) (const hb_ot_shape_plan_t *plan, void (*postprocess_glyphs) (const hb_ot_shape_plan_t *plan,
hb_buffer_t *buffer, hb_buffer_t *buffer,
@ -121,7 +121,7 @@ struct hb_ot_complex_shaper_t
/* decompose() /* decompose()
* Called during shape()'s normalization. * Called during shape()'s normalization.
* May be nullptr. * May be NULL.
*/ */
bool (*decompose) (const hb_ot_shape_normalize_context_t *c, bool (*decompose) (const hb_ot_shape_normalize_context_t *c,
hb_codepoint_t ab, hb_codepoint_t ab,
@ -130,7 +130,7 @@ struct hb_ot_complex_shaper_t
/* compose() /* compose()
* Called during shape()'s normalization. * Called during shape()'s normalization.
* May be nullptr. * May be NULL.
*/ */
bool (*compose) (const hb_ot_shape_normalize_context_t *c, bool (*compose) (const hb_ot_shape_normalize_context_t *c,
hb_codepoint_t a, hb_codepoint_t a,
@ -141,7 +141,7 @@ struct hb_ot_complex_shaper_t
* Called during shape(). * Called during shape().
* Shapers should use map to get feature masks and set on buffer. * Shapers should use map to get feature masks and set on buffer.
* Shapers may NOT modify characters. * Shapers may NOT modify characters.
* May be nullptr. * May be NULL.
*/ */
void (*setup_masks) (const hb_ot_shape_plan_t *plan, void (*setup_masks) (const hb_ot_shape_plan_t *plan,
hb_buffer_t *buffer, hb_buffer_t *buffer,
@ -156,7 +156,7 @@ struct hb_ot_complex_shaper_t
/* reorder_marks() /* reorder_marks()
* Called during shape(). * Called during shape().
* Shapers can use to modify ordering of combining marks. * Shapers can use to modify ordering of combining marks.
* May be nullptr. * May be NULL.
*/ */
void (*reorder_marks) (const hb_ot_shape_plan_t *plan, void (*reorder_marks) (const hb_ot_shape_plan_t *plan,
hb_buffer_t *buffer, hb_buffer_t *buffer,