Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Harfbuzz
提交
dcac9fe9
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看板
提交
dcac9fe9
编写于
2月 16, 2018
作者:
G
Garret Rieger
提交者:
Behdad Esfahbod
2月 16, 2018
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[subset] Use complex glyph closure to populate gids_to_retain_sorted.
上级
58a54c9d
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
30 addition
and
19 deletion
+30
-19
src/hb-subset-plan.cc
src/hb-subset-plan.cc
+24
-19
src/hb-subset-plan.hh
src/hb-subset-plan.hh
+6
-0
未找到文件。
src/hb-subset-plan.cc
浏览文件 @
dcac9fe9
...
...
@@ -28,6 +28,7 @@
#include "hb-subset-plan.hh"
#include "hb-ot-cmap-table.hh"
#include "hb-ot-glyf-table.hh"
static
int
_hb_codepoint_t_cmp
(
const
void
*
pa
,
const
void
*
pb
)
...
...
@@ -94,9 +95,9 @@ _populate_codepoints (hb_set_t *input_codepoints,
}
static
void
_add_
composite_gids
(
const
OT
::
glyf
::
accelerator_t
&
glyf
,
hb_codepoint_t
gid
,
hb_set_t
*
gids_to_retain
)
_add_
gid_and_children
(
const
OT
::
glyf
::
accelerator_t
&
glyf
,
hb_codepoint_t
gid
,
hb_set_t
*
gids_to_retain
)
{
if
(
hb_set_has
(
gids_to_retain
,
gid
))
// Already visited this gid, ignore.
...
...
@@ -109,8 +110,8 @@ _add_composite_gids (const OT::glyf::accelerator_t &glyf,
{
do
{
_add_
composite_gids
(
glyf
,
(
hb_codepoint_t
)
composite
->
glyphIndex
,
gids_to_retain
);
}
while
(
glyf
.
next_composite
(
&
composite
);
_add_
gid_and_children
(
glyf
,
(
hb_codepoint_t
)
composite
->
glyphIndex
,
gids_to_retain
);
}
while
(
glyf
.
next_composite
(
&
composite
)
)
;
}
}
...
...
@@ -121,21 +122,19 @@ _populate_gids_to_retain (hb_face_t *face,
hb_prealloced_array_t
<
hb_codepoint_t
>&
old_gids_sorted
)
{
OT
::
cmap
::
accelerator_t
cmap
;
OT
::
glyf
::
accelerator_t
glyf
;
cmap
.
init
(
face
);
glyf
.
init
(
face
);
hb_auto_array_t
<
unsigned
int
>
bad_indices
;
old_gids
.
alloc
(
codepoints
.
len
);
bool
has_zero
=
false
;
for
(
unsigned
int
i
=
0
;
i
<
codepoints
.
len
;
i
++
)
{
hb_codepoint_t
gid
;
if
(
!
cmap
.
get_nominal_glyph
(
codepoints
[
i
],
&
gid
))
{
gid
=
-
1
;
*
(
bad_indices
.
push
())
=
i
;
}
if
(
gid
==
0
)
{
has_zero
=
true
;
}
*
(
old_gids
.
push
())
=
gid
;
}
...
...
@@ -148,19 +147,25 @@ _populate_gids_to_retain (hb_face_t *face,
old_gids
.
remove
(
i
);
}
// Populate a second glyph id array that is sorted by glyph id
// and is gauranteed to contain 0.
old_gids_sorted
.
alloc
(
old_gids
.
len
+
(
has_zero
?
0
:
1
));
for
(
unsigned
int
i
=
0
;
i
<
old_gids
.
len
;
i
++
)
{
*
(
old_gids_sorted
.
push
())
=
old_gids
[
i
];
// Populate a full set of glyphs to retain by adding all referenced
// composite glyphs.
// TODO expand with glyphs reached by G*
hb_set_t
*
all_gids_to_retain
=
hb_set_create
();
_add_gid_and_children
(
glyf
,
0
,
all_gids_to_retain
);
for
(
unsigned
int
i
=
0
;
i
<
old_gids
.
len
;
i
++
)
{
_add_gid_and_children
(
glyf
,
old_gids
[
i
],
all_gids_to_retain
);
}
// Transfer to a sorted list.
unsigned
int
gid
=
HB_SET_VALUE_INVALID
;
while
(
hb_set_next
(
all_gids_to_retain
,
&
gid
))
{
*
(
old_gids_sorted
.
push
())
=
gid
;
}
if
(
!
has_zero
)
*
(
old_gids_sorted
.
push
())
=
0
;
old_gids_sorted
.
qsort
(
_hb_codepoint_t_cmp
);
// TODO(Q1) expand with glyphs that make up complex glyphs
// TODO expand with glyphs reached by G*
//
glyf
.
fini
();
cmap
.
fini
();
}
...
...
src/hb-subset-plan.hh
浏览文件 @
dcac9fe9
...
...
@@ -38,8 +38,14 @@ struct hb_subset_plan_t {
// TODO(Q1) actual map, drop this crap
// Look at me ma, I'm a poor mans map codepoint : new gid
// codepoints is sorted and aligned with gids_to_retain.
// These first two lists provide a mapping from cp -> gid
// As a result it does not list the full set of glyphs to retain.
hb_prealloced_array_t
<
hb_codepoint_t
>
codepoints
;
hb_prealloced_array_t
<
hb_codepoint_t
>
gids_to_retain
;
// This list contains the complete set of glyphs to retain and may contain
// more glyphs then the lists above.
hb_prealloced_array_t
<
hb_codepoint_t
>
gids_to_retain_sorted
;
// Plan is only good for a specific source/dest so keep them with it
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录