Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Harfbuzz
提交
502f4cba
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看板
提交
502f4cba
编写于
10月 27, 2010
作者:
B
Behdad Esfahbod
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Divide get_metrics into get_advance and get_extents
Graphite module not updated. Bump version to 0.3.
上级
ec6c0e54
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
154 addition
and
87 deletion
+154
-87
configure.ac
configure.ac
+1
-1
src/hb-font-private.h
src/hb-font-private.h
+2
-1
src/hb-font.cc
src/hb-font.cc
+66
-30
src/hb-font.h
src/hb-font.h
+38
-23
src/hb-ft.c
src/hb-ft.c
+44
-28
src/hb-ot-shape.cc
src/hb-ot-shape.cc
+3
-4
未找到文件。
configure.ac
浏览文件 @
502f4cba
AC_PREREQ(2.59)
AC_PREREQ(2.59)
AC_INIT(harfbuzz, 0.
2
, [http://bugs.freedesktop.org/enter_bug.cgi?product=harfbuzz])
AC_INIT(harfbuzz, 0.
3
, [http://bugs.freedesktop.org/enter_bug.cgi?product=harfbuzz])
AC_CONFIG_SRCDIR([harfbuzz.pc.in])
AC_CONFIG_SRCDIR([harfbuzz.pc.in])
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_HEADERS([config.h])
AM_INIT_AUTOMAKE([1.9.6 gnu dist-bzip2 no-dist-gzip -Wall no-define])
AM_INIT_AUTOMAKE([1.9.6 gnu dist-bzip2 no-dist-gzip -Wall no-define])
...
...
src/hb-font-private.h
浏览文件 @
502f4cba
...
@@ -45,8 +45,9 @@ struct _hb_font_funcs_t {
...
@@ -45,8 +45,9 @@ struct _hb_font_funcs_t {
struct
{
struct
{
hb_font_get_glyph_func_t
get_glyph
;
hb_font_get_glyph_func_t
get_glyph
;
hb_font_get_glyph_advance_func_t
get_glyph_advance
;
hb_font_get_glyph_extents_func_t
get_glyph_extents
;
hb_font_get_contour_point_func_t
get_contour_point
;
hb_font_get_contour_point_func_t
get_contour_point
;
hb_font_get_glyph_metrics_func_t
get_glyph_metrics
;
hb_font_get_kerning_func_t
get_kerning
;
hb_font_get_kerning_func_t
get_kerning
;
}
v
;
}
v
;
};
};
...
...
src/hb-font.cc
浏览文件 @
502f4cba
...
@@ -49,24 +49,33 @@ hb_font_get_glyph_nil (hb_font_t *font HB_UNUSED,
...
@@ -49,24 +49,33 @@ hb_font_get_glyph_nil (hb_font_t *font HB_UNUSED,
hb_codepoint_t
variation_selector
HB_UNUSED
)
hb_codepoint_t
variation_selector
HB_UNUSED
)
{
return
0
;
}
{
return
0
;
}
static
hb_bool_t
static
void
hb_font_get_
contour_point
_nil
(
hb_font_t
*
font
HB_UNUSED
,
hb_font_get_
glyph_advance
_nil
(
hb_font_t
*
font
HB_UNUSED
,
hb_face_t
*
face
HB_UNUSED
,
hb_face_t
*
face
HB_UNUSED
,
const
void
*
user_data
HB_UNUSED
,
const
void
*
user_data
HB_UNUSED
,
unsigned
int
point_index
HB_UNUSED
,
hb_codepoint_t
glyph
HB_UNUSED
,
hb_codepoint_t
glyph
HB_UNUSED
,
hb_position_t
*
x
HB_UNUSED
,
hb_position_t
*
x
_advance
HB_UNUSED
,
hb_position_t
*
y
HB_UNUSED
)
hb_position_t
*
y
_advance
HB_UNUSED
)
{
return
false
;
}
{
}
static
void
static
void
hb_font_get_glyph_
metric
s_nil
(
hb_font_t
*
font
HB_UNUSED
,
hb_font_get_glyph_
extent
s_nil
(
hb_font_t
*
font
HB_UNUSED
,
hb_face_t
*
face
HB_UNUSED
,
hb_face_t
*
face
HB_UNUSED
,
const
void
*
user_data
HB_UNUSED
,
const
void
*
user_data
HB_UNUSED
,
hb_codepoint_t
glyph
HB_UNUSED
,
hb_codepoint_t
glyph
HB_UNUSED
,
hb_glyph_
metrics_t
*
metric
s
HB_UNUSED
)
hb_glyph_
extents_t
*
extent
s
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
,
hb_position_t
*
x
HB_UNUSED
,
hb_position_t
*
y
HB_UNUSED
)
{
return
false
;
}
static
hb_position_t
static
hb_position_t
hb_font_get_kerning_nil
(
hb_font_t
*
font
HB_UNUSED
,
hb_font_get_kerning_nil
(
hb_font_t
*
font
HB_UNUSED
,
hb_face_t
*
face
HB_UNUSED
,
hb_face_t
*
face
HB_UNUSED
,
...
@@ -80,8 +89,9 @@ hb_font_funcs_t _hb_font_funcs_nil = {
...
@@ -80,8 +89,9 @@ hb_font_funcs_t _hb_font_funcs_nil = {
TRUE
,
/* immutable */
TRUE
,
/* immutable */
{
{
hb_font_get_glyph_nil
,
hb_font_get_glyph_nil
,
hb_font_get_glyph_advance_nil
,
hb_font_get_glyph_extents_nil
,
hb_font_get_contour_point_nil
,
hb_font_get_contour_point_nil
,
hb_font_get_glyph_metrics_nil
,
hb_font_get_kerning_nil
hb_font_get_kerning_nil
}
}
};
};
...
@@ -159,23 +169,33 @@ hb_font_funcs_set_glyph_func (hb_font_funcs_t *ffuncs,
...
@@ -159,23 +169,33 @@ hb_font_funcs_set_glyph_func (hb_font_funcs_t *ffuncs,
}
}
void
void
hb_font_funcs_set_
contour_point
_func
(
hb_font_funcs_t
*
ffuncs
,
hb_font_funcs_set_
glyph_advance
_func
(
hb_font_funcs_t
*
ffuncs
,
hb_font_get_
contour_point_func_t
contour_point
_func
)
hb_font_get_
glyph_advance_func_t
glyph_advance
_func
)
{
{
if
(
ffuncs
->
immutable
)
if
(
ffuncs
->
immutable
)
return
;
return
;
ffuncs
->
v
.
get_contour_point
=
contour_point_func
?
contour_point_func
:
hb_font_get_contour_point_nil
;
ffuncs
->
v
.
get_glyph_advance
=
glyph_advance_func
?
glyph_advance_func
:
hb_font_get_glyph_advance_nil
;
}
void
hb_font_funcs_set_glyph_extents_func
(
hb_font_funcs_t
*
ffuncs
,
hb_font_get_glyph_extents_func_t
glyph_extents_func
)
{
if
(
ffuncs
->
immutable
)
return
;
ffuncs
->
v
.
get_glyph_extents
=
glyph_extents_func
?
glyph_extents_func
:
hb_font_get_glyph_extents_nil
;
}
}
void
void
hb_font_funcs_set_
glyph_metrics
_func
(
hb_font_funcs_t
*
ffuncs
,
hb_font_funcs_set_
contour_point
_func
(
hb_font_funcs_t
*
ffuncs
,
hb_font_get_
glyph_metrics_func_t
glyph_metrics
_func
)
hb_font_get_
contour_point_func_t
contour_point
_func
)
{
{
if
(
ffuncs
->
immutable
)
if
(
ffuncs
->
immutable
)
return
;
return
;
ffuncs
->
v
.
get_
glyph_metrics
=
glyph_metrics_func
?
glyph_metrics_func
:
hb_font_get_glyph_metrics
_nil
;
ffuncs
->
v
.
get_
contour_point
=
contour_point_func
?
contour_point_func
:
hb_font_get_contour_point
_nil
;
}
}
void
void
...
@@ -195,16 +215,22 @@ hb_font_funcs_get_glyph_func (hb_font_funcs_t *ffuncs)
...
@@ -195,16 +215,22 @@ hb_font_funcs_get_glyph_func (hb_font_funcs_t *ffuncs)
return
ffuncs
->
v
.
get_glyph
;
return
ffuncs
->
v
.
get_glyph
;
}
}
hb_font_get_
contour_point
_func_t
hb_font_get_
glyph_advance
_func_t
hb_font_funcs_get_
contour_point
_func
(
hb_font_funcs_t
*
ffuncs
)
hb_font_funcs_get_
glyph_advance
_func
(
hb_font_funcs_t
*
ffuncs
)
{
{
return
ffuncs
->
v
.
get_contour_point
;
return
ffuncs
->
v
.
get_glyph_advance
;
}
hb_font_get_glyph_extents_func_t
hb_font_funcs_get_glyph_extents_func
(
hb_font_funcs_t
*
ffuncs
)
{
return
ffuncs
->
v
.
get_glyph_extents
;
}
}
hb_font_get_
glyph_metrics
_func_t
hb_font_get_
contour_point
_func_t
hb_font_funcs_get_
glyph_metrics
_func
(
hb_font_funcs_t
*
ffuncs
)
hb_font_funcs_get_
contour_point
_func
(
hb_font_funcs_t
*
ffuncs
)
{
{
return
ffuncs
->
v
.
get_
glyph_metrics
;
return
ffuncs
->
v
.
get_
contour_point
;
}
}
hb_font_get_kerning_func_t
hb_font_get_kerning_func_t
...
@@ -223,6 +249,25 @@ hb_font_get_glyph (hb_font_t *font, hb_face_t *face,
...
@@ -223,6 +249,25 @@ hb_font_get_glyph (hb_font_t *font, hb_face_t *face,
unicode
,
variation_selector
);
unicode
,
variation_selector
);
}
}
void
hb_font_get_glyph_advance
(
hb_font_t
*
font
,
hb_face_t
*
face
,
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
,
face
,
font
->
user_data
,
glyph
,
x_advance
,
y_advance
);
}
void
hb_font_get_glyph_extents
(
hb_font_t
*
font
,
hb_face_t
*
face
,
hb_codepoint_t
glyph
,
hb_glyph_extents_t
*
extents
)
{
memset
(
extents
,
0
,
sizeof
(
*
extents
));
return
font
->
klass
->
v
.
get_glyph_extents
(
font
,
face
,
font
->
user_data
,
glyph
,
extents
);
}
hb_bool_t
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
,
hb_face_t
*
face
,
unsigned
int
point_index
,
unsigned
int
point_index
,
...
@@ -234,15 +279,6 @@ hb_font_get_contour_point (hb_font_t *font, hb_face_t *face,
...
@@ -234,15 +279,6 @@ hb_font_get_contour_point (hb_font_t *font, hb_face_t *face,
glyph
,
x
,
y
);
glyph
,
x
,
y
);
}
}
void
hb_font_get_glyph_metrics
(
hb_font_t
*
font
,
hb_face_t
*
face
,
hb_codepoint_t
glyph
,
hb_glyph_metrics_t
*
metrics
)
{
memset
(
metrics
,
0
,
sizeof
(
*
metrics
));
return
font
->
klass
->
v
.
get_glyph_metrics
(
font
,
face
,
font
->
user_data
,
glyph
,
metrics
);
}
hb_position_t
hb_position_t
hb_font_get_kerning
(
hb_font_t
*
font
,
hb_face_t
*
face
,
hb_font_get_kerning
(
hb_font_t
*
font
,
hb_face_t
*
face
,
hb_codepoint_t
first_glyph
,
hb_codepoint_t
second_glyph
)
hb_codepoint_t
first_glyph
,
hb_codepoint_t
second_glyph
)
...
...
src/hb-font.h
浏览文件 @
502f4cba
...
@@ -111,23 +111,25 @@ hb_font_funcs_is_immutable (hb_font_funcs_t *ffuncs);
...
@@ -111,23 +111,25 @@ hb_font_funcs_is_immutable (hb_font_funcs_t *ffuncs);
/* funcs */
/* funcs */
typedef
struct
_hb_glyph_
metric
s_t
typedef
struct
_hb_glyph_
extent
s_t
{
{
hb_position_t
x_advance
;
hb_position_t
x_bearing
;
hb_position_t
y_advance
;
hb_position_t
y_bearing
;
hb_position_t
x_offset
;
hb_position_t
y_offset
;
hb_position_t
width
;
hb_position_t
width
;
hb_position_t
height
;
hb_position_t
height
;
}
hb_glyph_
metric
s_t
;
}
hb_glyph_
extent
s_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
,
hb_face_t
*
face
,
const
void
*
user_data
,
hb_codepoint_t
unicode
,
hb_codepoint_t
variation_selector
);
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
,
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
,
hb_codepoint_t
glyph
,
hb_glyph_extents_t
*
metrics
);
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
,
hb_face_t
*
face
,
const
void
*
user_data
,
unsigned
int
point_index
,
unsigned
int
point_index
,
hb_codepoint_t
glyph
,
hb_codepoint_t
glyph
,
hb_position_t
*
x
,
hb_position_t
*
y
);
hb_position_t
*
x
,
hb_position_t
*
y
);
typedef
void
(
*
hb_font_get_glyph_metrics_func_t
)
(
hb_font_t
*
font
,
hb_face_t
*
face
,
const
void
*
user_data
,
hb_codepoint_t
glyph
,
hb_glyph_metrics_t
*
metrics
);
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
,
hb_face_t
*
face
,
const
void
*
user_data
,
hb_codepoint_t
first_glyph
,
hb_codepoint_t
second_glyph
);
hb_codepoint_t
first_glyph
,
hb_codepoint_t
second_glyph
);
...
@@ -137,12 +139,16 @@ hb_font_funcs_set_glyph_func (hb_font_funcs_t *ffuncs,
...
@@ -137,12 +139,16 @@ hb_font_funcs_set_glyph_func (hb_font_funcs_t *ffuncs,
hb_font_get_glyph_func_t
glyph_func
);
hb_font_get_glyph_func_t
glyph_func
);
void
void
hb_font_funcs_set_contour_point_func
(
hb_font_funcs_t
*
ffuncs
,
hb_font_funcs_set_glyph_advance_func
(
hb_font_funcs_t
*
ffuncs
,
hb_font_get_contour_point_func_t
contour_point_func
);
hb_font_get_glyph_advance_func_t
glyph_advance_func
);
void
hb_font_funcs_set_glyph_extents_func
(
hb_font_funcs_t
*
ffuncs
,
hb_font_get_glyph_extents_func_t
glyph_extents_func
);
void
void
hb_font_funcs_set_
glyph_metrics
_func
(
hb_font_funcs_t
*
ffuncs
,
hb_font_funcs_set_
contour_point
_func
(
hb_font_funcs_t
*
ffuncs
,
hb_font_get_
glyph_metrics_func_t
glyph_metrics
_func
);
hb_font_get_
contour_point_func_t
contour_point
_func
);
void
void
hb_font_funcs_set_kerning_func
(
hb_font_funcs_t
*
ffuncs
,
hb_font_funcs_set_kerning_func
(
hb_font_funcs_t
*
ffuncs
,
...
@@ -154,12 +160,15 @@ hb_font_funcs_set_kerning_func (hb_font_funcs_t *ffuncs,
...
@@ -154,12 +160,15 @@ hb_font_funcs_set_kerning_func (hb_font_funcs_t *ffuncs,
hb_font_get_glyph_func_t
hb_font_get_glyph_func_t
hb_font_funcs_get_glyph_func
(
hb_font_funcs_t
*
ffuncs
);
hb_font_funcs_get_glyph_func
(
hb_font_funcs_t
*
ffuncs
);
hb_font_get_glyph_advance_func_t
hb_font_funcs_get_glyph_advance_func
(
hb_font_funcs_t
*
ffuncs
);
hb_font_get_glyph_extents_func_t
hb_font_funcs_get_glyph_extents_func
(
hb_font_funcs_t
*
ffuncs
);
hb_font_get_contour_point_func_t
hb_font_get_contour_point_func_t
hb_font_funcs_get_contour_point_func
(
hb_font_funcs_t
*
ffuncs
);
hb_font_funcs_get_contour_point_func
(
hb_font_funcs_t
*
ffuncs
);
hb_font_get_glyph_metrics_func_t
hb_font_funcs_get_glyph_metrics_func
(
hb_font_funcs_t
*
ffuncs
);
hb_font_get_kerning_func_t
hb_font_get_kerning_func_t
hb_font_funcs_get_kerning_func
(
hb_font_funcs_t
*
ffuncs
);
hb_font_funcs_get_kerning_func
(
hb_font_funcs_t
*
ffuncs
);
...
@@ -168,14 +177,20 @@ hb_codepoint_t
...
@@ -168,14 +177,20 @@ hb_codepoint_t
hb_font_get_glyph
(
hb_font_t
*
font
,
hb_face_t
*
face
,
hb_font_get_glyph
(
hb_font_t
*
font
,
hb_face_t
*
face
,
hb_codepoint_t
unicode
,
hb_codepoint_t
variation_selector
);
hb_codepoint_t
unicode
,
hb_codepoint_t
variation_selector
);
hb_bool_t
void
hb_font_get_
contour_point
(
hb_font_t
*
font
,
hb_face_t
*
face
,
hb_font_get_
glyph_advance
(
hb_font_t
*
font
,
hb_face_t
*
face
,
unsigned
int
point_index
,
hb_codepoint_t
glyph
,
hb_
codepoint_t
glyph
,
hb_position_t
*
x
,
hb_position_t
*
y
);
hb_
position_t
*
x_advance
,
hb_position_t
*
y_advance
);
void
void
hb_font_get_glyph_metrics
(
hb_font_t
*
font
,
hb_face_t
*
face
,
hb_font_get_glyph_extents
(
hb_font_t
*
font
,
hb_face_t
*
face
,
hb_codepoint_t
glyph
,
hb_glyph_metrics_t
*
metrics
);
hb_codepoint_t
glyph
,
hb_glyph_extents_t
*
metrics
);
hb_bool_t
hb_font_get_contour_point
(
hb_font_t
*
font
,
hb_face_t
*
face
,
unsigned
int
point_index
,
hb_codepoint_t
glyph
,
hb_position_t
*
x
,
hb_position_t
*
y
);
hb_position_t
hb_position_t
hb_font_get_kerning
(
hb_font_t
*
font
,
hb_face_t
*
face
,
hb_font_get_kerning
(
hb_font_t
*
font
,
hb_face_t
*
face
,
...
...
src/hb-ft.c
浏览文件 @
502f4cba
...
@@ -56,6 +56,48 @@ hb_ft_get_glyph (hb_font_t *font HB_UNUSED,
...
@@ -56,6 +56,48 @@ hb_ft_get_glyph (hb_font_t *font HB_UNUSED,
return
FT_Get_Char_Index
(
ft_face
,
unicode
);
return
FT_Get_Char_Index
(
ft_face
,
unicode
);
}
}
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
,
hb_position_t
*
y_advance
)
{
FT_Face
ft_face
=
(
FT_Face
)
user_data
;
int
load_flags
=
FT_LOAD_DEFAULT
;
/* TODO: load_flags, embolden, etc */
if
(
likely
(
!
FT_Load_Glyph
(
ft_face
,
glyph
,
load_flags
)))
{
*
x_advance
=
ft_face
->
glyph
->
advance
.
x
;
*
y_advance
=
ft_face
->
glyph
->
advance
.
y
;
}
}
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
)
{
FT_Face
ft_face
=
(
FT_Face
)
user_data
;
int
load_flags
=
FT_LOAD_DEFAULT
;
/* TODO: load_flags, embolden, etc */
if
(
likely
(
!
FT_Load_Glyph
(
ft_face
,
glyph
,
load_flags
)))
{
/* XXX: A few negations should be in order here, not sure. */
extents
->
x_bearing
=
ft_face
->
glyph
->
metrics
.
horiBearingX
;
extents
->
y_bearing
=
ft_face
->
glyph
->
metrics
.
horiBearingY
;
extents
->
width
=
ft_face
->
glyph
->
metrics
.
width
;
extents
->
height
=
ft_face
->
glyph
->
metrics
.
height
;
}
}
static
hb_bool_t
static
hb_bool_t
hb_ft_get_contour_point
(
hb_font_t
*
font
HB_UNUSED
,
hb_ft_get_contour_point
(
hb_font_t
*
font
HB_UNUSED
,
hb_face_t
*
face
HB_UNUSED
,
hb_face_t
*
face
HB_UNUSED
,
...
@@ -85,33 +127,6 @@ hb_ft_get_contour_point (hb_font_t *font HB_UNUSED,
...
@@ -85,33 +127,6 @@ hb_ft_get_contour_point (hb_font_t *font HB_UNUSED,
return
TRUE
;
return
TRUE
;
}
}
static
void
hb_ft_get_glyph_metrics
(
hb_font_t
*
font
HB_UNUSED
,
hb_face_t
*
face
HB_UNUSED
,
const
void
*
user_data
,
hb_codepoint_t
glyph
,
hb_glyph_metrics_t
*
metrics
)
{
FT_Face
ft_face
=
(
FT_Face
)
user_data
;
int
load_flags
=
FT_LOAD_DEFAULT
;
/* TODO: load_flags, embolden, etc */
metrics
->
x_advance
=
metrics
->
y_advance
=
0
;
metrics
->
x_offset
=
metrics
->
y_offset
=
0
;
metrics
->
width
=
metrics
->
height
=
0
;
if
(
likely
(
!
FT_Load_Glyph
(
ft_face
,
glyph
,
load_flags
)))
{
/* TODO: A few negations should be in order here, not sure. */
metrics
->
x_advance
=
ft_face
->
glyph
->
advance
.
x
;
metrics
->
y_advance
=
ft_face
->
glyph
->
advance
.
y
;
metrics
->
x_offset
=
ft_face
->
glyph
->
metrics
.
horiBearingX
;
metrics
->
y_offset
=
ft_face
->
glyph
->
metrics
.
horiBearingY
;
metrics
->
width
=
ft_face
->
glyph
->
metrics
.
width
;
metrics
->
height
=
ft_face
->
glyph
->
metrics
.
height
;
}
}
static
hb_position_t
static
hb_position_t
hb_ft_get_kerning
(
hb_font_t
*
font
HB_UNUSED
,
hb_ft_get_kerning
(
hb_font_t
*
font
HB_UNUSED
,
hb_face_t
*
face
HB_UNUSED
,
hb_face_t
*
face
HB_UNUSED
,
...
@@ -134,8 +149,9 @@ static hb_font_funcs_t ft_ffuncs = {
...
@@ -134,8 +149,9 @@ static hb_font_funcs_t ft_ffuncs = {
TRUE
,
/* immutable */
TRUE
,
/* immutable */
{
{
hb_ft_get_glyph
,
hb_ft_get_glyph
,
hb_ft_get_glyph_advance
,
hb_ft_get_glyph_extents
,
hb_ft_get_contour_point
,
hb_ft_get_contour_point
,
hb_ft_get_glyph_metrics
,
hb_ft_get_kerning
hb_ft_get_kerning
}
}
};
};
...
...
src/hb-ot-shape.cc
浏览文件 @
502f4cba
...
@@ -233,10 +233,9 @@ hb_position_default (hb_ot_shape_context_t *c)
...
@@ -233,10 +233,9 @@ hb_position_default (hb_ot_shape_context_t *c)
unsigned
int
count
=
c
->
buffer
->
len
;
unsigned
int
count
=
c
->
buffer
->
len
;
for
(
unsigned
int
i
=
0
;
i
<
count
;
i
++
)
{
for
(
unsigned
int
i
=
0
;
i
<
count
;
i
++
)
{
hb_glyph_metrics_t
metrics
;
hb_font_get_glyph_advance
(
c
->
font
,
c
->
face
,
c
->
buffer
->
info
[
i
].
codepoint
,
hb_font_get_glyph_metrics
(
c
->
font
,
c
->
face
,
c
->
buffer
->
info
[
i
].
codepoint
,
&
metrics
);
&
c
->
buffer
->
pos
[
i
].
x_advance
,
c
->
buffer
->
pos
[
i
].
x_advance
=
metrics
.
x_advance
;
&
c
->
buffer
->
pos
[
i
].
y_advance
);
c
->
buffer
->
pos
[
i
].
y_advance
=
metrics
.
y_advance
;
}
}
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录