[Vertical] GPOS is always done with horizontal origin

This commit is contained in:
Behdad Esfahbod 2011-05-19 18:46:15 -04:00
parent 8b38faeede
commit 60fbb36096
8 changed files with 166 additions and 183 deletions

View File

@ -138,10 +138,10 @@ struct _hb_font_t {
return v;
}
inline hb_position_t parent_scale_x_position (hb_position_t v) {
return parent_scale_x_distance (v); /* We don't have translation right now */
return parent_scale_x_distance (v);
}
inline hb_position_t parent_scale_y_position (hb_position_t v) {
return parent_scale_y_distance (v); /* We don't have translation right now */
return parent_scale_y_distance (v);
}
inline void parent_scale_distance (hb_position_t *x, hb_position_t *y) {

View File

@ -56,44 +56,40 @@ hb_font_get_glyph_nil (hb_font_t *font HB_UNUSED,
return FALSE;
}
static hb_bool_t
static void
hb_font_get_glyph_h_advance_nil (hb_font_t *font HB_UNUSED,
void *font_data HB_UNUSED,
hb_codepoint_t glyph,
hb_position_t *x,
hb_position_t *y,
hb_position_t *advance,
void *user_data HB_UNUSED)
{
if (font->parent) {
hb_bool_t ret = hb_font_get_glyph_h_advance (font->parent,
glyph,
x, y);
font->parent_scale_distance (x, y);
return ret;
hb_font_get_glyph_h_advance (font->parent,
glyph,
advance);
*advance = font->parent_scale_x_distance (*advance);
return;
}
*x = *y = 0;
return FALSE;
*advance = 0;
}
static hb_bool_t
static void
hb_font_get_glyph_v_advance_nil (hb_font_t *font HB_UNUSED,
void *font_data HB_UNUSED,
hb_codepoint_t glyph,
hb_position_t *x,
hb_position_t *y,
hb_position_t *advance,
void *user_data HB_UNUSED)
{
if (font->parent) {
hb_bool_t ret = hb_font_get_glyph_v_advance (font->parent,
glyph,
x, y);
font->parent_scale_distance (x, y);
return ret;
hb_font_get_glyph_v_advance (font->parent,
glyph,
advance);
*advance = font->parent_scale_y_distance (*advance);
return;
}
*x = *y = 0;
return FALSE;
*advance = 0;
}
static hb_bool_t
@ -108,7 +104,8 @@ hb_font_get_glyph_h_origin_nil (hb_font_t *font HB_UNUSED,
hb_bool_t ret = hb_font_get_glyph_h_origin (font->parent,
glyph,
x, y);
font->parent_scale_distance (x, y);
if (ret)
font->parent_scale_position (x, y);
return ret;
}
@ -128,7 +125,8 @@ hb_font_get_glyph_v_origin_nil (hb_font_t *font HB_UNUSED,
hb_bool_t ret = hb_font_get_glyph_v_origin (font->parent,
glyph,
x, y);
font->parent_scale_distance (x, y);
if (ret)
font->parent_scale_position (x, y);
return ret;
}
@ -136,46 +134,42 @@ hb_font_get_glyph_v_origin_nil (hb_font_t *font HB_UNUSED,
return FALSE;
}
static hb_bool_t
static void
hb_font_get_glyph_h_kerning_nil (hb_font_t *font HB_UNUSED,
void *font_data HB_UNUSED,
hb_codepoint_t left_glyph,
hb_codepoint_t right_glyph,
hb_position_t *x,
hb_position_t *y,
hb_position_t *kerning,
void *user_data HB_UNUSED)
{
if (font->parent) {
hb_bool_t ret = hb_font_get_glyph_h_kerning (font->parent,
left_glyph, right_glyph,
x, y);
font->parent_scale_distance (x, y);
return ret;
hb_font_get_glyph_h_kerning (font->parent,
left_glyph, right_glyph,
kerning);
*kerning = font->parent_scale_x_distance (*kerning);
return;
}
*x = *y = 0;
return FALSE;
*kerning = 0;
}
static hb_bool_t
static void
hb_font_get_glyph_v_kerning_nil (hb_font_t *font HB_UNUSED,
void *font_data HB_UNUSED,
hb_codepoint_t top_glyph,
hb_codepoint_t bottom_glyph,
hb_position_t *x,
hb_position_t *y,
hb_position_t *kerning,
void *user_data HB_UNUSED)
{
if (font->parent) {
hb_bool_t ret = hb_font_get_glyph_v_kerning (font->parent,
top_glyph, bottom_glyph,
x, y);
font->parent_scale_distance (x, y);
return ret;
hb_font_get_glyph_v_kerning (font->parent,
top_glyph, bottom_glyph,
kerning);
*kerning = font->parent_scale_y_distance (*kerning);
return;
}
*x = *y = 0;
return FALSE;
*kerning = 0;
}
static hb_bool_t
@ -189,13 +183,14 @@ hb_font_get_glyph_extents_nil (hb_font_t *font HB_UNUSED,
hb_bool_t ret = hb_font_get_glyph_extents (font->parent,
glyph,
extents);
font->parent_scale_position (&extents->x_bearing, &extents->y_bearing);
font->parent_scale_distance (&extents->width, &extents->height);
if (ret) {
font->parent_scale_position (&extents->x_bearing, &extents->y_bearing);
font->parent_scale_distance (&extents->width, &extents->height);
}
return ret;
}
extents->x_bearing = extents->y_bearing = 0;
extents->width = extents->height = 0;
memset (extents, 0, sizeof (*extents));
return FALSE;
}
@ -212,7 +207,8 @@ hb_font_get_glyph_contour_point_nil (hb_font_t *font HB_UNUSED,
hb_bool_t ret = hb_font_get_glyph_contour_point (font->parent,
glyph, point_index,
x, y);
font->parent_scale_position (x, y);
if (ret)
font->parent_scale_position (x, y);
return ret;
}
@ -344,26 +340,26 @@ hb_font_get_glyph (hb_font_t *font,
font->klass->user_data.glyph);
}
hb_bool_t
void
hb_font_get_glyph_h_advance (hb_font_t *font,
hb_codepoint_t glyph,
hb_position_t *x, hb_position_t *y)
hb_position_t *advance)
{
*x = *y = 0;
return font->klass->get.glyph_h_advance (font, font->user_data,
glyph, x, y,
font->klass->user_data.glyph_h_advance);
*advance = 0;
font->klass->get.glyph_h_advance (font, font->user_data,
glyph, advance,
font->klass->user_data.glyph_h_advance);
}
hb_bool_t
void
hb_font_get_glyph_v_advance (hb_font_t *font,
hb_codepoint_t glyph,
hb_position_t *x, hb_position_t *y)
hb_position_t *advance)
{
*x = *y = 0;
return font->klass->get.glyph_v_advance (font, font->user_data,
glyph, x, y,
font->klass->user_data.glyph_v_advance);
*advance = 0;
font->klass->get.glyph_v_advance (font, font->user_data,
glyph, advance,
font->klass->user_data.glyph_v_advance);
}
hb_bool_t
@ -388,27 +384,27 @@ hb_font_get_glyph_v_origin (hb_font_t *font,
font->klass->user_data.glyph_v_origin);
}
hb_bool_t
void
hb_font_get_glyph_h_kerning (hb_font_t *font,
hb_codepoint_t left_glyph, hb_codepoint_t right_glyph,
hb_position_t *x, hb_position_t *y)
hb_position_t *kerning)
{
*x = *y = 0;
*kerning = 0;
return font->klass->get.glyph_h_kerning (font, font->user_data,
left_glyph, right_glyph,
x, y,
kerning,
font->klass->user_data.glyph_h_kerning);
}
hb_bool_t
void
hb_font_get_glyph_v_kerning (hb_font_t *font,
hb_codepoint_t left_glyph, hb_codepoint_t right_glyph,
hb_position_t *x, hb_position_t *y)
hb_position_t *kerning)
{
*x = *y = 0;
*kerning = 0;
return font->klass->get.glyph_v_kerning (font, font->user_data,
left_glyph, right_glyph,
x, y,
kerning,
font->klass->user_data.glyph_v_kerning);
}
@ -445,13 +441,12 @@ hb_font_get_glyph_advance_for_direction (hb_font_t *font,
hb_direction_t direction,
hb_position_t *x, hb_position_t *y)
{
if (HB_DIRECTION_IS_VERTICAL (direction)) {
hb_bool_t ret = hb_font_get_glyph_v_advance (font, glyph, x, y);
if (!ret) {
/* TODO return font_extents.ascent + font_extents.descent? */
}
if (likely (HB_DIRECTION_IS_HORIZONTAL (direction))) {
*y = 0;
hb_font_get_glyph_h_advance (font, glyph, x);
} else {
hb_font_get_glyph_h_advance (font, glyph, x, y);
*x = 0;
hb_font_get_glyph_v_advance (font, glyph, y);
}
}
@ -461,13 +456,13 @@ hb_font_get_glyph_origin_for_direction (hb_font_t *font,
hb_direction_t direction,
hb_position_t *x, hb_position_t *y)
{
if (HB_DIRECTION_IS_VERTICAL (direction)) {
if (likely (HB_DIRECTION_IS_HORIZONTAL (direction))) {
hb_font_get_glyph_h_origin (font, glyph, x, y);
} else {
hb_bool_t ret = hb_font_get_glyph_v_origin (font, glyph, x, y);
if (!ret) {
/* TODO return h_origin/2. and font_extents.ascent */
}
} else {
hb_font_get_glyph_h_origin (font, glyph, x, y);
}
}
@ -505,40 +500,34 @@ hb_font_get_glyph_kerning_for_direction (hb_font_t *font,
hb_direction_t direction,
hb_position_t *x, hb_position_t *y)
{
switch (direction) {
case HB_DIRECTION_LTR:
case HB_DIRECTION_RTL:
hb_font_get_glyph_h_kerning (font, first_glyph, second_glyph, x, y);
break;
case HB_DIRECTION_TTB:
case HB_DIRECTION_BTT:
hb_font_get_glyph_v_kerning (font, first_glyph, second_glyph, x, y);
break;
case HB_DIRECTION_INVALID:
default:
break;
if (likely (HB_DIRECTION_IS_HORIZONTAL (direction))) {
*y = 0;
hb_font_get_glyph_h_kerning (font, first_glyph, second_glyph, x);
} else {
*x = 0;
hb_font_get_glyph_v_kerning (font, first_glyph, second_glyph, y);
}
}
void
hb_font_get_glyph_extents_for_direction (hb_font_t *font,
hb_codepoint_t glyph,
hb_direction_t direction,
hb_glyph_extents_t *extents)
hb_bool_t
hb_font_get_glyph_extents_for_origin (hb_font_t *font,
hb_codepoint_t glyph,
hb_direction_t direction,
hb_glyph_extents_t *extents)
{
hb_bool_t ret = hb_font_get_glyph_extents (font, glyph, extents);
if (ret)
hb_font_subtract_glyph_origin_for_direction (font, glyph, direction, &extents->x_bearing, &extents->y_bearing);
return ret;
}
hb_bool_t
hb_font_get_glyph_contour_point_for_direction (hb_font_t *font,
hb_codepoint_t glyph, unsigned int point_index,
hb_direction_t direction,
hb_position_t *x, hb_position_t *y)
hb_font_get_glyph_contour_point_for_origin (hb_font_t *font,
hb_codepoint_t glyph, unsigned int point_index,
hb_direction_t direction,
hb_position_t *x, hb_position_t *y)
{
hb_bool_t ret = hb_font_get_glyph_contour_point (font, glyph, point_index, x, y);

View File

@ -142,10 +142,10 @@ typedef hb_bool_t (*hb_font_get_glyph_func_t) (hb_font_t *font, void *font_data,
void *user_data);
typedef hb_bool_t (*hb_font_get_glyph_advance_func_t) (hb_font_t *font, void *font_data,
hb_codepoint_t glyph,
hb_position_t *x, hb_position_t *y,
void *user_data);
typedef void (*hb_font_get_glyph_advance_func_t) (hb_font_t *font, void *font_data,
hb_codepoint_t glyph,
hb_position_t *advance,
void *user_data);
typedef hb_font_get_glyph_advance_func_t hb_font_get_glyph_h_advance_func_t;
typedef hb_font_get_glyph_advance_func_t hb_font_get_glyph_v_advance_func_t;
@ -156,10 +156,10 @@ typedef hb_bool_t (*hb_font_get_glyph_origin_func_t) (hb_font_t *font, void *fon
typedef hb_font_get_glyph_origin_func_t hb_font_get_glyph_h_origin_func_t;
typedef hb_font_get_glyph_origin_func_t hb_font_get_glyph_v_origin_func_t;
typedef hb_bool_t (*hb_font_get_glyph_kerning_func_t) (hb_font_t *font, void *font_data,
hb_codepoint_t first_glyph, hb_codepoint_t second_glyph,
hb_position_t *x, hb_position_t *y,
void *user_data);
typedef void (*hb_font_get_glyph_kerning_func_t) (hb_font_t *font, void *font_data,
hb_codepoint_t first_glyph, hb_codepoint_t second_glyph,
hb_position_t *kerning,
void *user_data);
typedef hb_font_get_glyph_kerning_func_t hb_font_get_glyph_h_kerning_func_t;
typedef hb_font_get_glyph_kerning_func_t hb_font_get_glyph_v_kerning_func_t;
@ -225,14 +225,14 @@ hb_font_get_glyph (hb_font_t *font,
hb_codepoint_t unicode, hb_codepoint_t variation_selector,
hb_codepoint_t *glyph);
hb_bool_t
void
hb_font_get_glyph_h_advance (hb_font_t *font,
hb_codepoint_t glyph,
hb_position_t *x, hb_position_t *y);
hb_bool_t
hb_position_t *advance);
void
hb_font_get_glyph_v_advance (hb_font_t *font,
hb_codepoint_t glyph,
hb_position_t *x, hb_position_t *y);
hb_position_t *advance);
hb_bool_t
hb_font_get_glyph_h_origin (hb_font_t *font,
@ -243,14 +243,14 @@ hb_font_get_glyph_v_origin (hb_font_t *font,
hb_codepoint_t glyph,
hb_position_t *x, hb_position_t *y);
hb_bool_t
void
hb_font_get_glyph_h_kerning (hb_font_t *font,
hb_codepoint_t left_glyph, hb_codepoint_t right_glyph,
hb_position_t *x, hb_position_t *y);
hb_bool_t
hb_position_t *kerning);
void
hb_font_get_glyph_v_kerning (hb_font_t *font,
hb_codepoint_t top_glyph, hb_codepoint_t bottom_glyph,
hb_position_t *x, hb_position_t *y);
hb_position_t *kerning);
hb_bool_t
hb_font_get_glyph_extents (hb_font_t *font,
@ -292,17 +292,17 @@ hb_font_get_glyph_kerning_for_direction (hb_font_t *font,
hb_direction_t direction,
hb_position_t *x, hb_position_t *y);
void
hb_font_get_glyph_extents_for_direction (hb_font_t *font,
hb_codepoint_t glyph,
hb_direction_t direction,
hb_glyph_extents_t *extents);
hb_bool_t
hb_font_get_glyph_extents_for_origin (hb_font_t *font,
hb_codepoint_t glyph,
hb_direction_t direction,
hb_glyph_extents_t *extents);
hb_bool_t
hb_font_get_glyph_contour_point_for_direction (hb_font_t *font,
hb_codepoint_t glyph, unsigned int point_index,
hb_direction_t direction,
hb_position_t *x, hb_position_t *y);
hb_font_get_glyph_contour_point_for_origin (hb_font_t *font,
hb_codepoint_t glyph, unsigned int point_index,
hb_direction_t direction,
hb_position_t *x, hb_position_t *y);
/*
@ -357,9 +357,6 @@ hb_font_set_funcs (hb_font_t *font,
hb_destroy_func_t destroy);
/*
* We should add support for full matrices.
*/
void
hb_font_set_scale (hb_font_t *font,
int x_scale,

View File

@ -78,42 +78,38 @@ hb_ft_get_glyph (hb_font_t *font HB_UNUSED,
return *glyph != 0;
}
static hb_bool_t
static void
hb_ft_get_glyph_h_advance (hb_font_t *font HB_UNUSED,
void *font_data,
hb_codepoint_t glyph,
hb_position_t *x,
hb_position_t *y,
hb_position_t *advance,
void *user_data HB_UNUSED)
{
FT_Face ft_face = (FT_Face) font_data;
int load_flags = FT_LOAD_DEFAULT;
if (unlikely (FT_Load_Glyph (ft_face, glyph, load_flags)))
return FALSE;
return;
*x = ft_face->glyph->metrics.horiAdvance;
return TRUE;
*advance = ft_face->glyph->metrics.horiAdvance;
}
static hb_bool_t
static void
hb_ft_get_glyph_v_advance (hb_font_t *font HB_UNUSED,
void *font_data,
hb_codepoint_t glyph,
hb_position_t *x,
hb_position_t *y,
hb_position_t *advance,
void *user_data HB_UNUSED)
{
FT_Face ft_face = (FT_Face) font_data;
int load_flags = FT_LOAD_DEFAULT;
if (unlikely (FT_Load_Glyph (ft_face, glyph, load_flags)))
return FALSE;
return;
/* Note: FreeType's vertical metrics grows downward while other FreeType coordinates
* have a Y growing upward. Hence the extra negation. */
*y = -ft_face->glyph->metrics.vertAdvance;
return TRUE;
*advance = -ft_face->glyph->metrics.vertAdvance;
}
static hb_bool_t
@ -147,45 +143,36 @@ hb_ft_get_glyph_v_origin (hb_font_t *font HB_UNUSED,
*x = ft_face->glyph->metrics.horiBearingX - ft_face->glyph->metrics.vertBearingX;
*y = ft_face->glyph->metrics.horiBearingY - (-ft_face->glyph->metrics.vertBearingY);
/* TODO ??
if (glyph->format == FT_GLYPH_FORMAT_OUTLINE)
FT_Vector_Transform (&vector, &scaled_font->unscaled->Current_Shape);
*/
return TRUE;
}
static hb_bool_t
static void
hb_ft_get_glyph_h_kerning (hb_font_t *font HB_UNUSED,
void *font_data,
hb_codepoint_t left_glyph,
hb_codepoint_t right_glyph,
hb_position_t *x,
hb_position_t *y,
hb_position_t *kerning,
void *user_data HB_UNUSED)
{
FT_Face ft_face = (FT_Face) font_data;
FT_Vector kerning;
FT_Vector kerningv;
if (FT_Get_Kerning (ft_face, left_glyph, right_glyph, FT_KERNING_DEFAULT, &kerning))
return FALSE;
if (FT_Get_Kerning (ft_face, left_glyph, right_glyph, FT_KERNING_DEFAULT, &kerningv))
return;
*x = kerning.x;
*y = kerning.y;
return TRUE;
*kerning = kerningv.x;
}
static hb_bool_t
static void
hb_ft_get_glyph_v_kerning (hb_font_t *font HB_UNUSED,
void *font_data HB_UNUSED,
hb_codepoint_t top_glyph HB_UNUSED,
hb_codepoint_t bottom_glyph HB_UNUSED,
hb_position_t *x HB_UNUSED,
hb_position_t *y HB_UNUSED,
hb_position_t *kerning HB_UNUSED,
void *user_data HB_UNUSED)
{
/* FreeType API doesn't support vertical kerning */
return FALSE;
return;
}
static hb_bool_t

View File

@ -1,6 +1,6 @@
/*
* Copyright © 2007,2008,2009 Red Hat, Inc.
* Copyright © 2010 Google, Inc.
* Copyright © 2010,2011 Google, Inc.
*
* This is part of HarfBuzz, a text shaping library.
*
@ -96,7 +96,7 @@ struct CaretValueFormat1
friend struct CaretValue;
private:
inline int get_caret_value (hb_font_t *font, hb_direction_t direction, hb_codepoint_t glyph_id HB_UNUSED) const
inline hb_position_t get_caret_value (hb_font_t *font, hb_direction_t direction, hb_codepoint_t glyph_id HB_UNUSED) const
{
return HB_DIRECTION_IS_HORIZONTAL (direction) ? font->em_scale_x (coordinate) : font->em_scale_y (coordinate);
}
@ -118,10 +118,10 @@ struct CaretValueFormat2
friend struct CaretValue;
private:
inline int get_caret_value (hb_font_t *font, hb_direction_t direction, hb_codepoint_t glyph_id) const
inline hb_position_t get_caret_value (hb_font_t *font, hb_direction_t direction, hb_codepoint_t glyph_id) const
{
hb_position_t x, y;
if (hb_font_get_glyph_contour_point_for_direction (font, glyph_id, caretValuePoint, direction, &x, &y))
if (hb_font_get_glyph_contour_point_for_origin (font, glyph_id, caretValuePoint, direction, &x, &y))
return HB_DIRECTION_IS_HORIZONTAL (direction) ? x : y;
else
return 0;
@ -143,7 +143,7 @@ struct CaretValueFormat3
{
friend struct CaretValue;
inline int get_caret_value (hb_font_t *font, hb_direction_t direction, hb_codepoint_t glyph_id) const
inline hb_position_t get_caret_value (hb_font_t *font, hb_direction_t direction, hb_codepoint_t glyph_id) const
{
return HB_DIRECTION_IS_HORIZONTAL (direction) ?
font->em_scale_x (coordinate) + (this+deviceTable).get_x_delta (font) :
@ -169,7 +169,7 @@ struct CaretValueFormat3
struct CaretValue
{
inline int get_caret_value (hb_font_t *font, hb_direction_t direction, hb_codepoint_t glyph_id) const
inline hb_position_t get_caret_value (hb_font_t *font, hb_direction_t direction, hb_codepoint_t glyph_id) const
{
switch (u.format) {
case 1: return u.format1.get_caret_value (font, direction, glyph_id);
@ -208,7 +208,7 @@ struct LigGlyph
hb_codepoint_t glyph_id,
unsigned int start_offset,
unsigned int *caret_count /* IN/OUT */,
int *caret_array /* OUT */) const
hb_position_t *caret_array /* OUT */) const
{
if (caret_count) {
const OffsetTo<CaretValue> *array = carets.sub_array (start_offset, caret_count);
@ -241,7 +241,7 @@ struct LigCaretList
hb_codepoint_t glyph_id,
unsigned int start_offset,
unsigned int *caret_count /* IN/OUT */,
int *caret_array /* OUT */) const
hb_position_t *caret_array /* OUT */) const
{
unsigned int index = (this+coverage) (glyph_id);
if (index == NOT_COVERED)
@ -357,7 +357,7 @@ struct GDEF
hb_codepoint_t glyph_id,
unsigned int start_offset,
unsigned int *caret_count /* IN/OUT */,
int *caret_array /* OUT */) const
hb_position_t *caret_array /* OUT */) const
{ return (this+ligCaretList).get_lig_carets (font, direction, glyph_id, start_offset, caret_count, caret_array); }
inline bool has_mark_sets (void) const { return version >= 0x00010002 && markGlyphSetsDef[0] != 0; }

View File

@ -210,7 +210,6 @@ struct AnchorFormat1
private:
inline void get_anchor (hb_font_t *font, hb_codepoint_t glyph_id HB_UNUSED,
hb_direction_t direction HB_UNUSED,
hb_position_t *x, hb_position_t *y) const
{
*x = font->em_scale_x (xCoordinate);
@ -236,7 +235,6 @@ struct AnchorFormat2
private:
inline void get_anchor (hb_font_t *font, hb_codepoint_t glyph_id,
hb_direction_t direction,
hb_position_t *x, hb_position_t *y) const
{
unsigned int x_ppem = font->x_ppem;
@ -245,7 +243,7 @@ struct AnchorFormat2
hb_bool_t ret = false;
if (x_ppem || y_ppem)
ret = hb_font_get_glyph_contour_point_for_direction (font, glyph_id, anchorPoint, direction, &cx, &cy);
ret = hb_font_get_glyph_contour_point_for_origin (font, glyph_id, anchorPoint, HB_DIRECTION_LTR, &cx, &cy);
*x = x_ppem && ret ? cx : font->em_scale_x (xCoordinate);
*y = y_ppem && ret ? cy : font->em_scale_y (yCoordinate);
}
@ -270,13 +268,11 @@ struct AnchorFormat3
private:
inline void get_anchor (hb_font_t *font, hb_codepoint_t glyph_id HB_UNUSED,
hb_direction_t direction HB_UNUSED,
hb_position_t *x, hb_position_t *y) const
{
*x = font->em_scale_x (xCoordinate);
*y = font->em_scale_y (yCoordinate);
/* pixel -> fractional pixel */
if (font->x_ppem)
*x += (this+xDeviceTable).get_x_delta (font);
if (font->y_ppem)
@ -309,15 +305,14 @@ struct AnchorFormat3
struct Anchor
{
inline void get_anchor (hb_font_t *font, hb_codepoint_t glyph_id,
hb_direction_t direction,
hb_position_t *x, hb_position_t *y) const
{
*x = *y = 0;
switch (u.format) {
case 1: u.format1.get_anchor (font, glyph_id, direction, x, y); return;
case 2: u.format2.get_anchor (font, glyph_id, direction, x, y); return;
case 3: u.format3.get_anchor (font, glyph_id, direction, x, y); return;
default: return;
case 1: u.format1.get_anchor (font, glyph_id, x, y); return;
case 2: u.format2.get_anchor (font, glyph_id, x, y); return;
case 3: u.format3.get_anchor (font, glyph_id, x, y); return;
default: return;
}
}
@ -407,8 +402,8 @@ 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->font, c->buffer->info[c->buffer->i].codepoint, c->direction, &mark_x, &mark_y);
glyph_anchor.get_anchor (c->font, c->buffer->info[glyph_pos].codepoint, c->direction, &base_x, &base_y);
mark_anchor.get_anchor (c->font, c->buffer->info[c->buffer->i].codepoint, &mark_x, &mark_y);
glyph_anchor.get_anchor (c->font, c->buffer->info[glyph_pos].codepoint, &base_x, &base_y);
hb_glyph_position_t &o = c->buffer->pos[c->buffer->i];
o.x_offset = base_x - mark_x;
@ -863,8 +858,8 @@ struct CursivePosFormat1
unsigned int i = c->buffer->i;
hb_position_t entry_x, entry_y, exit_x, exit_y;
(this+this_record.exitAnchor).get_anchor (c->font, c->buffer->info[i].codepoint, c->direction, &exit_x, &exit_y);
(this+next_record.entryAnchor).get_anchor (c->font, c->buffer->info[j].codepoint, c->direction, &entry_x, &entry_y);
(this+this_record.exitAnchor).get_anchor (c->font, c->buffer->info[i].codepoint, &exit_x, &exit_y);
(this+next_record.entryAnchor).get_anchor (c->font, c->buffer->info[j].codepoint, &entry_x, &entry_y);
/* Align the exit anchor of the left/top glyph with the entry anchor of the right/bottom glyph
* by adjusting advance of the left/top glyph. */

View File

@ -63,7 +63,7 @@ hb_ot_layout_get_ligature_carets (hb_font_t *font,
hb_codepoint_t glyph,
unsigned int start_offset,
unsigned int *caret_count /* IN/OUT */,
int *caret_array /* OUT */);
hb_position_t *caret_array /* OUT */);
/*

View File

@ -121,8 +121,23 @@ hb_ot_position_complex (hb_ot_shape_context_t *c)
if (!hb_ot_layout_has_positioning (c->face))
return;
unsigned int count = c->buffer->len;
for (unsigned int i = 0; i < count; i++) {
hb_font_add_glyph_origin_for_direction (c->font, c->buffer->info[i].codepoint,
HB_DIRECTION_LTR,
&c->buffer->pos[i].x_offset,
&c->buffer->pos[i].y_offset);
}
c->plan->map.position (c->font, c->face, c->buffer);
for (unsigned int i = 0; i < count; i++) {
hb_font_subtract_glyph_origin_for_direction (c->font, c->buffer->info[i].codepoint,
HB_DIRECTION_LTR,
&c->buffer->pos[i].x_offset,
&c->buffer->pos[i].y_offset);
}
hb_ot_layout_position_finish (c->buffer);
c->applied_position_complex = TRUE;