Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Harfbuzz
提交
b6b7ba13
T
Third Party Harfbuzz
项目概览
OpenHarmony
/
Third Party Harfbuzz
10 个月 前同步成功
通知
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,体验更适合开发者的 AI 搜索 >>
提交
b6b7ba13
编写于
7月 27, 2012
作者:
B
Behdad Esfahbod
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Switch old and uniscribe backends to shape_plan
上级
c32c096a
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
48 addition
and
174 deletion
+48
-174
src/hb-old.cc
src/hb-old.cc
+5
-75
src/hb-shape.cc
src/hb-shape.cc
+5
-0
src/hb-shaper-impl-private.hh
src/hb-shaper-impl-private.hh
+1
-2
src/hb-shaper-private.hh
src/hb-shaper-private.hh
+0
-4
src/hb-uniscribe.cc
src/hb-uniscribe.cc
+37
-93
未找到文件。
src/hb-old.cc
浏览文件 @
b6b7ba13
...
...
@@ -248,61 +248,6 @@ _hb_old_shaper_shape_plan_data_destroy (hb_old_shaper_shape_plan_data_t *data)
* shaper
*/
static
hb_user_data_key_t
hb_old_data_key
;
static
HB_Face
_hb_old_face_get
(
hb_face_t
*
face
)
{
HB_Face
data
=
(
HB_Face
)
hb_face_get_user_data
(
face
,
&
hb_old_data_key
);
if
(
likely
(
data
))
return
data
;
data
=
_hb_old_shaper_face_data_create
(
face
);
if
(
unlikely
(
!
data
))
{
DEBUG_MSG
(
OLD
,
face
,
"HB_NewFace failed"
);
return
NULL
;
}
if
(
unlikely
(
!
hb_face_set_user_data
(
face
,
&
hb_old_data_key
,
data
,
(
hb_destroy_func_t
)
_hb_old_shaper_face_data_destroy
,
false
)))
{
_hb_old_shaper_face_data_destroy
(
data
);
data
=
(
HB_Face
)
hb_face_get_user_data
(
face
,
&
hb_old_data_key
);
if
(
data
)
return
data
;
else
return
NULL
;
}
return
data
;
}
static
HB_Font
_hb_old_font_get
(
hb_font_t
*
font
)
{
/* Ouch, check user_data! */
HB_Font
data
=
_hb_old_shaper_font_data_create
(
font
);
if
(
!
data
)
return
NULL
;
if
(
unlikely
(
!
hb_font_set_user_data
(
font
,
&
hb_old_data_key
,
data
,
(
hb_destroy_func_t
)
_hb_old_shaper_font_data_destroy
,
false
)))
{
_hb_old_shaper_font_data_destroy
(
data
);
data
=
(
HB_Font
)
hb_font_get_user_data
(
font
,
&
hb_old_data_key
);
if
(
data
)
return
data
;
else
return
NULL
;
}
return
data
;
}
hb_bool_t
_hb_old_shape
(
hb_shape_plan_t
*
shape_plan
,
hb_font_t
*
font
,
...
...
@@ -310,27 +255,12 @@ _hb_old_shape (hb_shape_plan_t *shape_plan,
const
hb_feature_t
*
features
,
unsigned
int
num_features
)
{
if
(
unlikely
(
!
buffer
->
len
))
return
true
;
buffer
->
guess_properties
();
hb_face_t
*
face
=
font
->
face
;
HB_Face
old_face
=
HB_SHAPER_DATA_GET
(
face
);
HB_Font
old_font
=
HB_SHAPER_DATA_GET
(
font
);
bool
backward
=
HB_DIRECTION_IS_BACKWARD
(
buffer
->
props
.
direction
);
#define FAIL(...) \
HB_STMT_START { \
DEBUG_MSG (OLD, NULL, __VA_ARGS__); \
return false; \
} HB_STMT_END;
HB_Face
old_face
=
_hb_old_face_get
(
font
->
face
);
if
(
unlikely
(
!
old_face
))
FAIL
(
"Couldn't get old face"
);
HB_Font
old_font
=
_hb_old_font_get
(
font
);
if
(
unlikely
(
!
old_font
))
FAIL
(
"Couldn't get old font"
);
retry:
unsigned
int
scratch_size
;
...
...
@@ -398,7 +328,7 @@ retry:
{
buffer
->
ensure
(
buffer
->
allocated
*
2
);
if
(
buffer
->
in_error
)
FAIL
(
"Buffer resize failed"
)
;
return
false
;
goto
retry
;
}
return
false
;
...
...
@@ -429,7 +359,7 @@ retry:
buffer
->
ensure
(
num_glyphs
);
if
(
buffer
->
in_error
)
FAIL
(
"Buffer in error"
)
;
return
false
;
buffer
->
len
=
num_glyphs
;
...
...
src/hb-shape.cc
浏览文件 @
b6b7ba13
...
...
@@ -82,6 +82,11 @@ hb_shape_full (hb_font_t *font,
unsigned
int
num_features
,
const
char
*
const
*
shaper_list
)
{
if
(
unlikely
(
!
buffer
->
len
))
return
true
;
buffer
->
guess_properties
();
hb_shape_plan_t
*
shape_plan
=
hb_shape_plan_create
(
font
->
face
,
&
buffer
->
props
,
features
,
num_features
,
shaper_list
);
hb_bool_t
res
=
hb_shape_plan_execute
(
shape_plan
,
font
,
buffer
,
features
,
num_features
);
hb_shape_plan_destroy
(
shape_plan
);
...
...
src/hb-shaper-impl-private.hh
浏览文件 @
b6b7ba13
...
...
@@ -36,8 +36,7 @@
#ifdef HB_SHAPER
/* For use in things like font->shaper_data() in the shaper implementations. */
#define shaper_data() shaper_data.HB_SHAPER
#define HB_SHAPER_DATA_GET(object) HB_SHAPER_DATA (HB_SHAPER, object)
#endif
...
...
src/hb-shaper-private.hh
浏览文件 @
b6b7ba13
...
...
@@ -69,15 +69,11 @@ struct hb_shaper_data_t {
#define HB_SHAPER_DATA_TYPE(shaper, object) struct hb_##shaper##_shaper_##object##_data_t
#define HB_SHAPER_DATA(shaper, object) (* (HB_SHAPER_DATA_TYPE(shaper, object) **) &(object)->shaper_data.shaper)
#define HB_SHAPER_DATA_GET_FUNC(shaper, object) _hb_##shaper##_shaper_get_##object##_data
#define HB_SHAPER_DATA_CREATE_FUNC(shaper, object) _hb_##shaper##_shaper_##object##_data_create
#define HB_SHAPER_DATA_DESTROY_FUNC(shaper, object) _hb_##shaper##_shaper_##object##_data_destroy
#define HB_SHAPER_DATA_PROTOTYPE(shaper, object) \
HB_SHAPER_DATA_TYPE (shaper, object);
/* Type forward declaration. */
\
static inline HB_SHAPER_DATA_TYPE (shaper, object) * \
HB_SHAPER_DATA_GET_FUNC (shaper, object) (hb_##object##_t *object) \
{ return HB_SHAPER_DATA (shaper, object); } \
extern "C" HB_INTERNAL HB_SHAPER_DATA_TYPE (shaper, object) * \
HB_SHAPER_DATA_CREATE_FUNC (shaper, object) (hb_##object##_t *object HB_SHAPER_DATA_CREATE_FUNC_EXTRA_ARGS); \
extern "C" HB_INTERNAL void \
...
...
src/hb-uniscribe.cc
浏览文件 @
b6b7ba13
...
...
@@ -55,38 +55,6 @@ DWORD GetFontData(
);
*/
static
bool
populate_log_font
(
LOGFONTW
*
lf
,
hb_font_t
*
font
)
{
memset
(
lf
,
0
,
sizeof
(
*
lf
));
lf
->
lfHeight
=
-
font
->
y_scale
;
lf
->
lfCharSet
=
DEFAULT_CHARSET
;
hb_blob_t
*
blob
=
Sanitizer
<
name
>::
sanitize
(
hb_face_reference_table
(
font
->
face
,
HB_TAG
(
'n'
,
'a'
,
'm'
,
'e'
)));
const
name
*
name_table
=
Sanitizer
<
name
>::
lock_instance
(
blob
);
unsigned
int
len
=
name_table
->
get_name
(
3
,
1
,
0x409
,
4
,
lf
->
lfFaceName
,
sizeof
(
lf
->
lfFaceName
[
0
])
*
LF_FACESIZE
)
/
sizeof
(
lf
->
lfFaceName
[
0
]);
hb_blob_destroy
(
blob
);
if
(
unlikely
(
!
len
))
{
DEBUG_MSG
(
UNISCRIBE
,
NULL
,
"Didn't find English name table entry"
);
return
false
;
}
if
(
unlikely
(
len
>=
LF_FACESIZE
))
{
DEBUG_MSG
(
UNISCRIBE
,
NULL
,
"Font name too long"
);
return
false
;
}
for
(
unsigned
int
i
=
0
;
i
<
len
;
i
++
)
lf
->
lfFaceName
[
i
]
=
hb_be_uint16
(
lf
->
lfFaceName
[
i
]);
lf
->
lfFaceName
[
len
]
=
0
;
return
true
;
}
/*
* shaper face data
...
...
@@ -141,6 +109,38 @@ struct hb_uniscribe_shaper_font_data_t {
SCRIPT_CACHE
script_cache
;
};
static
bool
populate_log_font
(
LOGFONTW
*
lf
,
hb_font_t
*
font
)
{
memset
(
lf
,
0
,
sizeof
(
*
lf
));
lf
->
lfHeight
=
-
font
->
y_scale
;
lf
->
lfCharSet
=
DEFAULT_CHARSET
;
hb_blob_t
*
blob
=
Sanitizer
<
name
>::
sanitize
(
hb_face_reference_table
(
font
->
face
,
HB_TAG
(
'n'
,
'a'
,
'm'
,
'e'
)));
const
name
*
name_table
=
Sanitizer
<
name
>::
lock_instance
(
blob
);
unsigned
int
len
=
name_table
->
get_name
(
3
,
1
,
0x409
,
4
,
lf
->
lfFaceName
,
sizeof
(
lf
->
lfFaceName
[
0
])
*
LF_FACESIZE
)
/
sizeof
(
lf
->
lfFaceName
[
0
]);
hb_blob_destroy
(
blob
);
if
(
unlikely
(
!
len
))
{
DEBUG_MSG
(
UNISCRIBE
,
NULL
,
"Didn't find English name table entry"
);
return
false
;
}
if
(
unlikely
(
len
>=
LF_FACESIZE
))
{
DEBUG_MSG
(
UNISCRIBE
,
NULL
,
"Font name too long"
);
return
false
;
}
for
(
unsigned
int
i
=
0
;
i
<
len
;
i
++
)
lf
->
lfFaceName
[
i
]
=
hb_be_uint16
(
lf
->
lfFaceName
[
i
]);
lf
->
lfFaceName
[
len
]
=
0
;
return
true
;
}
hb_uniscribe_shaper_font_data_t
*
_hb_uniscribe_shaper_font_data_create
(
hb_font_t
*
font
)
{
...
...
@@ -208,65 +208,18 @@ _hb_uniscribe_shaper_shape_plan_data_destroy (hb_uniscribe_shaper_shape_plan_dat
/*
* shaper
*/
static
hb_user_data_key_t
hb_uniscribe_data_key
;
static
hb_uniscribe_shaper_face_data_t
*
_hb_uniscribe_face_get_data
(
hb_face_t
*
face
)
{
hb_uniscribe_shaper_face_data_t
*
data
=
(
hb_uniscribe_shaper_face_data_t
*
)
hb_face_get_user_data
(
face
,
&
hb_uniscribe_data_key
);
if
(
likely
(
data
))
return
data
;
data
=
_hb_uniscribe_shaper_face_data_create
(
face
);
if
(
!
data
)
return
NULL
;
if
(
unlikely
(
!
hb_face_set_user_data
(
face
,
&
hb_uniscribe_data_key
,
data
,
(
hb_destroy_func_t
)
_hb_uniscribe_shaper_face_data_destroy
,
false
)))
{
_hb_uniscribe_shaper_face_data_destroy
(
data
);
data
=
(
hb_uniscribe_shaper_face_data_t
*
)
hb_face_get_user_data
(
face
,
&
hb_uniscribe_data_key
);
}
return
data
;
}
static
hb_uniscribe_shaper_font_data_t
*
_hb_uniscribe_font_get_data
(
hb_font_t
*
font
)
{
hb_uniscribe_shaper_font_data_t
*
data
=
(
hb_uniscribe_shaper_font_data_t
*
)
hb_font_get_user_data
(
font
,
&
hb_uniscribe_data_key
);
if
(
likely
(
data
))
return
data
;
data
=
_hb_uniscribe_shaper_font_data_create
(
font
);
if
(
unlikely
(
!
data
))
return
NULL
;
if
(
unlikely
(
!
hb_font_set_user_data
(
font
,
&
hb_uniscribe_data_key
,
data
,
(
hb_destroy_func_t
)
_hb_uniscribe_shaper_font_data_destroy
,
false
)))
{
_hb_uniscribe_shaper_font_data_destroy
(
data
);
data
=
(
hb_uniscribe_shaper_font_data_t
*
)
hb_font_get_user_data
(
font
,
&
hb_uniscribe_data_key
);
}
return
data
;
}
LOGFONTW
*
hb_uniscribe_font_get_logfontw
(
hb_font_t
*
font
)
{
hb_uniscribe_shaper_font_data_t
*
font_data
=
_hb_uniscribe_font_get_data
(
font
);
if
(
unlikely
(
!
font_data
))
return
NULL
;
hb_uniscribe_shaper_font_data_t
*
font_data
=
HB_SHAPER_DATA_GET
(
font
);
return
&
font_data
->
log_font
;
}
HFONT
hb_uniscribe_font_get_hfont
(
hb_font_t
*
font
)
{
hb_uniscribe_shaper_font_data_t
*
font_data
=
_hb_uniscribe_font_get_data
(
font
);
if
(
unlikely
(
!
font_data
))
return
0
;
hb_uniscribe_shaper_font_data_t
*
font_data
=
HB_SHAPER_DATA_GET
(
font
);
return
font_data
->
hfont
;
}
...
...
@@ -278,7 +231,9 @@ _hb_uniscribe_shape (hb_shape_plan_t *shape_plan,
const
hb_feature_t
*
features
,
unsigned
int
num_features
)
{
buffer
->
guess_properties
();
hb_face_t
*
face
=
font
->
face
;
hb_uniscribe_shaper_face_data_t
*
face_data
=
HB_SHAPER_DATA_GET
(
face
);
hb_uniscribe_shaper_font_data_t
*
font_data
=
HB_SHAPER_DATA_GET
(
font
);
#define FAIL(...) \
HB_STMT_START { \
...
...
@@ -286,17 +241,6 @@ _hb_uniscribe_shape (hb_shape_plan_t *shape_plan,
return false; \
} HB_STMT_END;
hb_uniscribe_shaper_face_data_t
*
face_data
=
_hb_uniscribe_face_get_data
(
font
->
face
);
if
(
unlikely
(
!
face_data
->
fh
))
FAIL
(
"Couldn't get face data"
);
hb_uniscribe_shaper_font_data_t
*
font_data
=
_hb_uniscribe_font_get_data
(
font
);
if
(
unlikely
(
!
font_data
->
hfont
))
FAIL
(
"Couldn't get font font"
);
if
(
unlikely
(
!
buffer
->
len
))
return
true
;
HRESULT
hr
;
retry:
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录