Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Harfbuzz
提交
00894437
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看板
提交
00894437
编写于
2月 09, 2018
作者:
G
Garret Rieger
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Keep a second set of glyph ids in subset plan which is sorted by glyph id and always has gid 0
上级
3bc81558
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
27 addition
and
10 deletion
+27
-10
src/hb-subset-glyf.cc
src/hb-subset-glyf.cc
+1
-1
src/hb-subset-plan.cc
src/hb-subset-plan.cc
+25
-9
src/hb-subset-plan.hh
src/hb-subset-plan.hh
+1
-0
未找到文件。
src/hb-subset-glyf.cc
浏览文件 @
00894437
...
...
@@ -157,7 +157,7 @@ hb_subset_glyf_and_loca (hb_subset_plan_t *plan,
OT
::
glyf
::
accelerator_t
glyf
;
glyf
.
init
(
face
);
bool
result
=
_hb_subset_glyf_and_loca
(
glyf
,
glyf_data
,
plan
->
gids_to_retain
,
glyf_prime
,
loca_prime
);
bool
result
=
_hb_subset_glyf_and_loca
(
glyf
,
glyf_data
,
plan
->
gids_to_retain
_sorted
,
glyf_prime
,
loca_prime
);
glyf
.
fini
();
*
use_short_loca
=
false
;
...
...
src/hb-subset-plan.cc
浏览文件 @
00894437
...
...
@@ -30,7 +30,7 @@
#include "hb-ot-cmap-table.hh"
int
hb_codepoint_t_cmp
(
const
void
*
l
,
const
void
*
r
)
{
_
hb_codepoint_t_cmp
(
const
void
*
l
,
const
void
*
r
)
{
return
*
((
hb_codepoint_t
*
)
l
)
-
*
((
hb_codepoint_t
*
)
r
);
}
...
...
@@ -40,8 +40,8 @@ hb_subset_plan_new_gid_for_old_id (hb_subset_plan_t *plan,
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
)
{
for
(
unsigned
int
i
=
0
;
i
<
plan
->
gids_to_retain_sorted
.
len
;
i
++
)
{
if
(
plan
->
gids_to_retain
_sorted
[
i
]
==
old_gid
)
{
*
new_gid
=
i
;
return
true
;
}
...
...
@@ -59,13 +59,14 @@ _populate_codepoints (hb_set_t *input_codepoints,
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
,
hb_auto_array_t
<
hb_codepoint_t
>&
codepoints
,
hb_auto_array_t
<
hb_codepoint_t
>&
old_gids
)
hb_auto_array_t
<
hb_codepoint_t
>&
old_gids
,
hb_auto_array_t
<
hb_codepoint_t
>&
old_gids_sorted
)
{
OT
::
cmap
::
accelerator_t
cmap
;
cmap
.
init
(
face
);
...
...
@@ -73,12 +74,16 @@ _populate_gids_to_retain (hb_face_t *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
;
}
...
...
@@ -90,13 +95,20 @@ _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
];
}
if
(
!
has_zero
)
*
(
old_gids_sorted
.
push
())
=
0
;
old_gids_sorted
.
qsort
(
_hb_codepoint_t_cmp
);
for
(
unsigned
int
i
=
0
;
i
<
codepoints
.
len
;
i
++
)
{
DEBUG_MSG
(
SUBSET
,
nullptr
,
" U+%04X, old_gid %d, new_gid %d"
,
codepoints
[
i
],
old_gids
[
i
],
i
);
}
// TODO always keep .notdef
// TODO(Q1) expand with glyphs that make up complex glyphs
// TODO expand with glyphs reached by G*
//
...
...
@@ -120,7 +132,10 @@ hb_subset_plan_create (hb_face_t *face,
{
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_gids_to_retain
(
face
,
plan
->
codepoints
,
plan
->
gids_to_retain
,
plan
->
gids_to_retain_sorted
);
return
plan
;
}
...
...
@@ -143,5 +158,6 @@ hb_subset_plan_destroy (hb_subset_plan_t *plan)
plan
->
codepoints
.
finish
();
plan
->
gids_to_retain
.
finish
();
plan
->
gids_to_retain_sorted
.
finish
();
free
(
plan
);
}
src/hb-subset-plan.hh
浏览文件 @
00894437
...
...
@@ -40,6 +40,7 @@ struct hb_subset_plan_t {
// codepoints is sorted and aligned with gids_to_retain.
hb_auto_array_t
<
hb_codepoint_t
>
codepoints
;
hb_auto_array_t
<
hb_codepoint_t
>
gids_to_retain
;
hb_auto_array_t
<
hb_codepoint_t
>
gids_to_retain_sorted
;
};
typedef
struct
hb_subset_plan_t
hb_subset_plan_t
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录