Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Harfbuzz
提交
3bc81558
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
3bc81558
编写于
2月 09, 2018
作者:
G
Garret Rieger
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Formatting for hb-subset-plan.
上级
86aa4b3b
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
27 addition
and
24 deletion
+27
-24
src/hb-subset-plan.cc
src/hb-subset-plan.cc
+27
-24
未找到文件。
src/hb-subset-plan.cc
浏览文件 @
3bc81558
...
...
@@ -29,15 +29,16 @@
#include "hb-subset-plan.hh"
#include "hb-ot-cmap-table.hh"
int
hb_codepoint_t_cmp
(
const
void
*
l
,
const
void
*
r
)
{
int
hb_codepoint_t_cmp
(
const
void
*
l
,
const
void
*
r
)
{
return
*
((
hb_codepoint_t
*
)
l
)
-
*
((
hb_codepoint_t
*
)
r
);
}
hb_bool_t
hb_subset_plan_new_gid_for_old_id
(
hb_subset_plan_t
*
plan
,
hb_subset_plan_new_gid_for_old_id
(
hb_subset_plan_t
*
plan
,
hb_codepoint_t
old_gid
,
hb_codepoint_t
*
new_gid
)
{
hb_codepoint_t
*
new_gid
)
{
// the index in old_gids is the new gid; only up to codepoints.len are valid
for
(
unsigned
int
i
=
0
;
i
<
plan
->
codepoints
.
len
;
i
++
)
{
if
(
plan
->
gids_to_retain
[
i
]
==
old_gid
)
{
...
...
@@ -48,19 +49,21 @@ hb_subset_plan_new_gid_for_old_id(hb_subset_plan_t *plan,
return
false
;
}
void
populate_codepoints
(
hb_set_t
*
input_codepoints
,
hb_auto_array_t
<
hb_codepoint_t
>&
plan_codepoints
)
{
plan_codepoints
.
alloc
(
hb_set_get_population
(
input_codepoints
));
void
_populate_codepoints
(
hb_set_t
*
input_codepoints
,
hb_auto_array_t
<
hb_codepoint_t
>&
plan_codepoints
)
{
plan_codepoints
.
alloc
(
hb_set_get_population
(
input_codepoints
));
hb_codepoint_t
cp
=
-
1
;
while
(
hb_set_next
(
input_codepoints
,
&
cp
))
{
while
(
hb_set_next
(
input_codepoints
,
&
cp
))
{
hb_codepoint_t
*
wr
=
plan_codepoints
.
push
();
*
wr
=
cp
;
}
plan_codepoints
.
qsort
(
hb_codepoint_t_cmp
);
plan_codepoints
.
qsort
(
hb_codepoint_t_cmp
);
}
void
populate_gids_to_retain
(
hb_face_t
*
face
,
_
populate_gids_to_retain
(
hb_face_t
*
face
,
hb_auto_array_t
<
hb_codepoint_t
>&
codepoints
,
hb_auto_array_t
<
hb_codepoint_t
>&
old_gids
)
{
...
...
@@ -69,22 +72,22 @@ populate_gids_to_retain (hb_face_t *face,
hb_auto_array_t
<
unsigned
int
>
bad_indices
;
old_gids
.
alloc
(
codepoints
.
len
);
old_gids
.
alloc
(
codepoints
.
len
);
for
(
unsigned
int
i
=
0
;
i
<
codepoints
.
len
;
i
++
)
{
hb_codepoint_t
gid
;
if
(
!
cmap
.
get_nominal_glyph
(
codepoints
[
i
],
&
gid
))
{
if
(
!
cmap
.
get_nominal_glyph
(
codepoints
[
i
],
&
gid
))
{
gid
=
-
1
;
*
(
bad_indices
.
push
())
=
i
;
*
(
bad_indices
.
push
())
=
i
;
}
*
(
old_gids
.
push
())
=
gid
;
*
(
old_gids
.
push
())
=
gid
;
}
while
(
bad_indices
.
len
>
0
)
{
unsigned
int
i
=
bad_indices
[
bad_indices
.
len
-
1
];
bad_indices
.
pop
();
bad_indices
.
pop
();
DEBUG_MSG
(
SUBSET
,
nullptr
,
"Drop U+%04X; no gid"
,
codepoints
[
i
]);
codepoints
.
remove
(
i
);
old_gids
.
remove
(
i
);
codepoints
.
remove
(
i
);
old_gids
.
remove
(
i
);
}
for
(
unsigned
int
i
=
0
;
i
<
codepoints
.
len
;
i
++
)
{
...
...
@@ -116,8 +119,8 @@ hb_subset_plan_create (hb_face_t *face,
hb_subset_input_t
*
input
)
{
hb_subset_plan_t
*
plan
=
hb_object_create
<
hb_subset_plan_t
>
();
populate_codepoints
(
input
->
codepoints
,
plan
->
codepoints
);
populate_gids_to_retain
(
face
,
plan
->
codepoints
,
plan
->
gids_to_retain
);
_populate_codepoints
(
input
->
codepoints
,
plan
->
codepoints
);
_populate_gids_to_retain
(
face
,
plan
->
codepoints
,
plan
->
gids_to_retain
);
return
plan
;
}
...
...
@@ -138,7 +141,7 @@ hb_subset_plan_destroy (hb_subset_plan_t *plan)
{
if
(
!
hb_object_destroy
(
plan
))
return
;
plan
->
codepoints
.
finish
();
plan
->
gids_to_retain
.
finish
();
plan
->
codepoints
.
finish
();
plan
->
gids_to_retain
.
finish
();
free
(
plan
);
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录