Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Harfbuzz
提交
4b6317c4
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看板
提交
4b6317c4
编写于
7月 07, 2011
作者:
B
Behdad Esfahbod
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
More code shuffling
上级
3361c9a3
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
82 addition
and
119 deletion
+82
-119
src/hb-font-private.hh
src/hb-font-private.hh
+8
-8
src/hb-font.cc
src/hb-font.cc
+2
-1
src/hb-unicode-private.hh
src/hb-unicode-private.hh
+20
-22
src/hb-unicode.cc
src/hb-unicode.cc
+52
-88
未找到文件。
src/hb-font-private.hh
浏览文件 @
4b6317c4
...
@@ -41,13 +41,6 @@ HB_BEGIN_DECLS
...
@@ -41,13 +41,6 @@ HB_BEGIN_DECLS
* hb_font_funcs_t
* hb_font_funcs_t
*/
*/
struct
_hb_font_funcs_t
{
hb_object_header_t
header
;
hb_bool_t
immutable
;
/* Don't access these directly. Call hb_font_get_*() instead. */
#define HB_FONT_FUNCS_IMPLEMENT_CALLBACKS \
#define HB_FONT_FUNCS_IMPLEMENT_CALLBACKS \
HB_FONT_FUNC_IMPLEMENT (glyph) \
HB_FONT_FUNC_IMPLEMENT (glyph) \
HB_FONT_FUNC_IMPLEMENT (glyph_h_advance) \
HB_FONT_FUNC_IMPLEMENT (glyph_h_advance) \
...
@@ -57,8 +50,15 @@ struct _hb_font_funcs_t {
...
@@ -57,8 +50,15 @@ struct _hb_font_funcs_t {
HB_FONT_FUNC_IMPLEMENT (glyph_h_kerning) \
HB_FONT_FUNC_IMPLEMENT (glyph_h_kerning) \
HB_FONT_FUNC_IMPLEMENT (glyph_v_kerning) \
HB_FONT_FUNC_IMPLEMENT (glyph_v_kerning) \
HB_FONT_FUNC_IMPLEMENT (glyph_extents) \
HB_FONT_FUNC_IMPLEMENT (glyph_extents) \
HB_FONT_FUNC_IMPLEMENT (glyph_contour_point)
HB_FONT_FUNC_IMPLEMENT (glyph_contour_point) \
/* ^--- Add new callbacks here */
struct
_hb_font_funcs_t
{
hb_object_header_t
header
;
hb_bool_t
immutable
;
/* Don't access these directly. Call hb_font_get_*() instead. */
struct
{
struct
{
#define HB_FONT_FUNC_IMPLEMENT(name) hb_font_get_##name##_func_t name;
#define HB_FONT_FUNC_IMPLEMENT(name) hb_font_get_##name##_func_t name;
...
...
src/hb-font.cc
浏览文件 @
4b6317c4
...
@@ -236,7 +236,8 @@ hb_font_funcs_destroy (hb_font_funcs_t *ffuncs)
...
@@ -236,7 +236,8 @@ hb_font_funcs_destroy (hb_font_funcs_t *ffuncs)
{
{
if
(
!
hb_object_destroy
(
ffuncs
))
return
;
if
(
!
hb_object_destroy
(
ffuncs
))
return
;
#define HB_FONT_FUNC_IMPLEMENT(name) if (ffuncs->destroy.name) ffuncs->destroy.name (ffuncs->user_data.name);
#define HB_FONT_FUNC_IMPLEMENT(name) if (ffuncs->destroy.name) \
ffuncs->destroy.name (ffuncs->user_data.name);
HB_FONT_FUNCS_IMPLEMENT_CALLBACKS
HB_FONT_FUNCS_IMPLEMENT_CALLBACKS
#undef HB_FONT_FUNC_IMPLEMENT
#undef HB_FONT_FUNC_IMPLEMENT
...
...
src/hb-unicode-private.hh
浏览文件 @
4b6317c4
...
@@ -43,6 +43,14 @@ HB_BEGIN_DECLS
...
@@ -43,6 +43,14 @@ HB_BEGIN_DECLS
* hb_unicode_funcs_t
* hb_unicode_funcs_t
*/
*/
#define HB_UNICODE_FUNCS_IMPLEMENT_CALLBACKS \
HB_UNICODE_FUNC_IMPLEMENT (unsigned int, combining_class, 0) \
HB_UNICODE_FUNC_IMPLEMENT (unsigned int, eastasian_width, 1) \
HB_UNICODE_FUNC_IMPLEMENT (hb_unicode_general_category_t, general_category, HB_UNICODE_GENERAL_CATEGORY_OTHER_LETTER) \
HB_UNICODE_FUNC_IMPLEMENT (hb_codepoint_t, mirroring, unicode) \
HB_UNICODE_FUNC_IMPLEMENT (hb_script_t, script, HB_SCRIPT_UNKNOWN) \
/* ^--- Add new callbacks here */
struct
_hb_unicode_funcs_t
{
struct
_hb_unicode_funcs_t
{
hb_object_header_t
header
;
hb_object_header_t
header
;
...
@@ -50,43 +58,33 @@ struct _hb_unicode_funcs_t {
...
@@ -50,43 +58,33 @@ struct _hb_unicode_funcs_t {
bool
immutable
;
bool
immutable
;
#define
IMPLEMENT(return_type, nam
e) \
#define
HB_UNICODE_FUNC_IMPLEMENT(return_type, name, default_valu
e) \
inline return_type \
inline return_type \
get_##name (hb_codepoint_t unicode) \
get_##name (hb_codepoint_t unicode) \
{ return this->get.name (this, unicode, this->user_data.name); }
{ return this->get.name (this, unicode, this->user_data.name); }
IMPLEMENT
(
unsigned
int
,
combining_class
)
HB_UNICODE_FUNCS_IMPLEMENT_CALLBACKS
IMPLEMENT
(
unsigned
int
,
eastasian_width
)
IMPLEMENT
(
hb_unicode_general_category_t
,
general_category
)
IMPLEMENT
(
hb_codepoint_t
,
mirroring
)
IMPLEMENT
(
hb_script_t
,
script
)
#undef IMPLEMENT
#undef
HB_UNICODE_FUNC_
IMPLEMENT
/* Don't access these directly. Call get_*() instead. */
/* Don't access these directly. Call get_*() instead. */
struct
{
struct
{
hb_unicode_get_combining_class_func_t
combining_class
;
#define HB_UNICODE_FUNC_IMPLEMENT(return_type, name, default_value) hb_unicode_get_##name##_func_t name;
hb_unicode_get_eastasian_width_func_t
eastasian_width
;
HB_UNICODE_FUNCS_IMPLEMENT_CALLBACKS
hb_unicode_get_general_category_func_t
general_category
;
#undef HB_UNICODE_FUNC_IMPLEMENT
hb_unicode_get_mirroring_func_t
mirroring
;
hb_unicode_get_script_func_t
script
;
}
get
;
}
get
;
struct
{
struct
{
void
*
combining_class
;
#define HB_UNICODE_FUNC_IMPLEMENT(return_type, name, default_value) void *name;
void
*
eastasian_width
;
HB_UNICODE_FUNCS_IMPLEMENT_CALLBACKS
void
*
general_category
;
#undef HB_UNICODE_FUNC_IMPLEMENT
void
*
mirroring
;
void
*
script
;
}
user_data
;
}
user_data
;
struct
{
struct
{
hb_destroy_func_t
combining_class
;
#define HB_UNICODE_FUNC_IMPLEMENT(return_type, name, default_value) hb_destroy_func_t name;
hb_destroy_func_t
eastasian_width
;
HB_UNICODE_FUNCS_IMPLEMENT_CALLBACKS
hb_destroy_func_t
general_category
;
#undef HB_UNICODE_FUNC_IMPLEMENT
hb_destroy_func_t
mirroring
;
hb_destroy_func_t
script
;
}
destroy
;
}
destroy
;
};
};
...
...
src/hb-unicode.cc
浏览文件 @
4b6317c4
...
@@ -39,45 +39,19 @@ HB_BEGIN_DECLS
...
@@ -39,45 +39,19 @@ HB_BEGIN_DECLS
* hb_unicode_funcs_t
* hb_unicode_funcs_t
*/
*/
static
unsigned
int
#define HB_UNICODE_FUNC_IMPLEMENT(return_type, name, default_value) \
hb_unicode_get_combining_class_nil
(
hb_unicode_funcs_t
*
ufuncs
HB_UNUSED
,
\
hb_codepoint_t
unicode
HB_UNUSED
,
\
void
*
user_data
HB_UNUSED
)
static return_type \
{
hb_unicode_get_##name##_nil (hb_unicode_funcs_t *ufuncs HB_UNUSED, \
return
0
;
hb_codepoint_t unicode HB_UNUSED, \
}
void *user_data HB_UNUSED) \
{ \
static
unsigned
int
return default_value; \
hb_unicode_get_eastasian_width_nil
(
hb_unicode_funcs_t
*
ufuncs
HB_UNUSED
,
hb_codepoint_t
unicode
HB_UNUSED
,
void
*
user_data
HB_UNUSED
)
{
return
1
;
}
}
static
hb_unicode_general_category_t
HB_UNICODE_FUNCS_IMPLEMENT_CALLBACKS
hb_unicode_get_general_category_nil
(
hb_unicode_funcs_t
*
ufuncs
HB_UNUSED
,
#undef HB_UNICODE_FUNC_IMPLEMENT
hb_codepoint_t
unicode
HB_UNUSED
,
void
*
user_data
HB_UNUSED
)
{
return
HB_UNICODE_GENERAL_CATEGORY_OTHER_LETTER
;
}
static
hb_codepoint_t
hb_unicode_get_mirroring_nil
(
hb_unicode_funcs_t
*
ufuncs
HB_UNUSED
,
hb_codepoint_t
unicode
HB_UNUSED
,
void
*
user_data
HB_UNUSED
)
{
return
unicode
;
}
static
hb_script_t
hb_unicode_get_script_nil
(
hb_unicode_funcs_t
*
ufuncs
HB_UNUSED
,
hb_codepoint_t
unicode
HB_UNUSED
,
void
*
user_data
HB_UNUSED
)
{
return
HB_SCRIPT_UNKNOWN
;
}
hb_unicode_funcs_t
_hb_unicode_funcs_nil
=
{
hb_unicode_funcs_t
_hb_unicode_funcs_nil
=
{
...
@@ -86,11 +60,9 @@ hb_unicode_funcs_t _hb_unicode_funcs_nil = {
...
@@ -86,11 +60,9 @@ hb_unicode_funcs_t _hb_unicode_funcs_nil = {
NULL
,
/* parent */
NULL
,
/* parent */
TRUE
,
/* immutable */
TRUE
,
/* immutable */
{
{
hb_unicode_get_combining_class_nil
,
#define HB_UNICODE_FUNC_IMPLEMENT(return_type, name, default_value) hb_unicode_get_##name##_nil,
hb_unicode_get_eastasian_width_nil
,
HB_UNICODE_FUNCS_IMPLEMENT_CALLBACKS
hb_unicode_get_general_category_nil
,
#undef HB_UNICODE_FUNC_IMPLEMENT
hb_unicode_get_mirroring_nil
,
hb_unicode_get_script_nil
,
}
}
};
};
...
@@ -142,13 +114,10 @@ hb_unicode_funcs_destroy (hb_unicode_funcs_t *ufuncs)
...
@@ -142,13 +114,10 @@ hb_unicode_funcs_destroy (hb_unicode_funcs_t *ufuncs)
{
{
if
(
!
hb_object_destroy
(
ufuncs
))
return
;
if
(
!
hb_object_destroy
(
ufuncs
))
return
;
#define DESTROY(name) if (ufuncs->destroy.name) ufuncs->destroy.name (ufuncs->user_data.name)
#define HB_UNICODE_FUNC_IMPLEMENT(return_type, name, default_value) \
DESTROY
(
combining_class
);
if (ufuncs->destroy.name) ufuncs->destroy.name (ufuncs->user_data.name);
DESTROY
(
eastasian_width
);
HB_UNICODE_FUNCS_IMPLEMENT_CALLBACKS
DESTROY
(
general_category
);
#undef HB_UNICODE_FUNC_IMPLEMENT
DESTROY
(
mirroring
);
DESTROY
(
script
);
#undef DESTROY
hb_unicode_funcs_destroy
(
ufuncs
->
parent
);
hb_unicode_funcs_destroy
(
ufuncs
->
parent
);
...
@@ -194,45 +163,40 @@ hb_unicode_funcs_get_parent (hb_unicode_funcs_t *ufuncs)
...
@@ -194,45 +163,40 @@ hb_unicode_funcs_get_parent (hb_unicode_funcs_t *ufuncs)
}
}
#define IMPLEMENT(return_type, name) \
#define HB_UNICODE_FUNC_IMPLEMENT(return_type, name, default_value) \
\
\
void \
void \
hb_unicode_funcs_set_##name##_func (hb_unicode_funcs_t *ufuncs, \
hb_unicode_funcs_set_##name##_func (hb_unicode_funcs_t *ufuncs, \
hb_unicode_get_##name##_func_t func, \
hb_unicode_get_##name##_func_t func, \
void *user_data, \
void *user_data, \
hb_destroy_func_t destroy) \
hb_destroy_func_t destroy) \
{ \
{ \
if (ufuncs->immutable) \
if (ufuncs->immutable) \
return; \
return; \
\
\
if (ufuncs->destroy.name) \
if (ufuncs->destroy.name) \
ufuncs->destroy.name (ufuncs->user_data.name); \
ufuncs->destroy.name (ufuncs->user_data.name); \
\
\
if (func) { \
if (func) { \
ufuncs->get.name = func; \
ufuncs->get.name = func; \
ufuncs->user_data.name = user_data; \
ufuncs->user_data.name = user_data; \
ufuncs->destroy.name = destroy; \
ufuncs->destroy.name = destroy; \
} else { \
} else { \
ufuncs->get.name = ufuncs->parent->get.name; \
ufuncs->get.name = ufuncs->parent->get.name; \
ufuncs->user_data.name = ufuncs->parent->user_data.name; \
ufuncs->user_data.name = ufuncs->parent->user_data.name; \
ufuncs->destroy.name = NULL; \
ufuncs->destroy.name = NULL; \
} \
} \
} \
} \
\
\
return_type \
return_type \
hb_unicode_get_##name (hb_unicode_funcs_t *ufuncs, \
hb_unicode_get_##name (hb_unicode_funcs_t *ufuncs, \
hb_codepoint_t unicode) \
hb_codepoint_t unicode) \
{ \
{ \
return ufuncs->get.name (ufuncs, unicode, ufuncs->user_data.name); \
return ufuncs->get.name (ufuncs, unicode, ufuncs->user_data.name); \
}
}
IMPLEMENT
(
unsigned
int
,
combining_class
)
HB_UNICODE_FUNCS_IMPLEMENT_CALLBACKS
IMPLEMENT
(
unsigned
int
,
eastasian_width
)
#undef HB_UNICODE_FUNC_IMPLEMENT
IMPLEMENT
(
hb_unicode_general_category_t
,
general_category
)
IMPLEMENT
(
hb_codepoint_t
,
mirroring
)
IMPLEMENT
(
hb_script_t
,
script
)
#undef IMPLEMENT
HB_END_DECLS
HB_END_DECLS
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录