Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Harfbuzz
提交
6f2e6de1
T
Third Party Harfbuzz
项目概览
OpenHarmony
/
Third Party Harfbuzz
接近 2 年 前同步成功
通知
1
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看板
提交
6f2e6de1
编写于
10月 26, 2015
作者:
S
Simon Cozens
提交者:
Behdad Esfahbod
11月 27, 2015
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Get font ascender and descender metrics from OS/2 table.
上级
097c998a
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
274 addition
and
8 deletion
+274
-8
src/hb-font-private.hh
src/hb-font-private.hh
+38
-1
src/hb-font.cc
src/hb-font.cc
+101
-1
src/hb-font.h
src/hb-font.h
+59
-3
src/hb-ft.cc
src/hb-ft.cc
+21
-0
src/hb-ot-font.cc
src/hb-ot-font.cc
+55
-3
未找到文件。
src/hb-font-private.hh
浏览文件 @
6f2e6de1
...
@@ -42,6 +42,8 @@
...
@@ -42,6 +42,8 @@
*/
*/
#define HB_FONT_FUNCS_IMPLEMENT_CALLBACKS \
#define HB_FONT_FUNCS_IMPLEMENT_CALLBACKS \
HB_FONT_FUNC_IMPLEMENT (font_h_extents) \
HB_FONT_FUNC_IMPLEMENT (font_v_extents) \
HB_FONT_FUNC_IMPLEMENT (glyph) \
HB_FONT_FUNC_IMPLEMENT (glyph) \
HB_FONT_FUNC_IMPLEMENT (glyph_h_advance) \
HB_FONT_FUNC_IMPLEMENT (glyph_h_advance) \
HB_FONT_FUNC_IMPLEMENT (glyph_v_advance) \
HB_FONT_FUNC_IMPLEMENT (glyph_v_advance) \
...
@@ -160,6 +162,21 @@ struct hb_font_t {
...
@@ -160,6 +162,21 @@ struct hb_font_t {
HB_FONT_FUNCS_IMPLEMENT_CALLBACKS
HB_FONT_FUNCS_IMPLEMENT_CALLBACKS
#undef HB_FONT_FUNC_IMPLEMENT
#undef HB_FONT_FUNC_IMPLEMENT
inline
hb_bool_t
get_font_h_extents
(
hb_font_extents_t
*
extents
)
{
memset
(
extents
,
0
,
sizeof
(
*
extents
));
return
klass
->
get
.
f
.
font_h_extents
(
this
,
user_data
,
extents
,
klass
->
user_data
.
font_h_extents
);
}
inline
hb_bool_t
get_font_v_extents
(
hb_font_extents_t
*
extents
)
{
memset
(
extents
,
0
,
sizeof
(
*
extents
));
return
klass
->
get
.
f
.
font_v_extents
(
this
,
user_data
,
extents
,
klass
->
user_data
.
font_v_extents
);
}
inline
bool
has_glyph
(
hb_codepoint_t
unicode
)
inline
bool
has_glyph
(
hb_codepoint_t
unicode
)
{
{
hb_codepoint_t
glyph
;
hb_codepoint_t
glyph
;
...
@@ -265,6 +282,26 @@ struct hb_font_t {
...
@@ -265,6 +282,26 @@ struct hb_font_t {
/* A bit higher-level, and with fallback */
/* A bit higher-level, and with fallback */
inline
void
get_extents_for_direction
(
hb_direction_t
direction
,
hb_font_extents_t
*
extents
)
{
if
(
likely
(
HB_DIRECTION_IS_HORIZONTAL
(
direction
)))
{
if
(
!
get_font_h_extents
(
extents
))
{
extents
->
ascender
=
y_scale
*
.8
;
extents
->
descender
=
y_scale
-
extents
->
ascender
;
extents
->
line_gap
=
0
;
}
}
else
{
if
(
!
get_font_v_extents
(
extents
))
{
extents
->
ascender
=
x_scale
/
2
;
extents
->
descender
=
x_scale
-
extents
->
ascender
;
extents
->
line_gap
=
0
;
}
}
}
inline
void
get_glyph_advance_for_direction
(
hb_codepoint_t
glyph
,
inline
void
get_glyph_advance_for_direction
(
hb_codepoint_t
glyph
,
hb_direction_t
direction
,
hb_direction_t
direction
,
hb_position_t
*
x
,
hb_position_t
*
y
)
hb_position_t
*
x
,
hb_position_t
*
y
)
...
@@ -284,7 +321,7 @@ struct hb_font_t {
...
@@ -284,7 +321,7 @@ struct hb_font_t {
{
{
*
x
=
get_glyph_h_advance
(
glyph
)
/
2
;
*
x
=
get_glyph_h_advance
(
glyph
)
/
2
;
/* TODO use font_
metrics.ascent
*/
/* TODO use font_
extents.ascender
*/
*
y
=
y_scale
;
*
y
=
y_scale
;
}
}
...
...
src/hb-font.cc
浏览文件 @
6f2e6de1
...
@@ -44,6 +44,54 @@
...
@@ -44,6 +44,54 @@
* hb_font_funcs_t
* hb_font_funcs_t
*/
*/
static
hb_bool_t
hb_font_get_font_h_extents_nil
(
hb_font_t
*
font
,
void
*
font_data
HB_UNUSED
,
hb_font_extents_t
*
metrics
,
void
*
user_data
HB_UNUSED
)
{
memset
(
metrics
,
0
,
sizeof
(
*
metrics
));
return
false
;
}
static
hb_bool_t
hb_font_get_font_h_extents_parent
(
hb_font_t
*
font
,
void
*
font_data
HB_UNUSED
,
hb_font_extents_t
*
metrics
,
void
*
user_data
HB_UNUSED
)
{
hb_bool_t
ret
=
font
->
parent
->
get_font_h_extents
(
metrics
);
if
(
ret
)
{
metrics
->
ascender
=
font
->
parent_scale_y_distance
(
metrics
->
ascender
);
metrics
->
descender
=
font
->
parent_scale_y_distance
(
metrics
->
descender
);
metrics
->
line_gap
=
font
->
parent_scale_y_distance
(
metrics
->
line_gap
);
}
return
ret
;
}
static
hb_bool_t
hb_font_get_font_v_extents_nil
(
hb_font_t
*
font
,
void
*
font_data
HB_UNUSED
,
hb_font_extents_t
*
metrics
,
void
*
user_data
HB_UNUSED
)
{
memset
(
metrics
,
0
,
sizeof
(
*
metrics
));
return
false
;
}
static
hb_bool_t
hb_font_get_font_v_extents_parent
(
hb_font_t
*
font
,
void
*
font_data
HB_UNUSED
,
hb_font_extents_t
*
metrics
,
void
*
user_data
HB_UNUSED
)
{
hb_bool_t
ret
=
font
->
parent
->
get_font_v_extents
(
metrics
);
if
(
ret
)
{
metrics
->
ascender
=
font
->
parent_scale_x_distance
(
metrics
->
ascender
);
metrics
->
descender
=
font
->
parent_scale_x_distance
(
metrics
->
descender
);
metrics
->
line_gap
=
font
->
parent_scale_x_distance
(
metrics
->
line_gap
);
}
return
ret
;
}
static
hb_bool_t
static
hb_bool_t
hb_font_get_glyph_nil
(
hb_font_t
*
font
HB_UNUSED
,
hb_font_get_glyph_nil
(
hb_font_t
*
font
HB_UNUSED
,
void
*
font_data
HB_UNUSED
,
void
*
font_data
HB_UNUSED
,
...
@@ -280,7 +328,6 @@ hb_font_get_glyph_from_name_parent (hb_font_t *font,
...
@@ -280,7 +328,6 @@ hb_font_get_glyph_from_name_parent (hb_font_t *font,
return
font
->
parent
->
get_glyph_from_name
(
name
,
len
,
glyph
);
return
font
->
parent
->
get_glyph_from_name
(
name
,
len
,
glyph
);
}
}
static
const
hb_font_funcs_t
_hb_font_funcs_nil
=
{
static
const
hb_font_funcs_t
_hb_font_funcs_nil
=
{
HB_OBJECT_HEADER_STATIC
,
HB_OBJECT_HEADER_STATIC
,
...
@@ -521,6 +568,42 @@ hb_font_t::has_func (unsigned int i)
...
@@ -521,6 +568,42 @@ hb_font_t::has_func (unsigned int i)
/* Public getters */
/* Public getters */
/**
* hb_font_get_h_extents:
* @font: a font.
* @extents: (out):
*
*
*
* Return value:
*
* Since: 1.1.2
**/
hb_bool_t
hb_font_get_h_extents
(
hb_font_t
*
font
,
hb_font_extents_t
*
extents
)
{
return
font
->
get_font_h_extents
(
extents
);
}
/**
* hb_font_get_v_extents:
* @font: a font.
* @extents: (out):
*
*
*
* Return value:
*
* Since: 1.1.2
**/
hb_bool_t
hb_font_get_v_extents
(
hb_font_t
*
font
,
hb_font_extents_t
*
extents
)
{
return
font
->
get_font_v_extents
(
extents
);
}
/**
/**
* hb_font_get_glyph:
* hb_font_get_glyph:
* @font: a font.
* @font: a font.
...
@@ -745,6 +828,23 @@ hb_font_get_glyph_from_name (hb_font_t *font,
...
@@ -745,6 +828,23 @@ hb_font_get_glyph_from_name (hb_font_t *font,
/* A bit higher-level, and with fallback */
/* A bit higher-level, and with fallback */
/**
* hb_font_get_extents_for_direction:
* @font: a font.
* @direction:
* @extents:
*
*
*
* Since: 1.1.2
**/
void
hb_font_get_extents_for_direction
(
hb_font_t
*
font
,
hb_direction_t
direction
,
hb_font_extents_t
*
extents
)
{
return
font
->
get_extents_for_direction
(
direction
,
extents
);
}
/**
/**
* hb_font_get_glyph_advance_for_direction:
* hb_font_get_glyph_advance_for_direction:
* @font: a font.
* @font: a font.
...
...
src/hb-font.h
浏览文件 @
6f2e6de1
...
@@ -78,7 +78,15 @@ HB_EXTERN hb_bool_t
...
@@ -78,7 +78,15 @@ HB_EXTERN hb_bool_t
hb_font_funcs_is_immutable
(
hb_font_funcs_t
*
ffuncs
);
hb_font_funcs_is_immutable
(
hb_font_funcs_t
*
ffuncs
);
/* glyph extents */
/* font and glyph extents */
/* Note that typically ascender is positive and descender negative in coordinate systems that grow up. */
typedef
struct
hb_font_extents_t
{
hb_position_t
ascender
;
/* typographic ascender. */
hb_position_t
descender
;
/* typographic descender. */
hb_position_t
line_gap
;
/* suggested line spacing gap. */
}
hb_font_extents_t
;
/* Note that height is negative in coordinate systems that grow up. */
/* Note that height is negative in coordinate systems that grow up. */
typedef
struct
hb_glyph_extents_t
typedef
struct
hb_glyph_extents_t
...
@@ -89,9 +97,15 @@ typedef struct hb_glyph_extents_t
...
@@ -89,9 +97,15 @@ typedef struct hb_glyph_extents_t
hb_position_t
height
;
/* distance from top to bottom side. */
hb_position_t
height
;
/* distance from top to bottom side. */
}
hb_glyph_extents_t
;
}
hb_glyph_extents_t
;
/* func types */
/* func types */
typedef
hb_bool_t
(
*
hb_font_get_font_extents_func_t
)
(
hb_font_t
*
font
,
void
*
font_data
,
hb_font_extents_t
*
metrics
,
void
*
user_data
);
typedef
hb_font_get_font_extents_func_t
hb_font_get_font_h_extents_func_t
;
typedef
hb_font_get_font_extents_func_t
hb_font_get_font_v_extents_func_t
;
typedef
hb_bool_t
(
*
hb_font_get_glyph_func_t
)
(
hb_font_t
*
font
,
void
*
font_data
,
typedef
hb_bool_t
(
*
hb_font_get_glyph_func_t
)
(
hb_font_t
*
font
,
void
*
font_data
,
hb_codepoint_t
unicode
,
hb_codepoint_t
variation_selector
,
hb_codepoint_t
unicode
,
hb_codepoint_t
variation_selector
,
hb_codepoint_t
*
glyph
,
hb_codepoint_t
*
glyph
,
...
@@ -140,6 +154,38 @@ typedef hb_bool_t (*hb_font_get_glyph_from_name_func_t) (hb_font_t *font, void *
...
@@ -140,6 +154,38 @@ typedef hb_bool_t (*hb_font_get_glyph_from_name_func_t) (hb_font_t *font, void *
/* func setters */
/* func setters */
/**
* hb_font_funcs_set_font_h_extents_func:
* @ffuncs: font functions.
* @func: (closure user_data) (destroy destroy) (scope notified):
* @user_data:
* @destroy:
*
*
*
* Since: 1.1.2
**/
HB_EXTERN
void
hb_font_funcs_set_font_h_extents_func
(
hb_font_funcs_t
*
ffuncs
,
hb_font_get_font_h_extents_func_t
func
,
void
*
user_data
,
hb_destroy_func_t
destroy
);
/**
* hb_font_funcs_set_font_v_extents_func:
* @ffuncs: font functions.
* @func: (closure user_data) (destroy destroy) (scope notified):
* @user_data:
* @destroy:
*
*
*
* Since: 1.1.2
**/
HB_EXTERN
void
hb_font_funcs_set_font_v_extents_func
(
hb_font_funcs_t
*
ffuncs
,
hb_font_get_font_v_extents_func_t
func
,
void
*
user_data
,
hb_destroy_func_t
destroy
);
/**
/**
* hb_font_funcs_set_glyph_func:
* hb_font_funcs_set_glyph_func:
* @ffuncs: font functions.
* @ffuncs: font functions.
...
@@ -316,9 +362,15 @@ hb_font_funcs_set_glyph_from_name_func (hb_font_funcs_t *ffuncs,
...
@@ -316,9 +362,15 @@ hb_font_funcs_set_glyph_from_name_func (hb_font_funcs_t *ffuncs,
hb_font_get_glyph_from_name_func_t
func
,
hb_font_get_glyph_from_name_func_t
func
,
void
*
user_data
,
hb_destroy_func_t
destroy
);
void
*
user_data
,
hb_destroy_func_t
destroy
);
/* func dispatch */
/* func dispatch */
HB_EXTERN
hb_bool_t
hb_font_get_h_extents
(
hb_font_t
*
font
,
hb_font_extents_t
*
extents
);
HB_EXTERN
hb_bool_t
hb_font_get_v_extents
(
hb_font_t
*
font
,
hb_font_extents_t
*
extents
);
HB_EXTERN
hb_bool_t
HB_EXTERN
hb_bool_t
hb_font_get_glyph
(
hb_font_t
*
font
,
hb_font_get_glyph
(
hb_font_t
*
font
,
hb_codepoint_t
unicode
,
hb_codepoint_t
variation_selector
,
hb_codepoint_t
unicode
,
hb_codepoint_t
variation_selector
,
...
@@ -369,6 +421,10 @@ hb_font_get_glyph_from_name (hb_font_t *font,
...
@@ -369,6 +421,10 @@ hb_font_get_glyph_from_name (hb_font_t *font,
/* high-level funcs, with fallback */
/* high-level funcs, with fallback */
HB_EXTERN
void
hb_font_get_extents_for_direction
(
hb_font_t
*
font
,
hb_direction_t
direction
,
hb_font_extents_t
*
extents
);
HB_EXTERN
void
HB_EXTERN
void
hb_font_get_glyph_advance_for_direction
(
hb_font_t
*
font
,
hb_font_get_glyph_advance_for_direction
(
hb_font_t
*
font
,
hb_codepoint_t
glyph
,
hb_codepoint_t
glyph
,
...
...
src/hb-ft.cc
浏览文件 @
6f2e6de1
...
@@ -366,6 +366,25 @@ hb_ft_get_glyph_from_name (hb_font_t *font HB_UNUSED,
...
@@ -366,6 +366,25 @@ hb_ft_get_glyph_from_name (hb_font_t *font HB_UNUSED,
return
*
glyph
!=
0
;
return
*
glyph
!=
0
;
}
}
static
hb_bool_t
hb_ft_get_font_h_extents
(
hb_font_t
*
font
HB_UNUSED
,
void
*
font_data
,
hb_font_extents_t
*
metrics
,
void
*
user_data
HB_UNUSED
)
{
const
hb_ft_font_t
*
ft_font
=
(
const
hb_ft_font_t
*
)
font_data
;
FT_Face
ft_face
=
ft_font
->
ft_face
;
metrics
->
ascender
=
ft_face
->
ascender
;
metrics
->
descender
=
ft_face
->
descender
;
metrics
->
line_gap
=
ft_face
->
height
-
(
ft_face
->
ascender
-
ft_face
->
descender
);
if
(
font
->
y_scale
<
0
)
{
metrics
->
ascender
=
-
metrics
->
ascender
;
metrics
->
descender
=
-
metrics
->
descender
;
metrics
->
line_gap
=
-
metrics
->
line_gap
;
}
return
true
;
}
static
hb_font_funcs_t
*
static_ft_funcs
=
NULL
;
static
hb_font_funcs_t
*
static_ft_funcs
=
NULL
;
...
@@ -387,6 +406,8 @@ retry:
...
@@ -387,6 +406,8 @@ retry:
{
{
funcs
=
hb_font_funcs_create
();
funcs
=
hb_font_funcs_create
();
hb_font_funcs_set_font_h_extents_func
(
funcs
,
hb_ft_get_font_h_extents
,
NULL
,
NULL
);
//hb_font_funcs_set_font_v_extents_func (funcs, hb_ft_get_font_v_extents, NULL, NULL);
hb_font_funcs_set_glyph_func
(
funcs
,
hb_ft_get_glyph
,
NULL
,
NULL
);
hb_font_funcs_set_glyph_func
(
funcs
,
hb_ft_get_glyph
,
NULL
,
NULL
);
hb_font_funcs_set_glyph_h_advance_func
(
funcs
,
hb_ft_get_glyph_h_advance
,
NULL
,
NULL
);
hb_font_funcs_set_glyph_h_advance_func
(
funcs
,
hb_ft_get_glyph_h_advance
,
NULL
,
NULL
);
hb_font_funcs_set_glyph_v_advance_func
(
funcs
,
hb_ft_get_glyph_v_advance
,
NULL
,
NULL
);
hb_font_funcs_set_glyph_v_advance_func
(
funcs
,
hb_ft_get_glyph_v_advance
,
NULL
,
NULL
);
...
...
src/hb-ot-font.cc
浏览文件 @
6f2e6de1
...
@@ -35,6 +35,7 @@
...
@@ -35,6 +35,7 @@
#include "hb-ot-head-table.hh"
#include "hb-ot-head-table.hh"
#include "hb-ot-hhea-table.hh"
#include "hb-ot-hhea-table.hh"
#include "hb-ot-hmtx-table.hh"
#include "hb-ot-hmtx-table.hh"
#include "hb-ot-os2-table.hh"
struct
hb_ot_face_metrics_accelerator_t
struct
hb_ot_face_metrics_accelerator_t
...
@@ -42,17 +43,41 @@ struct hb_ot_face_metrics_accelerator_t
...
@@ -42,17 +43,41 @@ struct hb_ot_face_metrics_accelerator_t
unsigned
int
num_metrics
;
unsigned
int
num_metrics
;
unsigned
int
num_advances
;
unsigned
int
num_advances
;
unsigned
int
default_advance
;
unsigned
int
default_advance
;
unsigned
short
ascender
;
unsigned
short
descender
;
unsigned
short
line_gap
;
const
OT
::
_mtx
*
table
;
const
OT
::
_mtx
*
table
;
hb_blob_t
*
blob
;
hb_blob_t
*
blob
;
inline
void
init
(
hb_face_t
*
face
,
inline
void
init
(
hb_face_t
*
face
,
hb_tag_t
_hea_tag
,
hb_tag_t
_mtx_tag
)
hb_tag_t
_hea_tag
,
hb_tag_t
_mtx_tag
,
hb_tag_t
os2_tag
)
{
{
this
->
default_advance
=
face
->
get_upem
();
this
->
default_advance
=
face
->
get_upem
();
bool
got_font_extents
=
false
;
if
(
os2_tag
)
{
hb_blob_t
*
os2_blob
=
OT
::
Sanitizer
<
OT
::
os2
>::
sanitize
(
face
->
reference_table
(
os2_tag
));
const
OT
::
os2
*
os2
=
OT
::
Sanitizer
<
OT
::
os2
>::
lock_instance
(
os2_blob
);
this
->
ascender
=
os2
->
sTypoAscender
;
this
->
descender
=
os2
->
sTypoDescender
;
this
->
line_gap
=
os2
->
sTypoLineGap
;
hb_blob_destroy
(
os2_blob
);
got_font_extents
=
(
this
->
ascender
|
this
->
descender
)
!=
0
;
}
hb_blob_t
*
_hea_blob
=
OT
::
Sanitizer
<
OT
::
_hea
>::
sanitize
(
face
->
reference_table
(
_hea_tag
));
hb_blob_t
*
_hea_blob
=
OT
::
Sanitizer
<
OT
::
_hea
>::
sanitize
(
face
->
reference_table
(
_hea_tag
));
const
OT
::
_hea
*
_hea
=
OT
::
Sanitizer
<
OT
::
_hea
>::
lock_instance
(
_hea_blob
);
const
OT
::
_hea
*
_hea
=
OT
::
Sanitizer
<
OT
::
_hea
>::
lock_instance
(
_hea_blob
);
this
->
num_advances
=
_hea
->
numberOfLongMetrics
;
this
->
num_advances
=
_hea
->
numberOfLongMetrics
;
if
(
!
got_font_extents
)
{
this
->
ascender
=
_hea
->
ascender
;
this
->
descender
=
_hea
->
descender
;
this
->
line_gap
=
_hea
->
lineGap
;
}
hb_blob_destroy
(
_hea_blob
);
hb_blob_destroy
(
_hea_blob
);
this
->
blob
=
OT
::
Sanitizer
<
OT
::
_mtx
>::
sanitize
(
face
->
reference_table
(
_mtx_tag
));
this
->
blob
=
OT
::
Sanitizer
<
OT
::
_mtx
>::
sanitize
(
face
->
reference_table
(
_mtx_tag
));
...
@@ -252,8 +277,8 @@ _hb_ot_font_create (hb_face_t *face)
...
@@ -252,8 +277,8 @@ _hb_ot_font_create (hb_face_t *face)
return
NULL
;
return
NULL
;
ot_font
->
cmap
.
init
(
face
);
ot_font
->
cmap
.
init
(
face
);
ot_font
->
h_metrics
.
init
(
face
,
HB_OT_TAG_hhea
,
HB_OT_TAG_hmtx
);
ot_font
->
h_metrics
.
init
(
face
,
HB_OT_TAG_hhea
,
HB_OT_TAG_hmtx
,
HB_OT_TAG_os2
);
ot_font
->
v_metrics
.
init
(
face
,
HB_OT_TAG_vhea
,
HB_OT_TAG_vmtx
);
/* TODO Can we do this lazily? */
ot_font
->
v_metrics
.
init
(
face
,
HB_OT_TAG_vhea
,
HB_OT_TAG_vmtx
,
HB_TAG_NONE
);
/* TODO Can we do this lazily? */
ot_font
->
glyf
.
init
(
face
);
ot_font
->
glyf
.
init
(
face
);
return
ot_font
;
return
ot_font
;
...
@@ -320,6 +345,31 @@ hb_ot_get_glyph_extents (hb_font_t *font HB_UNUSED,
...
@@ -320,6 +345,31 @@ hb_ot_get_glyph_extents (hb_font_t *font HB_UNUSED,
return
ret
;
return
ret
;
}
}
static
hb_bool_t
hb_ot_get_font_h_extents
(
hb_font_t
*
font
HB_UNUSED
,
void
*
font_data
,
hb_font_extents_t
*
metrics
,
void
*
user_data
HB_UNUSED
)
{
const
hb_ot_font_t
*
ot_font
=
(
const
hb_ot_font_t
*
)
font_data
;
metrics
->
ascender
=
font
->
em_scale_y
(
ot_font
->
h_metrics
.
ascender
);
metrics
->
descender
=
font
->
em_scale_y
(
ot_font
->
h_metrics
.
descender
);
metrics
->
line_gap
=
font
->
em_scale_y
(
ot_font
->
h_metrics
.
line_gap
);
return
true
;
}
static
hb_bool_t
hb_ot_get_font_v_extents
(
hb_font_t
*
font
HB_UNUSED
,
void
*
font_data
,
hb_font_extents_t
*
metrics
,
void
*
user_data
HB_UNUSED
)
{
const
hb_ot_font_t
*
ot_font
=
(
const
hb_ot_font_t
*
)
font_data
;
metrics
->
ascender
=
font
->
em_scale_x
(
ot_font
->
v_metrics
.
ascender
);
metrics
->
descender
=
font
->
em_scale_x
(
ot_font
->
v_metrics
.
descender
);
metrics
->
line_gap
=
font
->
em_scale_x
(
ot_font
->
v_metrics
.
line_gap
);
return
true
;
}
static
hb_font_funcs_t
*
static_ot_funcs
=
NULL
;
static
hb_font_funcs_t
*
static_ot_funcs
=
NULL
;
...
@@ -341,6 +391,8 @@ retry:
...
@@ -341,6 +391,8 @@ retry:
{
{
funcs
=
hb_font_funcs_create
();
funcs
=
hb_font_funcs_create
();
hb_font_funcs_set_font_h_extents_func
(
funcs
,
hb_ot_get_font_h_extents
,
NULL
,
NULL
);
hb_font_funcs_set_font_v_extents_func
(
funcs
,
hb_ot_get_font_v_extents
,
NULL
,
NULL
);
hb_font_funcs_set_glyph_func
(
funcs
,
hb_ot_get_glyph
,
NULL
,
NULL
);
hb_font_funcs_set_glyph_func
(
funcs
,
hb_ot_get_glyph
,
NULL
,
NULL
);
hb_font_funcs_set_glyph_h_advance_func
(
funcs
,
hb_ot_get_glyph_h_advance
,
NULL
,
NULL
);
hb_font_funcs_set_glyph_h_advance_func
(
funcs
,
hb_ot_get_glyph_h_advance
,
NULL
,
NULL
);
hb_font_funcs_set_glyph_v_advance_func
(
funcs
,
hb_ot_get_glyph_v_advance
,
NULL
,
NULL
);
hb_font_funcs_set_glyph_v_advance_func
(
funcs
,
hb_ot_get_glyph_v_advance
,
NULL
,
NULL
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录