From 6e489cdf7623ac627d06d59a80ecea03ca97dc1b Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Fri, 14 May 2010 21:07:35 -0400 Subject: [PATCH] Remove the IN_GLYPH() macro --- src/hb-buffer-private.hh | 1 - src/hb-ot-layout-gpos-private.hh | 12 ++++++------ src/hb-ot-layout-gsub-private.hh | 2 +- src/hb-ot-layout-gsubgpos-private.hh | 4 ++-- src/hb-shape.cc | 2 +- 5 files changed, 10 insertions(+), 11 deletions(-) diff --git a/src/hb-buffer-private.hh b/src/hb-buffer-private.hh index 86e30de8d..6f0576702 100644 --- a/src/hb-buffer-private.hh +++ b/src/hb-buffer-private.hh @@ -156,7 +156,6 @@ struct _hb_buffer_t { #endif /* convenience macros */ -#define IN_GLYPH(pos) (BUFFER->in_string[(pos)].codepoint) #define IN_INFO(pos) (&BUFFER->in_string[(pos)]) #define IN_CURGLYPH() (BUFFER->in_string[BUFFER->in_pos].codepoint) #define IN_NEXTGLYPH() (BUFFER->in_string[BUFFER->in_pos + 1].codepoint) diff --git a/src/hb-ot-layout-gpos-private.hh b/src/hb-ot-layout-gpos-private.hh index 3b77f60d3..56be98f90 100644 --- a/src/hb-ot-layout-gpos-private.hh +++ b/src/hb-ot-layout-gpos-private.hh @@ -404,7 +404,7 @@ struct MarkArray : ArrayOf /* Array of MarkRecords--in Coverage orde hb_position_t mark_x, mark_y, base_x, base_y; mark_anchor.get_anchor (c->layout, IN_CURGLYPH (), &mark_x, &mark_y); - glyph_anchor.get_anchor (c->layout, IN_GLYPH (glyph_pos), &base_x, &base_y); + glyph_anchor.get_anchor (c->layout, c->buffer->in_string[glyph_pos].codepoint, &base_x, &base_y); hb_internal_glyph_position_t &o = c->buffer->positions[c->buffer->in_pos]; o.x_advance = 0; @@ -574,7 +574,7 @@ struct PairSet const PairValueRecord *record = CastP (array); for (unsigned int i = 0; i < count; i++) { - if (IN_GLYPH (pos) == record->secondGlyph) + if (c->buffer->in_string[pos].codepoint == record->secondGlyph) { valueFormats[0].apply_value (c->layout, this, &record->values[0], c->buffer->positions[c->buffer->in_pos]); valueFormats[1].apply_value (c->layout, this, &record->values[len1], c->buffer->positions[pos]); @@ -706,7 +706,7 @@ struct PairPosFormat2 unsigned int record_len = len1 + len2; unsigned int klass1 = (this+classDef1) (IN_CURGLYPH ()); - unsigned int klass2 = (this+classDef2) (IN_GLYPH (j)); + unsigned int klass2 = (this+classDef2) (c->buffer->in_string[j].codepoint); if (unlikely (klass1 >= class1Count || klass2 >= class2Count)) return false; @@ -1085,7 +1085,7 @@ struct MarkBasePosFormat1 if (false && !(property & HB_OT_LAYOUT_GLYPH_CLASS_BASE_GLYPH)) return false; - unsigned int base_index = (this+baseCoverage) (IN_GLYPH (j)); + unsigned int base_index = (this+baseCoverage) (c->buffer->in_string[j].codepoint); if (base_index == NOT_COVERED) return false; @@ -1187,7 +1187,7 @@ struct MarkLigPosFormat1 if (false && !(property & HB_OT_LAYOUT_GLYPH_CLASS_LIGATURE)) return false; - unsigned int lig_index = (this+ligatureCoverage) (IN_GLYPH (j)); + unsigned int lig_index = (this+ligatureCoverage) (c->buffer->in_string[j].codepoint); if (lig_index == NOT_COVERED) return false; @@ -1312,7 +1312,7 @@ struct MarkMarkPosFormat1 (c->buffer->in_string[j].component && c->buffer->in_string[j].lig_id != c->buffer->in_string[c->buffer->in_pos].lig_id)) return false; - unsigned int mark2_index = (this+mark2Coverage) (IN_GLYPH (j)); + unsigned int mark2_index = (this+mark2Coverage) (c->buffer->in_string[j].codepoint); if (mark2_index == NOT_COVERED) return false; diff --git a/src/hb-ot-layout-gsub-private.hh b/src/hb-ot-layout-gsub-private.hh index e57eb9790..51892aa34 100644 --- a/src/hb-ot-layout-gsub-private.hh +++ b/src/hb-ot-layout-gsub-private.hh @@ -388,7 +388,7 @@ struct Ligature if (!(property & HB_OT_LAYOUT_GLYPH_CLASS_MARK)) is_mark = false; - if (likely (IN_GLYPH (j) != component[i])) + if (likely (c->buffer->in_string[j].codepoint != component[i])) return false; } /* This is just a guess ... */ diff --git a/src/hb-ot-layout-gsubgpos-private.hh b/src/hb-ot-layout-gsubgpos-private.hh index d8aa25225..59a2d203e 100644 --- a/src/hb-ot-layout-gsubgpos-private.hh +++ b/src/hb-ot-layout-gsubgpos-private.hh @@ -106,7 +106,7 @@ static inline bool match_input (hb_apply_context_t *c, j++; } - if (likely (!match_func (IN_GLYPH (j), input[i - 1], match_data))) + if (likely (!match_func (c->buffer->in_string[j].codepoint, input[i - 1], match_data))) return false; } @@ -161,7 +161,7 @@ static inline bool match_lookahead (hb_apply_context_t *c, j++; } - if (likely (!match_func (IN_GLYPH (j), lookahead[i], match_data))) + if (likely (!match_func (c->buffer->in_string[j].codepoint, lookahead[i], match_data))) return false; } diff --git a/src/hb-shape.cc b/src/hb-shape.cc index e8ebf7063..ef2b0accc 100644 --- a/src/hb-shape.cc +++ b/src/hb-shape.cc @@ -196,7 +196,7 @@ hb_truetype_kern (hb_font_t *font, count = buffer->in_length; for (buffer->in_pos = 1; buffer->in_pos < count; buffer->in_pos++) { hb_position_t kern, kern1, kern2; - kern = hb_font_get_kerning (font, face, IN_GLYPH(buffer->in_pos - 1), IN_CURGLYPH()); + kern = hb_font_get_kerning (font, face, buffer->in_string[buffer->in_pos - 1].codepoint, IN_CURGLYPH()); kern1 = kern >> 1; kern2 = kern - kern1; buffer->positions[buffer->in_pos - 1].x_advance += kern1;