Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Harfbuzz
提交
59ee61fd
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,发现更多精彩内容 >>
提交
59ee61fd
编写于
5月 07, 2019
作者:
B
Behdad Esfahbod
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[name] Use iterators more
上级
2eb7e0e0
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
18 addition
and
31 deletion
+18
-31
src/hb-ot-name-table.hh
src/hb-ot-name-table.hh
+15
-31
src/hb-subset-plan.cc
src/hb-subset-plan.cc
+3
-0
未找到文件。
src/hb-ot-name-table.hh
浏览文件 @
59ee61fd
...
@@ -169,44 +169,34 @@ struct name
...
@@ -169,44 +169,34 @@ struct name
unsigned
int
get_size
()
const
unsigned
int
get_size
()
const
{
return
min_size
+
count
*
nameRecordZ
.
item_size
;
}
{
return
min_size
+
count
*
nameRecordZ
.
item_size
;
}
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
{
for
(
unsigned
int
i
=
0
;
i
<
count
;
i
++
)
{
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
;
name_record_idx_to_retain
.
push
(
i
);
}
}
bool
serialize
(
hb_serialize_context_t
*
c
,
bool
serialize
(
hb_serialize_context_t
*
c
,
const
name
*
source_name
,
const
name
*
source_name
,
const
hb_subset_plan_t
*
plan
,
const
hb_subset_plan_t
*
plan
)
const
hb_sorted_vector_t
<
unsigned
int
>&
name_record_idx_to_retain
)
{
{
TRACE_SERIALIZE
(
this
);
TRACE_SERIALIZE
(
this
);
if
(
unlikely
(
!
c
->
extend_min
((
*
this
))))
return_trace
(
false
);
if
(
unlikely
(
!
c
->
extend_min
((
*
this
))))
return_trace
(
false
);
auto
src_array
=
source_name
->
nameRecordZ
.
as_array
(
source_name
->
count
);
auto
it
=
+
src_array
|
hb_filter
(
plan
->
name_ids
,
&
NameRecord
::
nameID
)
;
this
->
format
=
0
;
this
->
format
=
0
;
this
->
count
=
name_record_idx_to_retain
.
length
;
this
->
count
=
it
.
len
()
;
auto
snap
=
c
->
snapshot
();
auto
snap
=
c
->
snapshot
();
this
->
nameRecordZ
.
serialize
(
c
,
this
->
count
);
this
->
nameRecordZ
.
serialize
(
c
,
this
->
count
);
this
->
stringOffset
=
c
->
length
();
this
->
stringOffset
=
c
->
length
();
c
->
revert
(
snap
);
c
->
revert
(
snap
);
auto
src_array
=
source_name
->
nameRecordZ
.
as_array
(
source_name
->
count
);
const
void
*
src_base
=
&
(
source_name
+
source_name
->
stringOffset
);
const
void
*
src_base
=
&
(
source_name
+
source_name
->
stringOffset
);
const
void
*
dst_base
=
&
(
this
+
this
->
stringOffset
);
const
void
*
dst_base
=
&
(
this
+
this
->
stringOffset
);
+
hb_iter
(
name_record_idx_to_retain
)
+
it
|
hb_apply
([
&
]
(
unsigned
_
)
{
c
->
copy
(
src_array
[
_
]
,
src_base
,
dst_base
);
})
|
hb_apply
([
&
]
(
const
NameRecord
&
_
)
{
c
->
copy
(
_
,
src_base
,
dst_base
);
})
;
;
if
(
unlikely
(
c
->
ran_out_of_room
))
return_trace
(
false
);
if
(
unlikely
(
c
->
ran_out_of_room
))
return_trace
(
false
);
...
@@ -218,20 +208,14 @@ struct name
...
@@ -218,20 +208,14 @@ struct name
bool
subset
(
hb_subset_context_t
*
c
)
const
bool
subset
(
hb_subset_context_t
*
c
)
const
{
{
TRACE_SUBSET
(
this
);
hb_subset_plan_t
*
plan
=
c
->
plan
;
hb_subset_plan_t
*
plan
=
c
->
plan
;
hb_sorted_vector_t
<
unsigned
int
>
name_record_idx_to_retain
;
get_subsetted_ids
(
this
,
plan
,
name_record_idx_to_retain
);
hb_serialize_context_t
*
serializer
=
c
->
serializer
;
hb_serialize_context_t
*
serializer
=
c
->
serializer
;
name
*
name_prime
=
serializer
->
start_embed
<
name
>
();
name
*
name_prime
=
serializer
->
start_embed
<
name
>
();
if
(
!
name_prime
||
!
name_prime
->
serialize
(
serializer
,
this
,
plan
,
name_record_idx_to_retain
))
if
(
unlikely
(
!
name_prime
))
return_trace
(
false
);
{
name_prime
->
serialize
(
serializer
,
this
,
plan
);
DEBUG_MSG
(
SUBSET
,
nullptr
,
"Failed to serialize write new name."
);
return_trace
(
name_prime
->
count
);
return
false
;
}
return
true
;
}
}
bool
sanitize_records
(
hb_sanitize_context_t
*
c
)
const
bool
sanitize_records
(
hb_sanitize_context_t
*
c
)
const
...
...
src/hb-subset-plan.cc
浏览文件 @
59ee61fd
...
@@ -207,6 +207,9 @@ hb_subset_plan_create (hb_face_t *face,
...
@@ -207,6 +207,9 @@ hb_subset_plan_create (hb_face_t *face,
plan
->
retain_gids
=
input
->
retain_gids
;
plan
->
retain_gids
=
input
->
retain_gids
;
plan
->
unicodes
=
hb_set_create
();
plan
->
unicodes
=
hb_set_create
();
plan
->
name_ids
=
hb_set_reference
(
input
->
name_ids
);
plan
->
name_ids
=
hb_set_reference
(
input
->
name_ids
);
/* TODO Clean this up... */
if
(
hb_set_is_empty
(
plan
->
name_ids
))
hb_set_add_range
(
plan
->
name_ids
,
0
,
0x7FFF
);
plan
->
source
=
hb_face_reference
(
face
);
plan
->
source
=
hb_face_reference
(
face
);
plan
->
dest
=
hb_face_builder_create
();
plan
->
dest
=
hb_face_builder_create
();
plan
->
codepoint_to_glyph
=
hb_map_create
();
plan
->
codepoint_to_glyph
=
hb_map_create
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录