Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Harfbuzz
提交
72657e4c
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看板
提交
72657e4c
编写于
5月 02, 2011
作者:
B
Behdad Esfahbod
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[API] Make hb_font_create() take a face and reference it
上级
cec6611c
变更
15
显示空白变更内容
内联
并排
Showing
15 changed file
with
70 addition
and
79 deletion
+70
-79
src/hb-font-private.hh
src/hb-font-private.hh
+2
-0
src/hb-font.cc
src/hb-font.cc
+26
-16
src/hb-font.h
src/hb-font.h
+15
-11
src/hb-ft.cc
src/hb-ft.cc
+1
-6
src/hb-ot-layout-gdef-private.hh
src/hb-ot-layout-gdef-private.hh
+1
-1
src/hb-ot-layout-gpos-private.hh
src/hb-ot-layout-gpos-private.hh
+1
-1
src/hb-ot-layout.cc
src/hb-ot-layout.cc
+4
-6
src/hb-ot-layout.h
src/hb-ot-layout.h
+0
-2
src/hb-ot-map-private.hh
src/hb-ot-map-private.hh
+1
-1
src/hb-ot-shape.cc
src/hb-ot-shape.cc
+11
-12
src/hb-ot-shape.h
src/hb-ot-shape.h
+0
-1
src/hb-shape.cc
src/hb-shape.cc
+2
-16
src/hb-shape.h
src/hb-shape.h
+0
-1
src/hb-view.cc
src/hb-view.cc
+1
-3
test/test-object.c
test/test-object.c
+5
-2
未找到文件。
src/hb-font-private.hh
浏览文件 @
72657e4c
...
...
@@ -83,6 +83,8 @@ struct _hb_face_t {
struct
_hb_font_t
{
hb_object_header_t
header
;
hb_face_t
*
face
;
unsigned
int
x_scale
;
unsigned
int
y_scale
;
...
...
src/hb-font.cc
浏览文件 @
72657e4c
...
...
@@ -43,7 +43,6 @@ HB_BEGIN_DECLS
static
hb_codepoint_t
hb_font_get_glyph_nil
(
hb_font_t
*
font
HB_UNUSED
,
hb_face_t
*
face
HB_UNUSED
,
const
void
*
user_data
HB_UNUSED
,
hb_codepoint_t
unicode
HB_UNUSED
,
hb_codepoint_t
variation_selector
HB_UNUSED
)
...
...
@@ -51,7 +50,6 @@ hb_font_get_glyph_nil (hb_font_t *font HB_UNUSED,
static
void
hb_font_get_glyph_advance_nil
(
hb_font_t
*
font
HB_UNUSED
,
hb_face_t
*
face
HB_UNUSED
,
const
void
*
user_data
HB_UNUSED
,
hb_codepoint_t
glyph
HB_UNUSED
,
hb_position_t
*
x_advance
HB_UNUSED
,
...
...
@@ -60,7 +58,6 @@ hb_font_get_glyph_advance_nil (hb_font_t *font HB_UNUSED,
static
void
hb_font_get_glyph_extents_nil
(
hb_font_t
*
font
HB_UNUSED
,
hb_face_t
*
face
HB_UNUSED
,
const
void
*
user_data
HB_UNUSED
,
hb_codepoint_t
glyph
HB_UNUSED
,
hb_glyph_extents_t
*
extents
HB_UNUSED
)
...
...
@@ -68,7 +65,6 @@ hb_font_get_glyph_extents_nil (hb_font_t *font HB_UNUSED,
static
hb_bool_t
hb_font_get_contour_point_nil
(
hb_font_t
*
font
HB_UNUSED
,
hb_face_t
*
face
HB_UNUSED
,
const
void
*
user_data
HB_UNUSED
,
unsigned
int
point_index
HB_UNUSED
,
hb_codepoint_t
glyph
HB_UNUSED
,
...
...
@@ -78,7 +74,6 @@ hb_font_get_contour_point_nil (hb_font_t *font HB_UNUSED,
static
hb_position_t
hb_font_get_kerning_nil
(
hb_font_t
*
font
HB_UNUSED
,
hb_face_t
*
face
HB_UNUSED
,
const
void
*
user_data
HB_UNUSED
,
hb_codepoint_t
first_glyph
HB_UNUSED
,
hb_codepoint_t
second_glyph
HB_UNUSED
)
...
...
@@ -241,48 +236,48 @@ hb_font_funcs_get_kerning_func (hb_font_funcs_t *ffuncs)
hb_codepoint_t
hb_font_get_glyph
(
hb_font_t
*
font
,
hb_face_t
*
face
,
hb_font_get_glyph
(
hb_font_t
*
font
,
hb_codepoint_t
unicode
,
hb_codepoint_t
variation_selector
)
{
return
font
->
klass
->
v
.
get_glyph
(
font
,
f
ace
,
f
ont
->
user_data
,
return
font
->
klass
->
v
.
get_glyph
(
font
,
font
->
user_data
,
unicode
,
variation_selector
);
}
void
hb_font_get_glyph_advance
(
hb_font_t
*
font
,
hb_face_t
*
face
,
hb_font_get_glyph_advance
(
hb_font_t
*
font
,
hb_codepoint_t
glyph
,
hb_position_t
*
x_advance
,
hb_position_t
*
y_advance
)
{
*
x_advance
=
*
y_advance
=
0
;
return
font
->
klass
->
v
.
get_glyph_advance
(
font
,
f
ace
,
f
ont
->
user_data
,
return
font
->
klass
->
v
.
get_glyph_advance
(
font
,
font
->
user_data
,
glyph
,
x_advance
,
y_advance
);
}
void
hb_font_get_glyph_extents
(
hb_font_t
*
font
,
hb_face_t
*
face
,
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
->
v
.
get_glyph_extents
(
font
,
f
ace
,
f
ont
->
user_data
,
return
font
->
klass
->
v
.
get_glyph_extents
(
font
,
font
->
user_data
,
glyph
,
extents
);
}
hb_bool_t
hb_font_get_contour_point
(
hb_font_t
*
font
,
hb_face_t
*
face
,
hb_font_get_contour_point
(
hb_font_t
*
font
,
unsigned
int
point_index
,
hb_codepoint_t
glyph
,
hb_position_t
*
x
,
hb_position_t
*
y
)
{
*
x
=
0
;
*
y
=
0
;
return
font
->
klass
->
v
.
get_contour_point
(
font
,
f
ace
,
f
ont
->
user_data
,
return
font
->
klass
->
v
.
get_contour_point
(
font
,
font
->
user_data
,
point_index
,
glyph
,
x
,
y
);
}
hb_position_t
hb_font_get_kerning
(
hb_font_t
*
font
,
hb_face_t
*
face
,
hb_font_get_kerning
(
hb_font_t
*
font
,
hb_codepoint_t
first_glyph
,
hb_codepoint_t
second_glyph
)
{
return
font
->
klass
->
v
.
get_kerning
(
font
,
f
ace
,
f
ont
->
user_data
,
return
font
->
klass
->
v
.
get_kerning
(
font
,
font
->
user_data
,
first_glyph
,
second_glyph
);
}
...
...
@@ -462,6 +457,8 @@ hb_face_get_upem (hb_face_t *face)
static
hb_font_t
_hb_font_nil
=
{
HB_OBJECT_HEADER_STATIC
,
&
_hb_face_nil
,
0
,
/* x_scale */
0
,
/* y_scale */
...
...
@@ -474,13 +471,18 @@ static hb_font_t _hb_font_nil = {
};
hb_font_t
*
hb_font_create
(
void
)
hb_font_create
(
hb_face_t
*
face
)
{
hb_font_t
*
font
;
if
(
unlikely
(
!
face
))
face
=
&
_hb_face_nil
;
if
(
unlikely
(
hb_object_is_inert
(
face
)))
return
&
_hb_font_nil
;
if
(
!
(
font
=
hb_object_create
<
hb_font_t
>
()))
return
&
_hb_font_nil
;
font
->
face
=
hb_face_reference
(
face
);
font
->
klass
=
&
_hb_font_funcs_nil
;
return
font
;
...
...
@@ -497,6 +499,7 @@ hb_font_destroy (hb_font_t *font)
{
if
(
!
hb_object_destroy
(
font
))
return
;
hb_face_destroy
(
font
->
face
);
hb_font_funcs_destroy
(
font
->
klass
);
if
(
font
->
destroy
)
font
->
destroy
(
font
->
user_data
);
...
...
@@ -521,6 +524,13 @@ hb_font_get_user_data (hb_font_t *font,
}
hb_face_t
*
hb_font_get_face
(
hb_font_t
*
font
)
{
return
font
->
face
;
}
void
hb_font_set_funcs
(
hb_font_t
*
font
,
hb_font_funcs_t
*
klass
,
...
...
src/hb-font.h
浏览文件 @
72657e4c
...
...
@@ -121,18 +121,18 @@ typedef struct _hb_glyph_extents_t
hb_position_t
height
;
}
hb_glyph_extents_t
;
typedef
hb_codepoint_t
(
*
hb_font_get_glyph_func_t
)
(
hb_font_t
*
font
,
hb_face_t
*
face
,
const
void
*
user_data
,
typedef
hb_codepoint_t
(
*
hb_font_get_glyph_func_t
)
(
hb_font_t
*
font
,
const
void
*
user_data
,
hb_codepoint_t
unicode
,
hb_codepoint_t
variation_selector
);
typedef
void
(
*
hb_font_get_glyph_advance_func_t
)
(
hb_font_t
*
font
,
hb_face_t
*
face
,
const
void
*
user_data
,
typedef
void
(
*
hb_font_get_glyph_advance_func_t
)
(
hb_font_t
*
font
,
const
void
*
user_data
,
hb_codepoint_t
glyph
,
hb_position_t
*
x_advance
,
hb_position_t
*
y_advance
);
typedef
void
(
*
hb_font_get_glyph_extents_func_t
)
(
hb_font_t
*
font
,
hb_face_t
*
face
,
const
void
*
user_data
,
typedef
void
(
*
hb_font_get_glyph_extents_func_t
)
(
hb_font_t
*
font
,
const
void
*
user_data
,
hb_codepoint_t
glyph
,
hb_glyph_extents_t
*
extents
);
typedef
hb_bool_t
(
*
hb_font_get_contour_point_func_t
)
(
hb_font_t
*
font
,
hb_face_t
*
face
,
const
void
*
user_data
,
typedef
hb_bool_t
(
*
hb_font_get_contour_point_func_t
)
(
hb_font_t
*
font
,
const
void
*
user_data
,
unsigned
int
point_index
,
hb_codepoint_t
glyph
,
hb_position_t
*
x
,
hb_position_t
*
y
);
typedef
hb_position_t
(
*
hb_font_get_kerning_func_t
)
(
hb_font_t
*
font
,
hb_face_t
*
face
,
const
void
*
user_data
,
typedef
hb_position_t
(
*
hb_font_get_kerning_func_t
)
(
hb_font_t
*
font
,
const
void
*
user_data
,
hb_codepoint_t
first_glyph
,
hb_codepoint_t
second_glyph
);
...
...
@@ -176,26 +176,26 @@ hb_font_funcs_get_kerning_func (hb_font_funcs_t *ffuncs);
hb_codepoint_t
hb_font_get_glyph
(
hb_font_t
*
font
,
hb_face_t
*
face
,
hb_font_get_glyph
(
hb_font_t
*
font
,
hb_codepoint_t
unicode
,
hb_codepoint_t
variation_selector
);
void
hb_font_get_glyph_advance
(
hb_font_t
*
font
,
hb_face_t
*
face
,
hb_font_get_glyph_advance
(
hb_font_t
*
font
,
hb_codepoint_t
glyph
,
hb_position_t
*
x_advance
,
hb_position_t
*
y_advance
);
void
hb_font_get_glyph_extents
(
hb_font_t
*
font
,
hb_face_t
*
face
,
hb_font_get_glyph_extents
(
hb_font_t
*
font
,
hb_codepoint_t
glyph
,
hb_glyph_extents_t
*
extents
);
hb_bool_t
hb_font_get_contour_point
(
hb_font_t
*
font
,
hb_face_t
*
face
,
hb_font_get_contour_point
(
hb_font_t
*
font
,
unsigned
int
point_index
,
hb_codepoint_t
glyph
,
hb_position_t
*
x
,
hb_position_t
*
y
);
hb_position_t
hb_font_get_kerning
(
hb_font_t
*
font
,
hb_face_t
*
face
,
hb_font_get_kerning
(
hb_font_t
*
font
,
hb_codepoint_t
first_glyph
,
hb_codepoint_t
second_glyph
);
...
...
@@ -206,7 +206,7 @@ hb_font_get_kerning (hb_font_t *font, hb_face_t *face,
/* Fonts are very light-weight objects */
hb_font_t
*
hb_font_create
(
void
);
hb_font_create
(
hb_face_t
*
face
);
hb_font_t
*
hb_font_reference
(
hb_font_t
*
font
);
...
...
@@ -226,6 +226,10 @@ hb_font_get_user_data (hb_font_t *font,
hb_user_data_key_t
*
key
);
hb_face_t
*
hb_font_get_face
(
hb_font_t
*
font
);
void
hb_font_set_funcs
(
hb_font_t
*
font
,
hb_font_funcs_t
*
klass
,
...
...
src/hb-ft.cc
浏览文件 @
72657e4c
...
...
@@ -38,7 +38,6 @@ HB_BEGIN_DECLS
static
hb_codepoint_t
hb_ft_get_glyph
(
hb_font_t
*
font
HB_UNUSED
,
hb_face_t
*
face
HB_UNUSED
,
const
void
*
user_data
,
hb_codepoint_t
unicode
,
hb_codepoint_t
variation_selector
)
...
...
@@ -58,7 +57,6 @@ hb_ft_get_glyph (hb_font_t *font HB_UNUSED,
static
void
hb_ft_get_glyph_advance
(
hb_font_t
*
font
HB_UNUSED
,
hb_face_t
*
face
HB_UNUSED
,
const
void
*
user_data
,
hb_codepoint_t
glyph
,
hb_position_t
*
x_advance
,
...
...
@@ -78,7 +76,6 @@ hb_ft_get_glyph_advance (hb_font_t *font HB_UNUSED,
static
void
hb_ft_get_glyph_extents
(
hb_font_t
*
font
HB_UNUSED
,
hb_face_t
*
face
HB_UNUSED
,
const
void
*
user_data
,
hb_codepoint_t
glyph
,
hb_glyph_extents_t
*
extents
)
...
...
@@ -100,7 +97,6 @@ hb_ft_get_glyph_extents (hb_font_t *font HB_UNUSED,
static
hb_bool_t
hb_ft_get_contour_point
(
hb_font_t
*
font
HB_UNUSED
,
hb_face_t
*
face
HB_UNUSED
,
const
void
*
user_data
,
unsigned
int
point_index
,
hb_codepoint_t
glyph
,
...
...
@@ -129,7 +125,6 @@ hb_ft_get_contour_point (hb_font_t *font HB_UNUSED,
static
hb_position_t
hb_ft_get_kerning
(
hb_font_t
*
font
HB_UNUSED
,
hb_face_t
*
face
HB_UNUSED
,
const
void
*
user_data
,
hb_codepoint_t
first_glyph
,
hb_codepoint_t
second_glyph
)
...
...
@@ -244,7 +239,7 @@ hb_ft_font_create (FT_Face ft_face,
{
hb_font_t
*
font
;
font
=
hb_font_create
();
font
=
hb_font_create
(
hb_ft_face_create_cached
(
ft_face
)
);
hb_font_set_funcs
(
font
,
hb_ft_get_font_funcs
(),
ft_face
,
destroy
);
...
...
src/hb-ot-layout-gdef-private.hh
浏览文件 @
72657e4c
...
...
@@ -121,7 +121,7 @@ struct CaretValueFormat2
inline
int
get_caret_value
(
hb_ot_layout_context_t
*
c
,
hb_direction_t
direction
,
hb_codepoint_t
glyph_id
)
const
{
hb_position_t
x
,
y
;
if
(
hb_font_get_contour_point
(
c
->
font
,
c
->
face
,
c
aretValuePoint
,
glyph_id
,
&
x
,
&
y
))
if
(
hb_font_get_contour_point
(
c
->
font
,
caretValuePoint
,
glyph_id
,
&
x
,
&
y
))
return
HB_DIRECTION_IS_HORIZONTAL
(
direction
)
?
x
:
y
;
else
return
0
;
...
...
src/hb-ot-layout-gpos-private.hh
浏览文件 @
72657e4c
...
...
@@ -243,7 +243,7 @@ struct AnchorFormat2
hb_bool_t
ret
=
false
;
if
(
x_ppem
||
y_ppem
)
ret
=
hb_font_get_contour_point
(
layout
->
font
,
layout
->
face
,
anchorPoint
,
glyph_id
,
&
cx
,
&
cy
);
ret
=
hb_font_get_contour_point
(
layout
->
font
,
anchorPoint
,
glyph_id
,
&
cx
,
&
cy
);
*
x
=
x_ppem
&&
ret
?
cx
:
layout
->
scale_x
(
xCoordinate
);
*
y
=
y_ppem
&&
ret
?
cy
:
layout
->
scale_y
(
yCoordinate
);
}
...
...
src/hb-ot-layout.cc
浏览文件 @
72657e4c
...
...
@@ -193,7 +193,6 @@ hb_ot_layout_get_attach_points (hb_face_t *face,
unsigned
int
hb_ot_layout_get_ligature_carets
(
hb_font_t
*
font
,
hb_face_t
*
face
,
hb_direction_t
direction
,
hb_codepoint_t
glyph
,
unsigned
int
start_offset
,
...
...
@@ -202,8 +201,8 @@ hb_ot_layout_get_ligature_carets (hb_font_t *font,
{
hb_ot_layout_context_t
c
;
c
.
font
=
font
;
c
.
face
=
face
;
return
_get_gdef
(
face
).
get_lig_carets
(
&
c
,
direction
,
glyph
,
start_offset
,
caret_count
,
caret_array
);
c
.
face
=
f
ont
->
f
ace
;
return
_get_gdef
(
c
.
face
).
get_lig_carets
(
&
c
,
direction
,
glyph
,
start_offset
,
caret_count
,
caret_array
);
}
/*
...
...
@@ -470,15 +469,14 @@ hb_ot_layout_position_start (hb_buffer_t *buffer)
hb_bool_t
hb_ot_layout_position_lookup
(
hb_font_t
*
font
,
hb_face_t
*
face
,
hb_buffer_t
*
buffer
,
unsigned
int
lookup_index
,
hb_mask_t
mask
)
{
hb_ot_layout_context_t
c
;
c
.
font
=
font
;
c
.
face
=
face
;
return
_get_gpos
(
face
).
position_lookup
(
&
c
,
buffer
,
lookup_index
,
mask
);
c
.
face
=
f
ont
->
f
ace
;
return
_get_gpos
(
c
.
face
).
position_lookup
(
&
c
,
buffer
,
lookup_index
,
mask
);
}
void
...
...
src/hb-ot-layout.h
浏览文件 @
72657e4c
...
...
@@ -59,7 +59,6 @@ hb_ot_layout_get_attach_points (hb_face_t *face,
/* Ligature caret positions */
unsigned
int
hb_ot_layout_get_ligature_carets
(
hb_font_t
*
font
,
hb_face_t
*
face
,
hb_direction_t
direction
,
hb_codepoint_t
glyph
,
unsigned
int
start_offset
,
...
...
@@ -185,7 +184,6 @@ hb_ot_layout_position_start (hb_buffer_t *buffer);
hb_bool_t
hb_ot_layout_position_lookup
(
hb_font_t
*
font
,
hb_face_t
*
face
,
hb_buffer_t
*
buffer
,
unsigned
int
lookup_index
,
hb_mask_t
mask
);
...
...
src/hb-ot-map-private.hh
浏览文件 @
72657e4c
...
...
@@ -121,7 +121,7 @@ struct hb_ot_map_t {
inline
void
position
(
hb_font_t
*
font
,
hb_face_t
*
face
,
hb_buffer_t
*
buffer
)
const
{
for
(
unsigned
int
i
=
0
;
i
<
lookup_count
[
1
];
i
++
)
hb_ot_layout_position_lookup
(
font
,
face
,
buffer
,
lookup_maps
[
1
][
i
].
index
,
lookup_maps
[
1
][
i
].
mask
);
hb_ot_layout_position_lookup
(
font
,
buffer
,
lookup_maps
[
1
][
i
].
index
,
lookup_maps
[
1
][
i
].
mask
);
}
private:
...
...
src/hb-ot-shape.cc
浏览文件 @
72657e4c
...
...
@@ -29,6 +29,8 @@
#include "hb-ot-shape-private.hh"
#include "hb-ot-shape-complex-private.hh"
#include "hb-font-private.hh"
HB_BEGIN_DECLS
...
...
@@ -209,7 +211,6 @@ hb_mirror_chars (hb_ot_shape_context_t *c)
static
void
hb_map_glyphs
(
hb_font_t
*
font
,
hb_face_t
*
face
,
hb_buffer_t
*
buffer
)
{
if
(
unlikely
(
!
buffer
->
len
))
...
...
@@ -219,21 +220,21 @@ hb_map_glyphs (hb_font_t *font,
unsigned
int
count
=
buffer
->
len
-
1
;
for
(
buffer
->
i
=
0
;
buffer
->
i
<
count
;)
{
if
(
unlikely
(
is_variation_selector
(
buffer
->
info
[
buffer
->
i
+
1
].
codepoint
)))
{
buffer
->
replace_glyph
(
hb_font_get_glyph
(
font
,
face
,
buffer
->
info
[
buffer
->
i
].
codepoint
,
buffer
->
info
[
buffer
->
i
+
1
].
codepoint
));
buffer
->
replace_glyph
(
hb_font_get_glyph
(
font
,
buffer
->
info
[
buffer
->
i
].
codepoint
,
buffer
->
info
[
buffer
->
i
+
1
].
codepoint
));
buffer
->
i
++
;
}
else
{
buffer
->
replace_glyph
(
hb_font_get_glyph
(
font
,
face
,
buffer
->
info
[
buffer
->
i
].
codepoint
,
0
));
buffer
->
replace_glyph
(
hb_font_get_glyph
(
font
,
buffer
->
info
[
buffer
->
i
].
codepoint
,
0
));
}
}
if
(
likely
(
buffer
->
i
<
buffer
->
len
))
buffer
->
replace_glyph
(
hb_font_get_glyph
(
font
,
face
,
buffer
->
info
[
buffer
->
i
].
codepoint
,
0
));
buffer
->
replace_glyph
(
hb_font_get_glyph
(
font
,
buffer
->
info
[
buffer
->
i
].
codepoint
,
0
));
buffer
->
swap
();
}
static
void
hb_substitute_default
(
hb_ot_shape_context_t
*
c
)
{
hb_map_glyphs
(
c
->
font
,
c
->
face
,
c
->
buffer
);
hb_map_glyphs
(
c
->
font
,
c
->
buffer
);
}
static
void
...
...
@@ -252,7 +253,7 @@ 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
(
c
->
font
,
c
->
face
,
c
->
buffer
->
info
[
i
].
codepoint
,
hb_font_get_glyph_advance
(
c
->
font
,
c
->
buffer
->
info
[
i
].
codepoint
,
&
c
->
buffer
->
pos
[
i
].
x_advance
,
&
c
->
buffer
->
pos
[
i
].
y_advance
);
}
...
...
@@ -271,7 +272,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
kern
,
kern1
,
kern2
;
kern
=
hb_font_get_kerning
(
c
->
font
,
c
->
face
,
c
->
buffer
->
info
[
i
-
1
].
codepoint
,
c
->
buffer
->
info
[
i
].
codepoint
);
kern
=
hb_font_get_kerning
(
c
->
font
,
c
->
buffer
->
info
[
i
-
1
].
codepoint
,
c
->
buffer
->
info
[
i
].
codepoint
);
kern1
=
kern
>>
1
;
kern2
=
kern
-
kern1
;
c
->
buffer
->
pos
[
i
-
1
].
x_advance
+=
kern1
;
...
...
@@ -355,26 +356,24 @@ hb_ot_shape_plan_internal (hb_ot_shape_plan_t *plan,
void
hb_ot_shape_execute
(
hb_ot_shape_plan_t
*
plan
,
hb_font_t
*
font
,
hb_face_t
*
face
,
hb_buffer_t
*
buffer
,
const
hb_feature_t
*
user_features
,
unsigned
int
num_user_features
)
{
hb_ot_shape_context_t
c
=
{
plan
,
font
,
face
,
buffer
,
user_features
,
num_user_features
};
hb_ot_shape_context_t
c
=
{
plan
,
font
,
f
ont
->
f
ace
,
buffer
,
user_features
,
num_user_features
};
hb_ot_shape_execute_internal
(
&
c
);
}
void
hb_ot_shape
(
hb_font_t
*
font
,
hb_face_t
*
face
,
hb_buffer_t
*
buffer
,
const
hb_feature_t
*
features
,
unsigned
int
num_features
)
{
hb_ot_shape_plan_t
plan
;
hb_ot_shape_plan_internal
(
&
plan
,
face
,
&
buffer
->
props
,
features
,
num_features
);
hb_ot_shape_execute
(
&
plan
,
font
,
face
,
buffer
,
features
,
num_features
);
hb_ot_shape_plan_internal
(
&
plan
,
f
ont
->
f
ace
,
&
buffer
->
props
,
features
,
num_features
);
hb_ot_shape_execute
(
&
plan
,
font
,
buffer
,
features
,
num_features
);
}
...
...
src/hb-ot-shape.h
浏览文件 @
72657e4c
...
...
@@ -35,7 +35,6 @@ HB_BEGIN_DECLS
void
hb_ot_shape
(
hb_font_t
*
font
,
hb_face_t
*
face
,
hb_buffer_t
*
buffer
,
const
hb_feature_t
*
features
,
unsigned
int
num_features
);
...
...
src/hb-shape.cc
浏览文件 @
72657e4c
...
...
@@ -41,29 +41,15 @@ HB_BEGIN_DECLS
static
void
hb_shape_internal
(
hb_font_t
*
font
,
hb_face_t
*
face
,
hb_buffer_t
*
buffer
,
const
hb_feature_t
*
features
,
unsigned
int
num_features
)
{
#if 0 && defined(HAVE_GRAPHITE)
hb_blob_t *silf_blob;
silf_blob = hb_face_reference_table (face, HB_GRAPHITE_TAG_Silf);
if (hb_blob_get_length(silf_blob))
{
hb_graphite_shape(font, face, buffer, features, num_features);
hb_blob_destroy(silf_blob);
return;
}
hb_blob_destroy(silf_blob);
#endif
hb_ot_shape
(
font
,
face
,
buffer
,
features
,
num_features
);
hb_ot_shape
(
font
,
buffer
,
features
,
num_features
);
}
void
hb_shape
(
hb_font_t
*
font
,
hb_face_t
*
face
,
hb_buffer_t
*
buffer
,
const
hb_feature_t
*
features
,
unsigned
int
num_features
)
...
...
@@ -98,7 +84,7 @@ hb_shape (hb_font_t *font,
//buffer->props.language = hb_language_get_default ();
}
hb_shape_internal
(
font
,
face
,
buffer
,
features
,
num_features
);
hb_shape_internal
(
font
,
buffer
,
features
,
num_features
);
buffer
->
props
=
orig_props
;
}
...
...
src/hb-shape.h
浏览文件 @
72657e4c
...
...
@@ -43,7 +43,6 @@ typedef struct _hb_feature_t {
void
hb_shape
(
hb_font_t
*
font
,
hb_face_t
*
face
,
hb_buffer_t
*
buffer
,
const
hb_feature_t
*
features
,
unsigned
int
num_features
);
...
...
src/hb-view.cc
浏览文件 @
72657e4c
...
...
@@ -344,7 +344,6 @@ _hb_cr_text_glyphs (cairo_t *cr,
{
cairo_scaled_font_t
*
scaled_font
=
cairo_get_scaled_font
(
cr
);
FT_Face
ft_face
=
cairo_ft_scaled_font_lock_face
(
scaled_font
);
hb_face_t
*
hb_face
=
hb_ft_face_create_cached
(
ft_face
);
hb_font_t
*
hb_font
=
hb_ft_font_create
(
ft_face
,
NULL
);
hb_buffer_t
*
hb_buffer
;
cairo_glyph_t
*
cairo_glyphs
;
...
...
@@ -366,7 +365,7 @@ _hb_cr_text_glyphs (cairo_t *cr,
len
=
strlen
(
text
);
hb_buffer_add_utf8
(
hb_buffer
,
text
,
len
,
0
,
len
);
hb_shape
(
hb_font
,
hb_
face
,
hb_
buffer
,
features
,
num_features
);
hb_shape
(
hb_font
,
hb_buffer
,
features
,
num_features
);
num_glyphs
=
hb_buffer_get_length
(
hb_buffer
);
hb_glyph
=
hb_buffer_get_glyph_infos
(
hb_buffer
,
NULL
);
...
...
@@ -386,7 +385,6 @@ _hb_cr_text_glyphs (cairo_t *cr,
cairo_glyphs
[
i
].
x
=
x
*
(
1.
/
64
);
hb_buffer_destroy
(
hb_buffer
);
hb_font_destroy
(
hb_font
);
hb_face_destroy
(
hb_face
);
cairo_ft_scaled_font_unlock_face
(
scaled_font
);
if
(
pnum_glyphs
)
...
...
test/test-object.c
浏览文件 @
72657e4c
...
...
@@ -74,12 +74,15 @@ create_face_inert (void)
static
void
*
create_font
(
void
)
{
return
hb_font_create
();
hb_face_t
*
face
=
(
hb_face_t
*
)
create_face
();
hb_font_t
*
font
=
hb_font_create
(
face
);
hb_face_destroy
(
face
);
return
font
;
}
static
void
*
create_font_inert
(
void
)
{
return
NULL
;
return
hb_font_create
(
create_face_inert
())
;
}
static
void
*
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录