From 9bef3611f07b45ba8199a4a339c72f49d266216a Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Thu, 5 Nov 2009 12:20:11 -0500 Subject: [PATCH] Rename [xy]_pos to [xy]_offset since we don't accumulate positions --- src/hb-buffer-private.h | 4 ++-- src/hb-buffer.h | 4 ++-- src/hb-font.h | 4 ++-- src/hb-ft.c | 10 ++++---- src/hb-ot-layout-gpos-private.hh | 40 ++++++++++---------------------- src/hb-shape.c | 14 +++++------ src/hb-shape.h | 4 ++-- 7 files changed, 32 insertions(+), 48 deletions(-) diff --git a/src/hb-buffer-private.h b/src/hb-buffer-private.h index f40b1c58..f98f7685 100644 --- a/src/hb-buffer-private.h +++ b/src/hb-buffer-private.h @@ -47,10 +47,10 @@ typedef struct _hb_internal_glyph_info_t { } hb_internal_glyph_info_t; typedef struct _hb_internal_glyph_position_t { - hb_position_t x_pos; - hb_position_t y_pos; hb_position_t x_advance; hb_position_t y_advance; + hb_position_t x_offset; + hb_position_t y_offset; uint32_t new_advance :1; /* if set, the advance width values are absolute, i.e., they won't be added to the original glyph's value diff --git a/src/hb-buffer.h b/src/hb-buffer.h index 7bb7a5a3..5c9d408b 100644 --- a/src/hb-buffer.h +++ b/src/hb-buffer.h @@ -52,10 +52,10 @@ typedef struct _hb_glyph_info_t { } hb_glyph_info_t; typedef struct _hb_glyph_position_t { - hb_position_t x_pos; - hb_position_t y_pos; hb_position_t x_advance; hb_position_t y_advance; + hb_position_t x_offset; + hb_position_t y_offset; /* XXX these should all be replaced by "uint32_t internal" */ uint32_t new_advance :1; /* if set, the advance width values are absolute, i.e., they won't be diff --git a/src/hb-font.h b/src/hb-font.h index 9a8e5adb..a47b6017 100644 --- a/src/hb-font.h +++ b/src/hb-font.h @@ -94,10 +94,10 @@ hb_font_funcs_make_immutable (hb_font_funcs_t *ffuncs); typedef struct _hb_glyph_metrics_t { - hb_position_t x_pos; - hb_position_t y_pos; hb_position_t x_advance; hb_position_t y_advance; + hb_position_t x_offset; + hb_position_t y_offset; hb_position_t width; hb_position_t height; } hb_glyph_metrics_t; diff --git a/src/hb-ft.c b/src/hb-ft.c index fa212e63..146fd3ca 100644 --- a/src/hb-ft.c +++ b/src/hb-ft.c @@ -82,18 +82,18 @@ hb_ft_get_glyph_metrics (hb_font_t *font, hb_face_t *face, const void *user_data /* TODO: load_flags, embolden, etc */ - metrics->x_pos = metrics->y_pos = 0; metrics->x_advance = metrics->y_advance = 0; + metrics->x_offset = metrics->y_offset = 0; metrics->width = metrics->height = 0; if (HB_LIKELY (!FT_Load_Glyph (ft_face, glyph, load_flags))) { /* TODO: A few negations should be in order here, not sure. */ - metrics->x_pos = ft_face->glyph->metrics.horiBearingX; - metrics->y_pos = ft_face->glyph->metrics.horiBearingY; - metrics->width = ft_face->glyph->metrics.width; - metrics->height = ft_face->glyph->metrics.height; metrics->x_advance = ft_face->glyph->advance.x; metrics->y_advance = ft_face->glyph->advance.y; + metrics->x_offset = ft_face->glyph->metrics.horiBearingX; + metrics->y_offset = ft_face->glyph->metrics.horiBearingY; + metrics->width = ft_face->glyph->metrics.width; + metrics->height = ft_face->glyph->metrics.height; } } diff --git a/src/hb-ot-layout-gpos-private.hh b/src/hb-ot-layout-gpos-private.hh index deea9b97..2c88f535 100644 --- a/src/hb-ot-layout-gpos-private.hh +++ b/src/hb-ot-layout-gpos-private.hh @@ -103,41 +103,25 @@ struct ValueRecord { x_scale = context->font->x_scale; y_scale = context->font->y_scale; /* design units -> fractional pixel */ - if (format & xPlacement) - glyph_pos->x_pos += _hb_16dot16_mul_trunc (x_scale, *(SHORT*)values++); - if (format & yPlacement) - glyph_pos->y_pos += _hb_16dot16_mul_trunc (y_scale, *(SHORT*)values++); - if (format & xAdvance) - glyph_pos->x_advance += _hb_16dot16_mul_trunc (x_scale, *(SHORT*)values++); - if (format & yAdvance) - glyph_pos->y_advance += _hb_16dot16_mul_trunc (y_scale, *(SHORT*)values++); + if (format & xPlacement) glyph_pos->x_offset += _hb_16dot16_mul_trunc (x_scale, *(SHORT*)values++); + if (format & yPlacement) glyph_pos->y_offset += _hb_16dot16_mul_trunc (y_scale, *(SHORT*)values++); + if (format & xAdvance) glyph_pos->x_advance += _hb_16dot16_mul_trunc (x_scale, *(SHORT*)values++); + if (format & yAdvance) glyph_pos->y_advance += _hb_16dot16_mul_trunc (y_scale, *(SHORT*)values++); x_ppem = context->font->x_ppem; y_ppem = context->font->y_ppem; /* pixel -> fractional pixel */ if (format & xPlaDevice) { - if (x_ppem) - glyph_pos->x_pos += (base+*(OffsetTo*)values++).get_delta (x_ppem) << 6; - else - values++; + if (x_ppem) glyph_pos->x_offset += (base+*(OffsetTo*)values++).get_delta (x_ppem) << 6; else values++; } if (format & yPlaDevice) { - if (y_ppem) - glyph_pos->y_pos += (base+*(OffsetTo*)values++).get_delta (y_ppem) << 6; - else - values++; + if (y_ppem) glyph_pos->y_offset += (base+*(OffsetTo*)values++).get_delta (y_ppem) << 6; else values++; } if (format & xAdvDevice) { - if (x_ppem) - glyph_pos->x_advance += (base+*(OffsetTo*)values++).get_delta (x_ppem) << 6; - else - values++; + if (x_ppem) glyph_pos->x_advance += (base+*(OffsetTo*)values++).get_delta (x_ppem) << 6; else values++; } if (format & yAdvDevice) { - if (y_ppem) - glyph_pos->y_advance += (base+*(OffsetTo*)values++).get_delta (y_ppem) << 6; - else - values++; + if (y_ppem) glyph_pos->y_advance += (base+*(OffsetTo*)values++).get_delta (y_ppem) << 6; else values++; } } }; @@ -330,10 +314,10 @@ struct MarkArray glyph_anchor.get_anchor (context, IN_GLYPH (glyph_pos), &base_x, &base_y); hb_internal_glyph_position_t *o = POSITION (buffer->in_pos); - o->x_pos = base_x - mark_x; - o->y_pos = base_y - mark_y; o->x_advance = 0; o->y_advance = 0; + o->x_offset = base_x - mark_x; + o->y_offset = base_y - mark_y; o->back = buffer->in_pos - glyph_pos; buffer->in_pos++; @@ -868,12 +852,12 @@ struct CursivePosFormat1 if (lookup_flag & LookupFlag::RightToLeft) { POSITION (last_pos)->cursive_chain = last_pos - buffer->in_pos; - POSITION (last_pos)->y_pos = entry_y - gpi->anchor_y; + POSITION (last_pos)->y_offset = entry_y - gpi->anchor_y; } else { POSITION (buffer->in_pos)->cursive_chain = buffer->in_pos - last_pos; - POSITION (buffer->in_pos)->y_pos = gpi->anchor_y - entry_y; + POSITION (buffer->in_pos)->y_offset = gpi->anchor_y - entry_y; } end: diff --git a/src/hb-shape.c b/src/hb-shape.c index 9043f984..23391f9b 100644 --- a/src/hb-shape.c +++ b/src/hb-shape.c @@ -38,8 +38,8 @@ is_variation_selector (hb_codepoint_t unicode) } static void -map_glyphs (hb_face_t *face, - hb_font_t *font, +map_glyphs (hb_font_t *font, + hb_face_t *face, hb_buffer_t *buffer) { unsigned int count; @@ -48,19 +48,19 @@ map_glyphs (hb_face_t *face, for (buffer->in_pos = 0; buffer->in_pos < count; buffer->in_pos++) { if (HB_UNLIKELY (is_variation_selector (IN_NEXTGLYPH()))) { - IN_CURGLYPH() = hb_font_get_glyph (face, font, IN_CURGLYPH(), IN_NEXTGLYPH()); + IN_CURGLYPH() = hb_font_get_glyph (font, face, IN_CURGLYPH(), IN_NEXTGLYPH()); buffer->in_pos++; } else { - IN_CURGLYPH() = hb_font_get_glyph (face, font, IN_CURGLYPH(), 0); + IN_CURGLYPH() = hb_font_get_glyph (font, face, IN_CURGLYPH(), 0); } } - IN_CURGLYPH() = hb_font_get_glyph (face, font, IN_CURGLYPH(), 0); + IN_CURGLYPH() = hb_font_get_glyph (font, face, IN_CURGLYPH(), 0); } void -hb_shape (hb_face_t *face, - hb_font_t *font, +hb_shape (hb_font_t *font, + hb_face_t *face, hb_buffer_t *buffer, hb_feature_t *features, unsigned int num_features) diff --git a/src/hb-shape.h b/src/hb-shape.h index be205929..714fe970 100644 --- a/src/hb-shape.h +++ b/src/hb-shape.h @@ -41,8 +41,8 @@ typedef struct _hb_feature_t { } hb_feature_t; void -hb_shape (hb_face_t *face, - hb_font_t *font, +hb_shape (hb_font_t *font, + hb_face_t *face, hb_buffer_t *buffer, hb_feature_t *features, unsigned int num_features); -- GitLab