Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Harfbuzz
提交
60fbb360
T
Third Party Harfbuzz
项目概览
OpenHarmony
/
Third Party Harfbuzz
大约 1 年 前同步成功
通知
0
Star
18
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
Third Party Harfbuzz
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
60fbb360
编写于
5月 19, 2011
作者:
B
Behdad Esfahbod
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[Vertical] GPOS is always done with horizontal origin
上级
8b38faee
变更
8
显示空白变更内容
内联
并排
Showing
8 changed file
with
166 addition
and
183 deletion
+166
-183
src/hb-font-private.hh
src/hb-font-private.hh
+2
-2
src/hb-font.cc
src/hb-font.cc
+88
-99
src/hb-font.h
src/hb-font.h
+25
-28
src/hb-ft.cc
src/hb-ft.cc
+17
-30
src/hb-ot-layout-gdef-private.hh
src/hb-ot-layout-gdef-private.hh
+9
-9
src/hb-ot-layout-gpos-private.hh
src/hb-ot-layout-gpos-private.hh
+9
-14
src/hb-ot-layout.h
src/hb-ot-layout.h
+1
-1
src/hb-ot-shape.cc
src/hb-ot-shape.cc
+15
-0
未找到文件。
src/hb-font-private.hh
浏览文件 @
60fbb360
...
...
@@ -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
)
{
...
...
src/hb-font.cc
浏览文件 @
60fbb360
...
...
@@ -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
,
hb_font_get_glyph_h_advance
(
font
->
parent
,
glyph
,
x
,
y
);
font
->
parent_scale_distance
(
x
,
y
);
return
ret
;
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
,
hb_font_get_glyph_v_advance
(
font
->
parent
,
glyph
,
x
,
y
);
font
->
parent_scale_distance
(
x
,
y
);
return
ret
;
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
,
hb_font_get_glyph_h_kerning
(
font
->
parent
,
left_glyph
,
right_glyph
,
x
,
y
);
font
->
parent_scale_distance
(
x
,
y
);
return
ret
;
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
,
hb_font_get_glyph_v_kerning
(
font
->
parent
,
top_glyph
,
bottom_glyph
,
x
,
y
);
font
->
parent_scale_distance
(
x
,
y
);
return
ret
;
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
);
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,6 +207,7 @@ 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
);
if
(
ret
)
font
->
parent_scale_position
(
x
,
y
);
return
ret
;
}
...
...
@@ -344,25 +340,25 @@ 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
,
*
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
,
*
advance
=
0
;
font
->
klass
->
get
.
glyph_v_advance
(
font
,
font
->
user_data
,
glyph
,
advance
,
font
->
klass
->
user_data
.
glyph_v_advance
);
}
...
...
@@ -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,25 +500,17 @@ 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_
directio
n
(
hb_font_t
*
font
,
hb_bool_t
hb_font_get_glyph_extents_for_
origi
n
(
hb_font_t
*
font
,
hb_codepoint_t
glyph
,
hb_direction_t
direction
,
hb_glyph_extents_t
*
extents
)
...
...
@@ -532,10 +519,12 @@ hb_font_get_glyph_extents_for_direction (hb_font_t *font,
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_
directio
n
(
hb_font_t
*
font
,
hb_font_get_glyph_contour_point_for_
origi
n
(
hb_font_t
*
font
,
hb_codepoint_t
glyph
,
unsigned
int
point_index
,
hb_direction_t
direction
,
hb_position_t
*
x
,
hb_position_t
*
y
)
...
...
src/hb-font.h
浏览文件 @
60fbb360
...
...
@@ -142,9 +142,9 @@ 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
,
typedef
void
(
*
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
,
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,9 +156,9 @@ 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
,
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
*
x
,
hb_position_t
*
y
,
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,14 +292,14 @@ 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_
directio
n
(
hb_font_t
*
font
,
hb_bool_t
hb_font_get_glyph_extents_for_
origi
n
(
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_
directio
n
(
hb_font_t
*
font
,
hb_font_get_glyph_contour_point_for_
origi
n
(
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
,
...
...
src/hb-ft.cc
浏览文件 @
60fbb360
...
...
@@ -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
kerning
v
;
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
,
&
kerning
v
))
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
...
...
src/hb-ot-layout-gdef-private.hh
浏览文件 @
60fbb360
/*
* 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
in
t
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
in
t
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_
directio
n
(
font
,
glyph_id
,
caretValuePoint
,
direction
,
&
x
,
&
y
))
if
(
hb_font_get_glyph_contour_point_for_
origi
n
(
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
in
t
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
in
t
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 */
,
in
t
*
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 */
,
in
t
*
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 */
,
in
t
*
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
;
}
...
...
src/hb-ot-layout-gpos-private.hh
浏览文件 @
60fbb360
...
...
@@ -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,14 +305,13 @@ 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
;
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. */
...
...
src/hb-ot-layout.h
浏览文件 @
60fbb360
...
...
@@ -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 */
);
/*
...
...
src/hb-ot-shape.cc
浏览文件 @
60fbb360
...
...
@@ -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
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录