提交 7e53ebe4 编写于 作者: B Behdad Esfahbod

Remove the IN_CURGLYPH() macro

上级 d784da19
......@@ -155,9 +155,6 @@ struct _hb_buffer_t {
#define BUFFER buffer
#endif
/* convenience macros */
#define IN_CURGLYPH() (BUFFER->in_string[BUFFER->in_pos].codepoint)
HB_END_DECLS
#endif /* HB_BUFFER_PRIVATE_H */
......@@ -403,7 +403,7 @@ struct MarkArray : ArrayOf<MarkRecord> /* 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);
mark_anchor.get_anchor (c->layout, c->buffer->in_string[c->buffer->in_pos].codepoint, &mark_x, &mark_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];
......@@ -434,7 +434,7 @@ struct SinglePosFormat1
inline bool apply (hb_apply_context_t *c) const
{
TRACE_APPLY ();
unsigned int index = (this+coverage) (IN_CURGLYPH ());
unsigned int index = (this+coverage) (c->buffer->in_string[c->buffer->in_pos].codepoint);
if (likely (index == NOT_COVERED))
return false;
......@@ -473,7 +473,7 @@ struct SinglePosFormat2
inline bool apply (hb_apply_context_t *c) const
{
TRACE_APPLY ();
unsigned int index = (this+coverage) (IN_CURGLYPH ());
unsigned int index = (this+coverage) (c->buffer->in_string[c->buffer->in_pos].codepoint);
if (likely (index == NOT_COVERED))
return false;
......@@ -627,7 +627,7 @@ struct PairPosFormat1
if (unlikely (c->buffer->in_pos + 2 > end))
return false;
unsigned int index = (this+coverage) (IN_CURGLYPH ());
unsigned int index = (this+coverage) (c->buffer->in_string[c->buffer->in_pos].codepoint);
if (likely (index == NOT_COVERED))
return false;
......@@ -689,7 +689,7 @@ struct PairPosFormat2
if (unlikely (c->buffer->in_pos + 2 > end))
return false;
unsigned int index = (this+coverage) (IN_CURGLYPH ());
unsigned int index = (this+coverage) (c->buffer->in_string[c->buffer->in_pos].codepoint);
if (likely (index == NOT_COVERED))
return false;
......@@ -705,7 +705,7 @@ struct PairPosFormat2
unsigned int len2 = valueFormat2.get_len ();
unsigned int record_len = len1 + len2;
unsigned int klass1 = (this+classDef1) (IN_CURGLYPH ());
unsigned int klass1 = (this+classDef1) (c->buffer->in_string[c->buffer->in_pos].codepoint);
unsigned int klass2 = (this+classDef2) (c->buffer->in_string[j].codepoint);
if (unlikely (klass1 >= class1Count || klass2 >= class2Count))
return false;
......@@ -958,7 +958,7 @@ struct CursivePosFormat1
if (c->property == HB_OT_LAYOUT_GLYPH_CLASS_MARK)
return false;
unsigned int index = (this+coverage) (IN_CURGLYPH ());
unsigned int index = (this+coverage) (c->buffer->in_string[c->buffer->in_pos].codepoint);
if (likely (index == NOT_COVERED))
return false;
......@@ -968,7 +968,7 @@ struct CursivePosFormat1
goto end;
hb_position_t entry_x, entry_y;
(this+record.entryAnchor).get_anchor (c->layout, IN_CURGLYPH (), &entry_x, &entry_y);
(this+record.entryAnchor).get_anchor (c->layout, c->buffer->in_string[c->buffer->in_pos].codepoint, &entry_x, &entry_y);
/* TODO vertical */
......@@ -998,7 +998,7 @@ struct CursivePosFormat1
if (record.exitAnchor)
{
gpi->last = c->buffer->in_pos;
(this+record.exitAnchor).get_anchor (c->layout, IN_CURGLYPH (), &gpi->anchor_x, &gpi->anchor_y);
(this+record.exitAnchor).get_anchor (c->layout, c->buffer->in_string[c->buffer->in_pos].codepoint, &gpi->anchor_x, &gpi->anchor_y);
}
c->buffer->in_pos++;
......@@ -1067,7 +1067,7 @@ struct MarkBasePosFormat1
inline bool apply (hb_apply_context_t *c) const
{
TRACE_APPLY ();
unsigned int mark_index = (this+markCoverage) (IN_CURGLYPH ());
unsigned int mark_index = (this+markCoverage) (c->buffer->in_string[c->buffer->in_pos].codepoint);
if (likely (mark_index == NOT_COVERED))
return false;
......@@ -1169,7 +1169,7 @@ struct MarkLigPosFormat1
inline bool apply (hb_apply_context_t *c) const
{
TRACE_APPLY ();
unsigned int mark_index = (this+markCoverage) (IN_CURGLYPH ());
unsigned int mark_index = (this+markCoverage) (c->buffer->in_string[c->buffer->in_pos].codepoint);
if (likely (mark_index == NOT_COVERED))
return false;
......@@ -1288,7 +1288,7 @@ struct MarkMarkPosFormat1
inline bool apply (hb_apply_context_t *c) const
{
TRACE_APPLY ();
unsigned int mark1_index = (this+mark1Coverage) (IN_CURGLYPH ());
unsigned int mark1_index = (this+mark1Coverage) (c->buffer->in_string[c->buffer->in_pos].codepoint);
if (likely (mark1_index == NOT_COVERED))
return false;
......
......@@ -43,7 +43,7 @@ struct SingleSubstFormat1
inline bool apply (hb_apply_context_t *c) const
{
TRACE_APPLY ();
hb_codepoint_t glyph_id = IN_CURGLYPH ();
hb_codepoint_t glyph_id = c->buffer->in_string[c->buffer->in_pos].codepoint;
unsigned int index = (this+coverage) (glyph_id);
if (likely (index == NOT_COVERED))
return false;
......@@ -84,7 +84,7 @@ struct SingleSubstFormat2
inline bool apply (hb_apply_context_t *c) const
{
TRACE_APPLY ();
hb_codepoint_t glyph_id = IN_CURGLYPH ();
hb_codepoint_t glyph_id = c->buffer->in_string[c->buffer->in_pos].codepoint;
unsigned int index = (this+coverage) (glyph_id);
if (likely (index == NOT_COVERED))
return false;
......@@ -208,7 +208,7 @@ struct MultipleSubstFormat1
{
TRACE_APPLY ();
unsigned int index = (this+coverage) (IN_CURGLYPH ());
unsigned int index = (this+coverage) (c->buffer->in_string[c->buffer->in_pos].codepoint);
if (likely (index == NOT_COVERED))
return false;
......@@ -277,7 +277,7 @@ struct AlternateSubstFormat1
inline bool apply (hb_apply_context_t *c) const
{
TRACE_APPLY ();
hb_codepoint_t glyph_id = IN_CURGLYPH ();
hb_codepoint_t glyph_id = c->buffer->in_string[c->buffer->in_pos].codepoint;
unsigned int index = (this+coverage) (glyph_id);
if (likely (index == NOT_COVERED))
......@@ -420,7 +420,7 @@ struct Ligature
for ( i = 1; i < count; i++ )
{
while (_hb_ot_layout_skip_mark (c->layout->face, &c->buffer->in_string[c->buffer->in_pos], c->lookup_flag, NULL))
c->buffer->add_output_glyph (IN_CURGLYPH (), i, lig_id);
c->buffer->add_output_glyph (c->buffer->in_string[c->buffer->in_pos].codepoint, i, lig_id);
(c->buffer->in_pos)++;
}
......@@ -487,7 +487,7 @@ struct LigatureSubstFormat1
inline bool apply (hb_apply_context_t *c) const
{
TRACE_APPLY ();
hb_codepoint_t glyph_id = IN_CURGLYPH ();
hb_codepoint_t glyph_id = c->buffer->in_string[c->buffer->in_pos].codepoint;
bool first_is_mark = !!(c->property & HB_OT_LAYOUT_GLYPH_CLASS_MARK);
......@@ -608,7 +608,7 @@ struct ReverseChainSingleSubstFormat1
if (unlikely (c->context_length != NO_CONTEXT))
return false; /* No chaining to this type */
unsigned int index = (this+coverage) (IN_CURGLYPH ());
unsigned int index = (this+coverage) (c->buffer->in_string[c->buffer->in_pos].codepoint);
if (likely (index == NOT_COVERED))
return false;
......@@ -623,7 +623,7 @@ struct ReverseChainSingleSubstFormat1
match_coverage, this,
1))
{
IN_CURGLYPH () = substitute[index];
c->buffer->in_string[c->buffer->in_pos].codepoint = substitute[index];
c->buffer->in_pos--; /* Reverse! */
return true;
}
......
......@@ -342,7 +342,7 @@ struct ContextFormat1
inline bool apply (hb_apply_context_t *c, apply_lookup_func_t apply_func) const
{
TRACE_APPLY ();
unsigned int index = (this+coverage) (IN_CURGLYPH ());
unsigned int index = (this+coverage) (c->buffer->in_string[c->buffer->in_pos].codepoint);
if (likely (index == NOT_COVERED))
return false;
......@@ -381,12 +381,12 @@ struct ContextFormat2
inline bool apply (hb_apply_context_t *c, apply_lookup_func_t apply_func) const
{
TRACE_APPLY ();
unsigned int index = (this+coverage) (IN_CURGLYPH ());
unsigned int index = (this+coverage) (c->buffer->in_string[c->buffer->in_pos].codepoint);
if (likely (index == NOT_COVERED))
return false;
const ClassDef &class_def = this+classDef;
index = class_def (IN_CURGLYPH ());
index = class_def (c->buffer->in_string[c->buffer->in_pos].codepoint);
const RuleSet &rule_set = this+ruleSet[index];
/* LONGTERMTODO: Old code fetches glyph classes at most once and caches
* them across subrule lookups. Not sure it's worth it.
......@@ -429,7 +429,7 @@ struct ContextFormat3
inline bool apply (hb_apply_context_t *c, apply_lookup_func_t apply_func) const
{
TRACE_APPLY ();
unsigned int index = (this+coverage[0]) (IN_CURGLYPH ());
unsigned int index = (this+coverage[0]) (c->buffer->in_string[c->buffer->in_pos].codepoint);
if (likely (index == NOT_COVERED))
return false;
......@@ -633,7 +633,7 @@ struct ChainContextFormat1
inline bool apply (hb_apply_context_t *c, apply_lookup_func_t apply_func) const
{
TRACE_APPLY ();
unsigned int index = (this+coverage) (IN_CURGLYPH ());
unsigned int index = (this+coverage) (c->buffer->in_string[c->buffer->in_pos].codepoint);
if (likely (index == NOT_COVERED))
return false;
......@@ -671,7 +671,7 @@ struct ChainContextFormat2
inline bool apply (hb_apply_context_t *c, apply_lookup_func_t apply_func) const
{
TRACE_APPLY ();
unsigned int index = (this+coverage) (IN_CURGLYPH ());
unsigned int index = (this+coverage) (c->buffer->in_string[c->buffer->in_pos].codepoint);
if (likely (index == NOT_COVERED))
return false;
......@@ -679,7 +679,7 @@ struct ChainContextFormat2
const ClassDef &input_class_def = this+inputClassDef;
const ClassDef &lookahead_class_def = this+lookaheadClassDef;
index = input_class_def (IN_CURGLYPH ());
index = input_class_def (c->buffer->in_string[c->buffer->in_pos].codepoint);
const ChainRuleSet &rule_set = this+ruleSet[index];
/* LONGTERMTODO: Old code fetches glyph classes at most once and caches
* them across subrule lookups. Not sure it's worth it.
......@@ -737,7 +737,7 @@ struct ChainContextFormat3
TRACE_APPLY ();
const OffsetArrayOf<Coverage> &input = StructAfter<OffsetArrayOf<Coverage> > (backtrack);
unsigned int index = (this+input[0]) (IN_CURGLYPH ());
unsigned int index = (this+input[0]) (c->buffer->in_string[c->buffer->in_pos].codepoint);
if (likely (index == NOT_COVERED))
return false;
......
......@@ -50,7 +50,7 @@ hb_form_clusters (hb_buffer_t *buffer)
count = buffer->in_length;
for (buffer->in_pos = 1; buffer->in_pos < count; buffer->in_pos++)
if (buffer->unicode->get_general_category (IN_CURGLYPH()) == HB_CATEGORY_NON_SPACING_MARK)
if (buffer->unicode->get_general_category (buffer->in_string[buffer->in_pos].codepoint) == HB_CATEGORY_NON_SPACING_MARK)
buffer->in_string[buffer->in_pos].cluster = buffer->in_string[buffer->in_pos - 1].cluster;
}
......@@ -84,7 +84,7 @@ hb_mirror_chars (hb_buffer_t *buffer)
count = buffer->in_length;
for (buffer->in_pos = 0; buffer->in_pos < count; buffer->in_pos++) {
IN_CURGLYPH() = get_mirroring (IN_CURGLYPH());
buffer->in_string[buffer->in_pos].codepoint = get_mirroring (buffer->in_string[buffer->in_pos].codepoint);
}
}
......@@ -100,13 +100,13 @@ hb_map_glyphs (hb_font_t *font,
count = buffer->in_length - 1;
for (buffer->in_pos = 0; buffer->in_pos < count; buffer->in_pos++) {
if (unlikely (is_variation_selector (buffer->in_string[buffer->in_pos + 1].codepoint))) {
IN_CURGLYPH() = hb_font_get_glyph (font, face, IN_CURGLYPH(), buffer->in_string[buffer->in_pos + 1].codepoint);
buffer->in_string[buffer->in_pos].codepoint = hb_font_get_glyph (font, face, buffer->in_string[buffer->in_pos].codepoint, buffer->in_string[buffer->in_pos + 1].codepoint);
buffer->in_pos++;
} else {
IN_CURGLYPH() = hb_font_get_glyph (font, face, IN_CURGLYPH(), 0);
buffer->in_string[buffer->in_pos].codepoint = hb_font_get_glyph (font, face, buffer->in_string[buffer->in_pos].codepoint, 0);
}
}
IN_CURGLYPH() = hb_font_get_glyph (font, face, IN_CURGLYPH(), 0);
buffer->in_string[buffer->in_pos].codepoint = hb_font_get_glyph (font, face, buffer->in_string[buffer->in_pos].codepoint, 0);
}
static void
......@@ -157,7 +157,7 @@ hb_position_default (hb_font_t *font,
count = buffer->in_length;
for (buffer->in_pos = 0; buffer->in_pos < count; buffer->in_pos++) {
hb_glyph_metrics_t metrics;
hb_font_get_glyph_metrics (font, face, IN_CURGLYPH(), &metrics);
hb_font_get_glyph_metrics (font, face, buffer->in_string[buffer->in_pos].codepoint, &metrics);
buffer->positions[buffer->in_pos].x_advance = metrics.x_advance;
buffer->positions[buffer->in_pos].y_advance = metrics.y_advance;
}
......@@ -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, buffer->in_string[buffer->in_pos - 1].codepoint, IN_CURGLYPH());
kern = hb_font_get_kerning (font, face, buffer->in_string[buffer->in_pos - 1].codepoint, buffer->in_string[buffer->in_pos].codepoint);
kern1 = kern >> 1;
kern2 = kern - kern1;
buffer->positions[buffer->in_pos - 1].x_advance += kern1;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册