diff --git a/src/hb-ot-layout-common-private.hh b/src/hb-ot-layout-common-private.hh index ea61f5c1bd5f872e5794b71f89e3ae8661549a82..84a163575c4353db4d50e9d21c1efaf3a48b6611 100644 --- a/src/hb-ot-layout-common-private.hh +++ b/src/hb-ot-layout-common-private.hh @@ -34,6 +34,14 @@ #include "hb-set-private.hh" +#ifndef HB_MAX_NESTING_LEVEL +#define HB_MAX_NESTING_LEVEL 6 +#endif +#ifndef HB_MAX_CONTEXT_LENGTH +#define HB_MAX_CONTEXT_LENGTH 64 +#endif + + namespace OT { @@ -44,8 +52,6 @@ namespace OT { #define NOT_COVERED ((unsigned int) -1) -#define MAX_NESTING_LEVEL 6 -#define MAX_CONTEXT_LENGTH 64 diff --git a/src/hb-ot-layout-gsub-table.hh b/src/hb-ot-layout-gsub-table.hh index eebc87b4c59caa416f2c796f020a389cff430c36..459a1a3dd5c49608f3b3fc892f366fe828320ead 100644 --- a/src/hb-ot-layout-gsub-table.hh +++ b/src/hb-ot-layout-gsub-table.hh @@ -630,7 +630,7 @@ struct Ligature unsigned int total_component_count = 0; unsigned int match_length = 0; - unsigned int match_positions[MAX_CONTEXT_LENGTH]; + unsigned int match_positions[HB_MAX_CONTEXT_LENGTH]; if (likely (!match_input (c, count, &component[1], @@ -970,7 +970,7 @@ struct ReverseChainSingleSubstFormat1 inline bool apply (hb_apply_context_t *c) const { TRACE_APPLY (this); - if (unlikely (c->nesting_level_left != MAX_NESTING_LEVEL)) + if (unlikely (c->nesting_level_left != HB_MAX_NESTING_LEVEL)) return_trace (false); /* No chaining to this type */ unsigned int index = (this+coverage).get_coverage (c->buffer->cur().codepoint); diff --git a/src/hb-ot-layout-gsubgpos-private.hh b/src/hb-ot-layout-gsubgpos-private.hh index 230b3b6851bd209ae9684e355e4502686bcc371b..fb411db1132d06dd7823ed96baf9a94195069f8f 100644 --- a/src/hb-ot-layout-gsubgpos-private.hh +++ b/src/hb-ot-layout-gsubgpos-private.hh @@ -74,7 +74,7 @@ struct hb_closure_context_t : hb_closure_context_t (hb_face_t *face_, hb_set_t *glyphs_, - unsigned int nesting_level_left_ = MAX_NESTING_LEVEL) : + unsigned int nesting_level_left_ = HB_MAX_NESTING_LEVEL) : face (face_), glyphs (glyphs_), recurse_func (NULL), @@ -196,7 +196,7 @@ struct hb_collect_glyphs_context_t : hb_set_t *glyphs_input, /* OUT. May be NULL */ hb_set_t *glyphs_after, /* OUT. May be NULL */ hb_set_t *glyphs_output, /* OUT. May be NULL */ - unsigned int nesting_level_left_ = MAX_NESTING_LEVEL) : + unsigned int nesting_level_left_ = HB_MAX_NESTING_LEVEL) : face (face_), before (glyphs_before ? glyphs_before : hb_set_get_empty ()), input (glyphs_input ? glyphs_input : hb_set_get_empty ()), @@ -483,7 +483,7 @@ struct hb_apply_context_t : lookup_mask (1), auto_zwj (true), recurse_func (NULL), - nesting_level_left (MAX_NESTING_LEVEL), + nesting_level_left (HB_MAX_NESTING_LEVEL), lookup_props (0), gdef (*hb_ot_layout_from_face (face)->gdef), has_glyph_classes (gdef.has_glyph_classes ()), @@ -704,13 +704,13 @@ static inline bool match_input (hb_apply_context_t *c, match_func_t match_func, const void *match_data, unsigned int *end_offset, - unsigned int match_positions[MAX_CONTEXT_LENGTH], + unsigned int match_positions[HB_MAX_CONTEXT_LENGTH], bool *p_is_mark_ligature = NULL, unsigned int *p_total_component_count = NULL) { TRACE_APPLY (NULL); - if (unlikely (count > MAX_CONTEXT_LENGTH)) return_trace (false); + if (unlikely (count > HB_MAX_CONTEXT_LENGTH)) return_trace (false); hb_buffer_t *buffer = c->buffer; @@ -784,7 +784,7 @@ static inline bool match_input (hb_apply_context_t *c, } static inline bool ligate_input (hb_apply_context_t *c, unsigned int count, /* Including the first glyph */ - unsigned int match_positions[MAX_CONTEXT_LENGTH], /* Including the first glyph */ + unsigned int match_positions[HB_MAX_CONTEXT_LENGTH], /* Including the first glyph */ unsigned int match_length, hb_codepoint_t lig_glyph, bool is_mark_ligature, @@ -944,7 +944,7 @@ static inline void recurse_lookups (context_t *c, static inline bool apply_lookup (hb_apply_context_t *c, unsigned int count, /* Including the first glyph */ - unsigned int match_positions[MAX_CONTEXT_LENGTH], /* Including the first glyph */ + unsigned int match_positions[HB_MAX_CONTEXT_LENGTH], /* Including the first glyph */ unsigned int lookupCount, const LookupRecord lookupRecord[], /* Array of LookupRecords--in design order */ unsigned int match_length) @@ -995,7 +995,7 @@ static inline bool apply_lookup (hb_apply_context_t *c, if (delta > 0) { - if (unlikely (delta + count > MAX_CONTEXT_LENGTH)) + if (unlikely (delta + count > HB_MAX_CONTEXT_LENGTH)) break; } else @@ -1094,7 +1094,7 @@ static inline bool context_apply_lookup (hb_apply_context_t *c, ContextApplyLookupContext &lookup_context) { unsigned int match_length = 0; - unsigned int match_positions[MAX_CONTEXT_LENGTH]; + unsigned int match_positions[HB_MAX_CONTEXT_LENGTH]; return match_input (c, inputCount, input, lookup_context.funcs.match, lookup_context.match_data, @@ -1621,7 +1621,7 @@ static inline bool chain_context_apply_lookup (hb_apply_context_t *c, ChainContextApplyLookupContext &lookup_context) { unsigned int match_length = 0; - unsigned int match_positions[MAX_CONTEXT_LENGTH]; + unsigned int match_positions[HB_MAX_CONTEXT_LENGTH]; return match_input (c, inputCount, input, lookup_context.funcs.match, lookup_context.match_data[1],