Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Harfbuzz
提交
8fbfda92
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,发现更多精彩内容 >>
提交
8fbfda92
编写于
8月 01, 2012
作者:
B
Behdad Esfahbod
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Inline font getters
上级
6adf417b
变更
11
显示空白变更内容
内联
并排
Showing
11 changed file
with
277 addition
and
166 deletion
+277
-166
src/hb-fallback-shape.cc
src/hb-fallback-shape.cc
+10
-11
src/hb-font-private.hh
src/hb-font-private.hh
+204
-0
src/hb-font.cc
src/hb-font.cc
+20
-109
src/hb-graphite2.cc
src/hb-graphite2.cc
+2
-4
src/hb-old.cc
src/hb-old.cc
+5
-5
src/hb-ot-layout-gdef-table.hh
src/hb-ot-layout-gdef-table.hh
+1
-1
src/hb-ot-layout-gpos-table.hh
src/hb-ot-layout-gpos-table.hh
+1
-1
src/hb-ot-shape-complex-arabic.cc
src/hb-ot-shape-complex-arabic.cc
+2
-2
src/hb-ot-shape-complex-indic.cc
src/hb-ot-shape-complex-indic.cc
+3
-3
src/hb-ot-shape-normalize.cc
src/hb-ot-shape-normalize.cc
+6
-6
src/hb-ot-shape.cc
src/hb-ot-shape.cc
+23
-24
未找到文件。
src/hb-fallback-shape.cc
浏览文件 @
8fbfda92
...
...
@@ -95,9 +95,8 @@ _hb_fallback_shape (hb_shape_plan_t *shape_plan,
const
hb_feature_t
*
features
HB_UNUSED
,
unsigned
int
num_features
HB_UNUSED
)
{
/* TODO Save the space character in the font? */
hb_codepoint_t
space
;
hb_font_get_glyph
(
font
,
' '
,
0
,
&
space
);
font
->
get_glyph
(
' '
,
0
,
&
space
);
buffer
->
guess_properties
();
buffer
->
clear_positions
();
...
...
@@ -112,12 +111,12 @@ _hb_fallback_shape (hb_shape_plan_t *shape_plan,
buffer
->
pos
[
i
].
y_advance
=
0
;
continue
;
}
hb_font_get_glyph
(
font
,
buffer
->
info
[
i
].
codepoint
,
0
,
&
buffer
->
info
[
i
].
codepoint
);
hb_font_get_glyph_advance_for_direction
(
font
,
buffer
->
info
[
i
].
codepoint
,
font
->
get_glyph
(
buffer
->
info
[
i
].
codepoint
,
0
,
&
buffer
->
info
[
i
].
codepoint
);
font
->
get_glyph_advance_for_direction
(
buffer
->
info
[
i
].
codepoint
,
buffer
->
props
.
direction
,
&
buffer
->
pos
[
i
].
x_advance
,
&
buffer
->
pos
[
i
].
y_advance
);
hb_font_subtract_glyph_origin_for_direction
(
font
,
buffer
->
info
[
i
].
codepoint
,
font
->
subtract_glyph_origin_for_direction
(
buffer
->
info
[
i
].
codepoint
,
buffer
->
props
.
direction
,
&
buffer
->
pos
[
i
].
x_offset
,
&
buffer
->
pos
[
i
].
y_offset
);
...
...
src/hb-font-private.hh
浏览文件 @
8fbfda92
...
...
@@ -174,6 +174,210 @@ struct hb_font_t {
}
/* Public getters */
inline
hb_bool_t
get_glyph
(
hb_codepoint_t
unicode
,
hb_codepoint_t
variation_selector
,
hb_codepoint_t
*
glyph
)
{
*
glyph
=
0
;
return
klass
->
get
.
glyph
(
this
,
user_data
,
unicode
,
variation_selector
,
glyph
,
klass
->
user_data
.
glyph
);
}
inline
hb_position_t
get_glyph_h_advance
(
hb_codepoint_t
glyph
)
{
return
klass
->
get
.
glyph_h_advance
(
this
,
user_data
,
glyph
,
klass
->
user_data
.
glyph_h_advance
);
}
inline
hb_position_t
get_glyph_v_advance
(
hb_codepoint_t
glyph
)
{
return
klass
->
get
.
glyph_v_advance
(
this
,
user_data
,
glyph
,
klass
->
user_data
.
glyph_v_advance
);
}
inline
hb_bool_t
get_glyph_h_origin
(
hb_codepoint_t
glyph
,
hb_position_t
*
x
,
hb_position_t
*
y
)
{
*
x
=
*
y
=
0
;
return
klass
->
get
.
glyph_h_origin
(
this
,
user_data
,
glyph
,
x
,
y
,
klass
->
user_data
.
glyph_h_origin
);
}
inline
hb_bool_t
get_glyph_v_origin
(
hb_codepoint_t
glyph
,
hb_position_t
*
x
,
hb_position_t
*
y
)
{
*
x
=
*
y
=
0
;
return
klass
->
get
.
glyph_v_origin
(
this
,
user_data
,
glyph
,
x
,
y
,
klass
->
user_data
.
glyph_v_origin
);
}
inline
hb_position_t
get_glyph_h_kerning
(
hb_codepoint_t
left_glyph
,
hb_codepoint_t
right_glyph
)
{
return
klass
->
get
.
glyph_h_kerning
(
this
,
user_data
,
left_glyph
,
right_glyph
,
klass
->
user_data
.
glyph_h_kerning
);
}
inline
hb_position_t
get_glyph_v_kerning
(
hb_codepoint_t
left_glyph
,
hb_codepoint_t
right_glyph
)
{
return
klass
->
get
.
glyph_v_kerning
(
this
,
user_data
,
left_glyph
,
right_glyph
,
klass
->
user_data
.
glyph_v_kerning
);
}
inline
hb_bool_t
get_glyph_extents
(
hb_codepoint_t
glyph
,
hb_glyph_extents_t
*
extents
)
{
memset
(
extents
,
0
,
sizeof
(
*
extents
));
return
klass
->
get
.
glyph_extents
(
this
,
user_data
,
glyph
,
extents
,
klass
->
user_data
.
glyph_extents
);
}
inline
hb_bool_t
get_glyph_contour_point
(
hb_codepoint_t
glyph
,
unsigned
int
point_index
,
hb_position_t
*
x
,
hb_position_t
*
y
)
{
*
x
=
*
y
=
0
;
return
klass
->
get
.
glyph_contour_point
(
this
,
user_data
,
glyph
,
point_index
,
x
,
y
,
klass
->
user_data
.
glyph_contour_point
);
}
inline
hb_bool_t
get_glyph_name
(
hb_codepoint_t
glyph
,
char
*
name
,
unsigned
int
size
)
{
return
klass
->
get
.
glyph_name
(
this
,
user_data
,
glyph
,
name
,
size
,
klass
->
user_data
.
glyph_name
);
}
inline
hb_bool_t
get_glyph_from_name
(
const
char
*
name
,
int
len
,
/* -1 means nul-terminated */
hb_codepoint_t
*
glyph
)
{
return
klass
->
get
.
glyph_from_name
(
this
,
user_data
,
name
,
len
,
glyph
,
klass
->
user_data
.
glyph_from_name
);
}
/* A bit higher-level, and with fallback */
inline
void
get_glyph_advance_for_direction
(
hb_codepoint_t
glyph
,
hb_direction_t
direction
,
hb_position_t
*
x
,
hb_position_t
*
y
)
{
if
(
likely
(
HB_DIRECTION_IS_HORIZONTAL
(
direction
)))
{
*
x
=
get_glyph_h_advance
(
glyph
);
*
y
=
0
;
}
else
{
*
x
=
0
;
*
y
=
get_glyph_v_advance
(
glyph
);
}
}
/* Internal only */
inline
void
guess_v_origin_minus_h_origin
(
hb_codepoint_t
glyph
,
hb_position_t
*
x
,
hb_position_t
*
y
)
{
*
x
=
get_glyph_h_advance
(
glyph
)
/
2
;
/* TODO use font_metics.ascent */
*
y
=
y_scale
;
}
inline
void
get_glyph_origin_for_direction
(
hb_codepoint_t
glyph
,
hb_direction_t
direction
,
hb_position_t
*
x
,
hb_position_t
*
y
)
{
if
(
likely
(
HB_DIRECTION_IS_HORIZONTAL
(
direction
)))
{
hb_bool_t
ret
=
get_glyph_h_origin
(
glyph
,
x
,
y
);
if
(
!
ret
&&
(
ret
=
get_glyph_v_origin
(
glyph
,
x
,
y
)))
{
hb_position_t
dx
,
dy
;
guess_v_origin_minus_h_origin
(
glyph
,
&
dx
,
&
dy
);
*
x
-=
dx
;
*
y
-=
dy
;
}
}
else
{
hb_bool_t
ret
=
get_glyph_v_origin
(
glyph
,
x
,
y
);
if
(
!
ret
&&
(
ret
=
get_glyph_h_origin
(
glyph
,
x
,
y
)))
{
hb_position_t
dx
,
dy
;
guess_v_origin_minus_h_origin
(
glyph
,
&
dx
,
&
dy
);
*
x
+=
dx
;
*
y
+=
dy
;
}
}
}
inline
void
add_glyph_origin_for_direction
(
hb_codepoint_t
glyph
,
hb_direction_t
direction
,
hb_position_t
*
x
,
hb_position_t
*
y
)
{
hb_position_t
origin_x
,
origin_y
;
get_glyph_origin_for_direction
(
glyph
,
direction
,
&
origin_x
,
&
origin_y
);
*
x
+=
origin_x
;
*
y
+=
origin_y
;
}
inline
void
subtract_glyph_origin_for_direction
(
hb_codepoint_t
glyph
,
hb_direction_t
direction
,
hb_position_t
*
x
,
hb_position_t
*
y
)
{
hb_position_t
origin_x
,
origin_y
;
get_glyph_origin_for_direction
(
glyph
,
direction
,
&
origin_x
,
&
origin_y
);
*
x
-=
origin_x
;
*
y
-=
origin_y
;
}
inline
void
get_glyph_kerning_for_direction
(
hb_codepoint_t
first_glyph
,
hb_codepoint_t
second_glyph
,
hb_direction_t
direction
,
hb_position_t
*
x
,
hb_position_t
*
y
)
{
if
(
likely
(
HB_DIRECTION_IS_HORIZONTAL
(
direction
)))
{
*
x
=
get_glyph_h_kerning
(
first_glyph
,
second_glyph
);
*
y
=
0
;
}
else
{
*
x
=
0
;
*
y
=
get_glyph_v_kerning
(
first_glyph
,
second_glyph
);
}
}
inline
hb_bool_t
get_glyph_extents_for_origin
(
hb_codepoint_t
glyph
,
hb_direction_t
direction
,
hb_glyph_extents_t
*
extents
)
{
hb_bool_t
ret
=
get_glyph_extents
(
glyph
,
extents
);
if
(
ret
)
subtract_glyph_origin_for_direction
(
glyph
,
direction
,
&
extents
->
x_bearing
,
&
extents
->
y_bearing
);
return
ret
;
}
inline
hb_bool_t
get_glyph_contour_point_for_origin
(
hb_codepoint_t
glyph
,
unsigned
int
point_index
,
hb_direction_t
direction
,
hb_position_t
*
x
,
hb_position_t
*
y
)
{
hb_bool_t
ret
=
get_glyph_contour_point
(
glyph
,
point_index
,
x
,
y
);
if
(
ret
)
subtract_glyph_origin_for_direction
(
glyph
,
direction
,
x
,
y
);
return
ret
;
}
private:
inline
hb_position_t
em_scale
(
int16_t
v
,
int
scale
)
{
return
v
*
(
int64_t
)
scale
/
hb_face_get_upem
(
this
->
face
);
}
};
...
...
src/hb-font.cc
浏览文件 @
8fbfda92
...
...
@@ -336,33 +336,28 @@ HB_FONT_FUNCS_IMPLEMENT_CALLBACKS
#undef HB_FONT_FUNC_IMPLEMENT
/* Public getters */
hb_bool_t
hb_font_get_glyph
(
hb_font_t
*
font
,
hb_codepoint_t
unicode
,
hb_codepoint_t
variation_selector
,
hb_codepoint_t
*
glyph
)
{
*
glyph
=
0
;
return
font
->
klass
->
get
.
glyph
(
font
,
font
->
user_data
,
unicode
,
variation_selector
,
glyph
,
font
->
klass
->
user_data
.
glyph
);
return
font
->
get_glyph
(
unicode
,
variation_selector
,
glyph
);
}
hb_position_t
hb_font_get_glyph_h_advance
(
hb_font_t
*
font
,
hb_codepoint_t
glyph
)
{
return
font
->
klass
->
get
.
glyph_h_advance
(
font
,
font
->
user_data
,
glyph
,
font
->
klass
->
user_data
.
glyph_h_advance
);
return
font
->
get_glyph_h_advance
(
glyph
);
}
hb_position_t
hb_font_get_glyph_v_advance
(
hb_font_t
*
font
,
hb_codepoint_t
glyph
)
{
return
font
->
klass
->
get
.
glyph_v_advance
(
font
,
font
->
user_data
,
glyph
,
font
->
klass
->
user_data
.
glyph_v_advance
);
return
font
->
get_glyph_v_advance
(
glyph
);
}
hb_bool_t
...
...
@@ -370,10 +365,7 @@ hb_font_get_glyph_h_origin (hb_font_t *font,
hb_codepoint_t
glyph
,
hb_position_t
*
x
,
hb_position_t
*
y
)
{
*
x
=
*
y
=
0
;
return
font
->
klass
->
get
.
glyph_h_origin
(
font
,
font
->
user_data
,
glyph
,
x
,
y
,
font
->
klass
->
user_data
.
glyph_h_origin
);
return
font
->
get_glyph_h_origin
(
glyph
,
x
,
y
);
}
hb_bool_t
...
...
@@ -381,28 +373,21 @@ hb_font_get_glyph_v_origin (hb_font_t *font,
hb_codepoint_t
glyph
,
hb_position_t
*
x
,
hb_position_t
*
y
)
{
*
x
=
*
y
=
0
;
return
font
->
klass
->
get
.
glyph_v_origin
(
font
,
font
->
user_data
,
glyph
,
x
,
y
,
font
->
klass
->
user_data
.
glyph_v_origin
);
return
font
->
get_glyph_v_origin
(
glyph
,
x
,
y
);
}
hb_position_t
hb_font_get_glyph_h_kerning
(
hb_font_t
*
font
,
hb_codepoint_t
left_glyph
,
hb_codepoint_t
right_glyph
)
{
return
font
->
klass
->
get
.
glyph_h_kerning
(
font
,
font
->
user_data
,
left_glyph
,
right_glyph
,
font
->
klass
->
user_data
.
glyph_h_kerning
);
return
font
->
get_glyph_h_kerning
(
left_glyph
,
right_glyph
);
}
hb_position_t
hb_font_get_glyph_v_kerning
(
hb_font_t
*
font
,
hb_codepoint_t
left_glyph
,
hb_codepoint_t
right_glyph
)
{
return
font
->
klass
->
get
.
glyph_v_kerning
(
font
,
font
->
user_data
,
left_glyph
,
right_glyph
,
font
->
klass
->
user_data
.
glyph_v_kerning
);
return
font
->
get_glyph_v_kerning
(
left_glyph
,
right_glyph
);
}
hb_bool_t
...
...
@@ -410,11 +395,7 @@ hb_font_get_glyph_extents (hb_font_t *font,
hb_codepoint_t
glyph
,
hb_glyph_extents_t
*
extents
)
{
memset
(
extents
,
0
,
sizeof
(
*
extents
));
return
font
->
klass
->
get
.
glyph_extents
(
font
,
font
->
user_data
,
glyph
,
extents
,
font
->
klass
->
user_data
.
glyph_extents
);
return
font
->
get_glyph_extents
(
glyph
,
extents
);
}
hb_bool_t
...
...
@@ -422,11 +403,7 @@ hb_font_get_glyph_contour_point (hb_font_t *font,
hb_codepoint_t
glyph
,
unsigned
int
point_index
,
hb_position_t
*
x
,
hb_position_t
*
y
)
{
*
x
=
*
y
=
0
;
return
font
->
klass
->
get
.
glyph_contour_point
(
font
,
font
->
user_data
,
glyph
,
point_index
,
x
,
y
,
font
->
klass
->
user_data
.
glyph_contour_point
);
return
font
->
get_glyph_contour_point
(
glyph
,
point_index
,
x
,
y
);
}
hb_bool_t
...
...
@@ -434,10 +411,7 @@ hb_font_get_glyph_name (hb_font_t *font,
hb_codepoint_t
glyph
,
char
*
name
,
unsigned
int
size
)
{
return
font
->
klass
->
get
.
glyph_name
(
font
,
font
->
user_data
,
glyph
,
name
,
size
,
font
->
klass
->
user_data
.
glyph_name
);
return
font
->
get_glyph_name
(
glyph
,
name
,
size
);
}
hb_bool_t
...
...
@@ -445,10 +419,7 @@ hb_font_get_glyph_from_name (hb_font_t *font,
const
char
*
name
,
int
len
,
/* -1 means nul-terminated */
hb_codepoint_t
*
glyph
)
{
return
font
->
klass
->
get
.
glyph_from_name
(
font
,
font
->
user_data
,
name
,
len
,
glyph
,
font
->
klass
->
user_data
.
glyph_from_name
);
return
font
->
get_glyph_from_name
(
name
,
len
,
glyph
);
}
...
...
@@ -460,48 +431,16 @@ hb_font_get_glyph_advance_for_direction (hb_font_t *font,
hb_direction_t
direction
,
hb_position_t
*
x
,
hb_position_t
*
y
)
{
if
(
likely
(
HB_DIRECTION_IS_HORIZONTAL
(
direction
)))
{
*
x
=
hb_font_get_glyph_h_advance
(
font
,
glyph
);
*
y
=
0
;
}
else
{
*
x
=
0
;
*
y
=
hb_font_get_glyph_v_advance
(
font
,
glyph
);
}
}
static
void
guess_v_origin_minus_h_origin
(
hb_font_t
*
font
,
hb_codepoint_t
glyph
,
hb_position_t
*
x
,
hb_position_t
*
y
)
{
*
x
=
hb_font_get_glyph_h_advance
(
font
,
glyph
)
/
2
;
/* TODO use font_metics.ascent */
*
y
=
font
->
y_scale
;
return
font
->
get_glyph_advance_for_direction
(
glyph
,
direction
,
x
,
y
);
}
void
hb_font_get_glyph_origin_for_direction
(
hb_font_t
*
font
,
hb_codepoint_t
glyph
,
hb_direction_t
direction
,
hb_position_t
*
x
,
hb_position_t
*
y
)
{
if
(
likely
(
HB_DIRECTION_IS_HORIZONTAL
(
direction
)))
{
hb_bool_t
ret
=
hb_font_get_glyph_h_origin
(
font
,
glyph
,
x
,
y
);
if
(
!
ret
&&
(
ret
=
hb_font_get_glyph_v_origin
(
font
,
glyph
,
x
,
y
)))
{
hb_position_t
dx
,
dy
;
guess_v_origin_minus_h_origin
(
font
,
glyph
,
&
dx
,
&
dy
);
*
x
-=
dx
;
*
y
-=
dy
;
}
}
else
{
hb_bool_t
ret
=
hb_font_get_glyph_v_origin
(
font
,
glyph
,
x
,
y
);
if
(
!
ret
&&
(
ret
=
hb_font_get_glyph_h_origin
(
font
,
glyph
,
x
,
y
)))
{
hb_position_t
dx
,
dy
;
guess_v_origin_minus_h_origin
(
font
,
glyph
,
&
dx
,
&
dy
);
*
x
+=
dx
;
*
y
+=
dy
;
}
}
return
font
->
get_glyph_origin_for_direction
(
glyph
,
direction
,
x
,
y
);
}
void
...
...
@@ -510,12 +449,7 @@ hb_font_add_glyph_origin_for_direction (hb_font_t *font,
hb_direction_t
direction
,
hb_position_t
*
x
,
hb_position_t
*
y
)
{
hb_position_t
origin_x
,
origin_y
;
hb_font_get_glyph_origin_for_direction
(
font
,
glyph
,
direction
,
&
origin_x
,
&
origin_y
);
*
x
+=
origin_x
;
*
y
+=
origin_y
;
return
font
->
add_glyph_origin_for_direction
(
glyph
,
direction
,
x
,
y
);
}
void
...
...
@@ -524,12 +458,7 @@ hb_font_subtract_glyph_origin_for_direction (hb_font_t *font,
hb_direction_t
direction
,
hb_position_t
*
x
,
hb_position_t
*
y
)
{
hb_position_t
origin_x
,
origin_y
;
hb_font_get_glyph_origin_for_direction
(
font
,
glyph
,
direction
,
&
origin_x
,
&
origin_y
);
*
x
-=
origin_x
;
*
y
-=
origin_y
;
return
font
->
subtract_glyph_origin_for_direction
(
glyph
,
direction
,
x
,
y
);
}
void
...
...
@@ -538,13 +467,7 @@ hb_font_get_glyph_kerning_for_direction (hb_font_t *font,
hb_direction_t
direction
,
hb_position_t
*
x
,
hb_position_t
*
y
)
{
if
(
likely
(
HB_DIRECTION_IS_HORIZONTAL
(
direction
)))
{
*
x
=
hb_font_get_glyph_h_kerning
(
font
,
first_glyph
,
second_glyph
);
*
y
=
0
;
}
else
{
*
x
=
0
;
*
y
=
hb_font_get_glyph_v_kerning
(
font
,
first_glyph
,
second_glyph
);
}
return
font
->
get_glyph_kerning_for_direction
(
first_glyph
,
second_glyph
,
direction
,
x
,
y
);
}
hb_bool_t
...
...
@@ -553,12 +476,7 @@ hb_font_get_glyph_extents_for_origin (hb_font_t *font,
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
;
return
font
->
get_glyph_extents_for_origin
(
glyph
,
direction
,
extents
);
}
hb_bool_t
...
...
@@ -567,12 +485,7 @@ hb_font_get_glyph_contour_point_for_origin (hb_font_t *font,
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
);
if
(
ret
)
hb_font_subtract_glyph_origin_for_direction
(
font
,
glyph
,
direction
,
x
,
y
);
return
ret
;
return
font
->
get_glyph_contour_point_for_origin
(
glyph
,
point_index
,
direction
,
x
,
y
);
}
...
...
@@ -1058,5 +971,3 @@ hb_font_get_ppem (hb_font_t *font,
if
(
x_ppem
)
*
x_ppem
=
font
->
x_ppem
;
if
(
y_ppem
)
*
y_ppem
=
font
->
y_ppem
;
}
src/hb-graphite2.cc
浏览文件 @
8fbfda92
...
...
@@ -108,7 +108,7 @@ static const void *hb_gr_get_table (const void *data, unsigned int tag, size_t *
static
float
hb_gr_get_advance
(
const
void
*
hb_font
,
unsigned
short
gid
)
{
return
hb_font_get_glyph_h_advance
((
hb_font_t
*
)
hb_font
,
gid
);
return
((
hb_font_t
*
)
font
)
->
get_glyph_h_advance
(
gid
);
}
static
void
_hb_gr_face_data_destroy
(
void
*
data
)
...
...
@@ -191,9 +191,7 @@ _hb_gr_font_get_data (hb_font_t *font)
}
data
->
grface
=
_hb_gr_face_get_data
(
font
->
face
)
->
grface
;
int
scale
;
hb_font_get_scale
(
font
,
&
scale
,
NULL
);
data
->
grfont
=
gr_make_font_with_advance_fn
(
scale
,
font
,
&
hb_gr_get_advance
,
data
->
grface
);
data
->
grfont
=
gr_make_font_with_advance_fn
(
font
->
x_scale
,
font
,
&
hb_gr_get_advance
,
data
->
grface
);
if
(
unlikely
(
!
hb_font_set_user_data
(
font
,
&
hb_gr_data_key
,
data
,
...
...
src/hb-old.cc
浏览文件 @
8fbfda92
...
...
@@ -90,13 +90,13 @@ hb_old_convertStringToGlyphIndices (HB_Font old_font,
{
hb_codepoint_t
u
;
/*
TODO
Handle UTF-16. Ugh */
/*
XXX
Handle UTF-16. Ugh */
u
=
string
[
i
];
if
(
rightToLeft
)
u
=
hb_unicode_funcs_get_default
()
->
mirroring
(
u
);
hb_font_get_glyph
(
font
,
u
,
0
,
&
u
);
/* TODO Variation selectors */
font
->
get_glyph
(
u
,
0
,
&
u
);
/* TODO Variation selectors */
glyphs
[
i
]
=
u
;
}
...
...
@@ -115,7 +115,7 @@ hb_old_getGlyphAdvances (HB_Font old_font,
hb_font_t
*
font
=
(
hb_font_t
*
)
old_font
->
userData
;
for
(
unsigned
int
i
=
0
;
i
<
numGlyphs
;
i
++
)
advances
[
i
]
=
hb_font_get_glyph_h_advance
(
font
,
glyphs
[
i
]);
advances
[
i
]
=
font
->
get_glyph_h_advance
(
glyphs
[
i
]);
}
static
HB_Bool
...
...
@@ -147,13 +147,13 @@ hb_old_getGlyphMetrics (HB_Font old_font,
hb_glyph_extents_t
extents
;
hb_font_get_glyph_extents
(
font
,
glyph
,
&
extents
);
font
->
get_glyph_extents
(
glyph
,
&
extents
);
metrics
->
x
=
extents
.
x_bearing
;
metrics
->
y
=
extents
.
y_bearing
;
metrics
->
width
=
extents
.
width
;
metrics
->
height
=
-
extents
.
height
;
metrics
->
xOffset
=
hb_font_get_glyph_h_advance
(
font
,
glyph
);
metrics
->
xOffset
=
font
->
get_glyph_h_advance
(
glyph
);
metrics
->
yOffset
=
0
;
}
...
...
src/hb-ot-layout-gdef-table.hh
浏览文件 @
8fbfda92
...
...
@@ -119,7 +119,7 @@ struct CaretValueFormat2
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_origin
(
font
,
glyph_id
,
caretValuePoint
,
direction
,
&
x
,
&
y
))
if
(
font
->
get_glyph_contour_point_for_origin
(
glyph_id
,
caretValuePoint
,
direction
,
&
x
,
&
y
))
return
HB_DIRECTION_IS_HORIZONTAL
(
direction
)
?
x
:
y
;
else
return
0
;
...
...
src/hb-ot-layout-gpos-table.hh
浏览文件 @
8fbfda92
...
...
@@ -247,7 +247,7 @@ struct AnchorFormat2
hb_bool_t
ret
=
false
;
if
(
x_ppem
||
y_ppem
)
ret
=
hb_font_get_glyph_contour_point_for_origin
(
font
,
glyph_id
,
anchorPoint
,
HB_DIRECTION_LTR
,
&
cx
,
&
cy
);
ret
=
font
->
get_glyph_contour_point_for_origin
(
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
);
}
...
...
src/hb-ot-shape-complex-arabic.cc
浏览文件 @
8fbfda92
...
...
@@ -211,7 +211,7 @@ arabic_fallback_shape (hb_font_t *font, hb_buffer_t *buffer)
for
(
unsigned
int
i
=
0
;
i
<
count
;
i
++
)
{
hb_codepoint_t
u
=
buffer
->
info
[
i
].
codepoint
;
hb_codepoint_t
shaped
=
get_arabic_shape
(
u
,
buffer
->
info
[
i
].
arabic_shaping_action
());
if
(
shaped
!=
u
&&
hb_font_get_glyph
(
font
,
shaped
,
0
,
&
glyph
))
if
(
shaped
!=
u
&&
font
->
get_glyph
(
shaped
,
0
,
&
glyph
))
buffer
->
info
[
i
].
codepoint
=
shaped
;
}
...
...
@@ -220,7 +220,7 @@ arabic_fallback_shape (hb_font_t *font, hb_buffer_t *buffer)
for
(
buffer
->
idx
=
0
;
buffer
->
idx
+
1
<
count
;)
{
hb_codepoint_t
ligature
=
get_ligature
(
buffer
->
cur
().
codepoint
,
buffer
->
cur
(
+
1
).
codepoint
);
if
(
likely
(
!
ligature
)
||
!
(
hb_font_get_glyph
(
font
,
ligature
,
0
,
&
glyph
)))
{
if
(
likely
(
!
ligature
)
||
!
(
font
->
get_glyph
(
ligature
,
0
,
&
glyph
)))
{
buffer
->
next_glyph
();
continue
;
}
...
...
src/hb-ot-shape-complex-indic.cc
浏览文件 @
8fbfda92
...
...
@@ -130,10 +130,10 @@ consonant_position (hb_codepoint_t u,
hb_codepoint_t
glyphs
[
2
];
unsigned
int
virama_pos
=
IS_OLD_INDIC_TAG
(
map
->
get_chosen_script
(
0
))
?
1
:
0
;
hb_font_get_glyph
(
font
,
virama
,
0
,
&
glyphs
[
virama_pos
]);
hb_font_get_glyph
(
font
,
u
,
0
,
&
glyphs
[
1
-
virama_pos
]);
font
->
get_glyph
(
virama
,
0
,
&
glyphs
[
virama_pos
]);
font
->
get_glyph
(
u
,
0
,
&
glyphs
[
1
-
virama_pos
]);
hb_face_t
*
face
=
hb_font_get_face
(
font
)
;
hb_face_t
*
face
=
font
->
face
;
if
(
would_substitute
(
glyphs
,
ARRAY_LENGTH
(
glyphs
),
HB_TAG
(
'p'
,
'r'
,
'e'
,
'f'
),
map
,
face
))
return
POS_BELOW_C
;
if
(
would_substitute
(
glyphs
,
ARRAY_LENGTH
(
glyphs
),
HB_TAG
(
'b'
,
'l'
,
'w'
,
'f'
),
map
,
face
))
return
POS_BELOW_C
;
if
(
would_substitute
(
glyphs
,
ARRAY_LENGTH
(
glyphs
),
HB_TAG
(
'p'
,
's'
,
't'
,
'f'
),
map
,
face
))
return
POS_POST_C
;
...
...
src/hb-ot-shape-normalize.cc
浏览文件 @
8fbfda92
...
...
@@ -96,10 +96,10 @@ decompose (hb_font_t *font, hb_buffer_t *buffer,
hb_codepoint_t
a
,
b
,
glyph
;
if
(
!
buffer
->
unicode
->
decompose
(
ab
,
&
a
,
&
b
)
||
(
b
&&
!
hb_font_get_glyph
(
font
,
b
,
0
,
&
glyph
)))
(
b
&&
!
font
->
get_glyph
(
b
,
0
,
&
glyph
)))
return
false
;
bool
has_a
=
hb_font_get_glyph
(
font
,
a
,
0
,
&
glyph
);
bool
has_a
=
font
->
get_glyph
(
a
,
0
,
&
glyph
);
if
(
shortest
&&
has_a
)
{
/* Output a and b */
output_glyph
(
buffer
,
a
);
...
...
@@ -137,7 +137,7 @@ decompose_compatibility (hb_font_t *font, hb_buffer_t *buffer,
hb_codepoint_t
glyph
;
for
(
i
=
0
;
i
<
len
;
i
++
)
if
(
!
hb_font_get_glyph
(
font
,
decomposed
[
i
],
0
,
&
glyph
))
if
(
!
font
->
get_glyph
(
decomposed
[
i
],
0
,
&
glyph
))
return
false
;
for
(
i
=
0
;
i
<
len
;
i
++
)
...
...
@@ -153,11 +153,11 @@ decompose_current_character (hb_font_t *font, hb_buffer_t *buffer,
hb_codepoint_t
glyph
;
/* Kind of a cute waterfall here... */
if
(
shortest
&&
hb_font_get_glyph
(
font
,
buffer
->
cur
().
codepoint
,
0
,
&
glyph
))
if
(
shortest
&&
font
->
get_glyph
(
buffer
->
cur
().
codepoint
,
0
,
&
glyph
))
buffer
->
next_glyph
();
else
if
(
decompose
(
font
,
buffer
,
shortest
,
buffer
->
cur
().
codepoint
))
buffer
->
skip_glyph
();
else
if
(
!
shortest
&&
hb_font_get_glyph
(
font
,
buffer
->
cur
().
codepoint
,
0
,
&
glyph
))
else
if
(
!
shortest
&&
font
->
get_glyph
(
buffer
->
cur
().
codepoint
,
0
,
&
glyph
))
buffer
->
next_glyph
();
else
if
(
decompose_compatibility
(
font
,
buffer
,
buffer
->
cur
().
codepoint
))
buffer
->
skip_glyph
();
...
...
@@ -285,7 +285,7 @@ _hb_ot_shape_normalize (hb_font_t *font, hb_buffer_t *buffer,
buffer
->
cur
().
codepoint
,
&
composed
)
&&
/* And the font has glyph for the composite. */
hb_font_get_glyph
(
font
,
composed
,
0
,
&
glyph
))
font
->
get_glyph
(
composed
,
0
,
&
glyph
))
{
/* Composes. */
buffer
->
next_glyph
();
/* Copy to out-buffer. */
...
...
src/hb-ot-shape.cc
浏览文件 @
8fbfda92
...
...
@@ -328,15 +328,15 @@ hb_map_glyphs (hb_font_t *font,
unsigned
int
count
=
buffer
->
len
-
1
;
for
(
buffer
->
idx
=
0
;
buffer
->
idx
<
count
;)
{
if
(
unlikely
(
buffer
->
unicode
->
is_variation_selector
(
buffer
->
cur
(
+
1
).
codepoint
)))
{
hb_font_get_glyph
(
font
,
buffer
->
cur
().
codepoint
,
buffer
->
cur
(
+
1
).
codepoint
,
&
glyph
);
font
->
get_glyph
(
buffer
->
cur
().
codepoint
,
buffer
->
cur
(
+
1
).
codepoint
,
&
glyph
);
buffer
->
replace_glyphs
(
2
,
1
,
&
glyph
);
}
else
{
hb_font_get_glyph
(
font
,
buffer
->
cur
().
codepoint
,
0
,
&
glyph
);
font
->
get_glyph
(
buffer
->
cur
().
codepoint
,
0
,
&
glyph
);
buffer
->
replace_glyph
(
glyph
);
}
}
if
(
likely
(
buffer
->
idx
<
buffer
->
len
))
{
hb_font_get_glyph
(
font
,
buffer
->
cur
().
codepoint
,
0
,
&
glyph
);
font
->
get_glyph
(
buffer
->
cur
().
codepoint
,
0
,
&
glyph
);
buffer
->
replace_glyph
(
glyph
);
}
buffer
->
swap_buffers
();
...
...
@@ -390,11 +390,11 @@ hb_position_default (hb_ot_shape_context_t *c)
unsigned
int
count
=
c
->
buffer
->
len
;
for
(
unsigned
int
i
=
0
;
i
<
count
;
i
++
)
{
hb_font_get_glyph_advance_for_direction
(
c
->
font
,
c
->
buffer
->
info
[
i
].
codepoint
,
c
->
font
->
get_glyph_advance_for_direction
(
c
->
buffer
->
info
[
i
].
codepoint
,
c
->
buffer
->
props
.
direction
,
&
c
->
buffer
->
pos
[
i
].
x_advance
,
&
c
->
buffer
->
pos
[
i
].
y_advance
);
hb_font_subtract_glyph_origin_for_direction
(
c
->
font
,
c
->
buffer
->
info
[
i
].
codepoint
,
c
->
font
->
subtract_glyph_origin_for_direction
(
c
->
buffer
->
info
[
i
].
codepoint
,
c
->
buffer
->
props
.
direction
,
&
c
->
buffer
->
pos
[
i
].
x_offset
,
&
c
->
buffer
->
pos
[
i
].
y_offset
);
...
...
@@ -423,7 +423,7 @@ hb_ot_position_complex (hb_ot_shape_context_t *c)
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
,
c
->
font
->
add_glyph_origin_for_direction
(
c
->
buffer
->
info
[
i
].
codepoint
,
HB_DIRECTION_LTR
,
&
c
->
buffer
->
pos
[
i
].
x_offset
,
&
c
->
buffer
->
pos
[
i
].
y_offset
);
...
...
@@ -432,7 +432,7 @@ hb_ot_position_complex (hb_ot_shape_context_t *c)
c
->
plan
->
map
.
position
(
c
->
font
,
c
->
buffer
);
for
(
unsigned
int
i
=
0
;
i
<
count
;
i
++
)
{
hb_font_subtract_glyph_origin_for_direction
(
c
->
font
,
c
->
buffer
->
info
[
i
].
codepoint
,
c
->
font
->
subtract_glyph_origin_for_direction
(
c
->
buffer
->
info
[
i
].
codepoint
,
HB_DIRECTION_LTR
,
&
c
->
buffer
->
pos
[
i
].
x_offset
,
&
c
->
buffer
->
pos
[
i
].
y_offset
);
...
...
@@ -460,8 +460,7 @@ hb_truetype_kern (hb_ot_shape_context_t *c)
unsigned
int
count
=
c
->
buffer
->
len
;
for
(
unsigned
int
i
=
1
;
i
<
count
;
i
++
)
{
hb_position_t
x_kern
,
y_kern
,
kern1
,
kern2
;
hb_font_get_glyph_kerning_for_direction
(
c
->
font
,
c
->
buffer
->
info
[
i
-
1
].
codepoint
,
c
->
buffer
->
info
[
i
].
codepoint
,
c
->
font
->
get_glyph_kerning_for_direction
(
c
->
buffer
->
info
[
i
-
1
].
codepoint
,
c
->
buffer
->
info
[
i
].
codepoint
,
c
->
buffer
->
props
.
direction
,
&
x_kern
,
&
y_kern
);
...
...
@@ -489,7 +488,7 @@ static void
hb_hide_zerowidth
(
hb_ot_shape_context_t
*
c
)
{
hb_codepoint_t
space
;
if
(
!
hb_font_get_glyph
(
c
->
font
,
' '
,
0
,
&
space
))
if
(
!
c
->
font
->
get_glyph
(
' '
,
0
,
&
space
))
return
;
/* No point! */
unsigned
int
count
=
c
->
buffer
->
len
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录