Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Harfbuzz
提交
19afd250
T
Third Party Harfbuzz
项目概览
OpenHarmony
/
Third Party Harfbuzz
接近 2 年 前同步成功
通知
1
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看板
提交
19afd250
编写于
4月 24, 2019
作者:
Q
Qunxin Liu
提交者:
Garret Rieger
4月 26, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[subset] Update to use _subset2() for name table
上级
1ca4b5c7
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
12 addition
and
39 deletion
+12
-39
src/hb-ot-name-table.hh
src/hb-ot-name-table.hh
+10
-37
src/hb-subset.cc
src/hb-subset.cc
+2
-2
未找到文件。
src/hb-ot-name-table.hh
浏览文件 @
19afd250
...
...
@@ -158,32 +158,19 @@ struct name
unsigned
int
get_size
()
const
{
return
min_size
+
count
*
nameRecordZ
.
item_size
;
}
size_t
get_subsetted_size
(
const
name
*
source_name
,
void
get_subsetted_ids
(
const
name
*
source_name
,
const
hb_subset_plan_t
*
plan
,
hb_vector_t
<
unsigned
int
>&
name_record_idx_to_retain
)
const
{
size_t
result
=
min_size
;
hb_face_t
*
face
=
plan
->
source
;
accelerator_t
acc
;
acc
.
init
(
face
);
for
(
unsigned
int
i
=
0
;
i
<
count
;
i
++
)
{
if
(
format
==
0
&&
(
unsigned
int
)
nameRecordZ
[
i
].
nameID
>
25
)
if
(
format
==
0
&&
(
unsigned
int
)
source_name
->
nameRecordZ
[
i
].
nameID
>
25
)
continue
;
if
(
!
hb_set_is_empty
(
plan
->
name_ids
)
&&
!
hb_set_has
(
plan
->
name_ids
,
source_name
->
nameRecordZ
[
i
].
nameID
))
continue
;
result
+=
acc
.
get_name
(
i
).
get_size
();
name_record_idx_to_retain
.
push
(
i
);
}
acc
.
fini
();
result
+=
name_record_idx_to_retain
.
length
*
NameRecord
::
static_size
;
return
result
;
}
bool
serialize_name_record
(
hb_serialize_context_t
*
c
,
...
...
@@ -294,36 +281,22 @@ struct name
return_trace
(
true
);
}
bool
subset
(
hb_subset_
plan_t
*
plan
)
const
bool
subset
(
hb_subset_
context_t
*
c
)
const
{
hb_subset_plan_t
*
plan
=
c
->
plan
;
hb_vector_t
<
unsigned
int
>
name_record_idx_to_retain
;
size_t
dest_size
=
get_subsetted_size
(
this
,
plan
,
name_record_idx_to_retain
);
name
*
dest
=
(
name
*
)
malloc
(
dest_size
);
if
(
unlikely
(
!
dest
))
{
DEBUG_MSG
(
SUBSET
,
nullptr
,
"Unable to alloc %lu for name subset output."
,
(
unsigned
long
)
dest_size
);
return
false
;
}
get_subsetted_ids
(
this
,
plan
,
name_record_idx_to_retain
);
hb_serialize_context_t
c
(
dest
,
dest_size
)
;
name
*
name_prime
=
c
.
start_serialize
<
name
>
();
if
(
!
name_prime
||
!
name_prime
->
serialize
(
&
c
,
this
,
plan
,
name_record_idx_to_retain
))
hb_serialize_context_t
*
serializer
=
c
->
serializer
;
name
*
name_prime
=
serializer
->
start_embed
<
name
>
();
if
(
!
name_prime
||
!
name_prime
->
serialize
(
serializer
,
this
,
plan
,
name_record_idx_to_retain
))
{
free
(
dest
);
DEBUG_MSG
(
SUBSET
,
nullptr
,
"Failed to serialize write new name."
);
c
.
end_serialize
();
return
false
;
}
c
.
end_serialize
();
hb_blob_t
*
name_prime_blob
=
c
.
copy_blob
();
bool
result
=
plan
->
add_table
(
HB_OT_TAG_name
,
name_prime_blob
);
hb_blob_destroy
(
name_prime_blob
);
return
result
;
return
true
;
}
bool
sanitize_records
(
hb_sanitize_context_t
*
c
)
const
...
...
src/hb-subset.cc
浏览文件 @
19afd250
...
...
@@ -88,7 +88,6 @@ _subset2 (hb_subset_plan_t *plan)
serializer
.
start_serialize
<
TableType
>
();
hb_subset_context_t
c
(
plan
,
&
serializer
);
result
=
table
->
subset
(
&
c
);
serializer
.
end_serialize
();
if
(
serializer
.
ran_out_of_room
)
{
buf_size
+=
(
buf_size
>>
1
)
+
32
;
...
...
@@ -105,6 +104,7 @@ _subset2 (hb_subset_plan_t *plan)
abort
();
}
serializer
.
end_serialize
();
if
(
result
)
{
hb_blob_t
*
dest_blob
=
serializer
.
copy_blob
();
...
...
@@ -160,7 +160,7 @@ _subset_table (hb_subset_plan_t *plan,
result
=
_subset
<
const
OT
::
hdmx
>
(
plan
);
break
;
case
HB_OT_TAG_name
:
result
=
_subset
<
const
OT
::
name
>
(
plan
);
result
=
_subset
2
<
const
OT
::
name
>
(
plan
);
break
;
case
HB_OT_TAG_head
:
// TODO that won't work well if there is no glyf
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录