Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Harfbuzz
提交
74c44ffe
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看板
提交
74c44ffe
编写于
1月 28, 2019
作者:
G
Garret Rieger
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[subset] Update hb-subset-glyf.cc to use new hb-subset-plan API.
上级
4842294b
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
22 addition
and
35 deletion
+22
-35
src/hb-subset-glyf.cc
src/hb-subset-glyf.cc
+22
-35
未找到文件。
src/hb-subset-glyf.cc
浏览文件 @
74c44ffe
...
...
@@ -58,21 +58,6 @@ struct loca_data_t
size
);
return
false
;
}
inline
bool
_add_empty_glyphs_to_loca
(
hb_codepoint_t
from_gid
,
hb_codepoint_t
to_gid
,
unsigned
int
offset
)
{
bool
success
=
true
;
while
(
from_gid
<
to_gid
)
{
success
=
success
&&
_write_loca_entry
(
from_gid
,
offset
);
from_gid
++
;
}
return
success
;
}
};
/**
...
...
@@ -119,10 +104,10 @@ _calculate_glyf_and_loca_prime_size (const OT::glyf::accelerator_t &glyf,
hb_vector_t
<
unsigned
int
>
*
instruction_ranges
/* OUT */
)
{
unsigned
int
total
=
0
;
for
(
unsigned
int
i
=
0
;
i
<
plan
->
glyphs
.
length
;
i
++
)
{
hb_codepoint_t
next_glyph
=
plan
->
glyphs
[
i
];
hb_codepoint_t
next_glyph
=
HB_SET_VALUE_INVALID
;
while
(
plan
->
glyphset
()
->
next
(
&
next_glyph
))
{
unsigned
int
start_offset
,
end_offset
;
if
(
unlikely
(
!
(
glyf
.
get_offsets
(
next_glyph
,
&
start_offset
,
&
end_offset
)
&&
glyf
.
remove_padding
(
start_offset
,
&
end_offset
))))
...
...
@@ -152,7 +137,7 @@ _calculate_glyf_and_loca_prime_size (const OT::glyf::accelerator_t &glyf,
*
glyf_size
=
total
;
loca_data
->
is_short
=
(
total
<=
131070
);
loca_data
->
size
=
(
plan
->
num_
glyphs
+
1
)
loca_data
->
size
=
(
plan
->
num_
output_glyphs
()
+
1
)
*
(
loca_data
->
is_short
?
sizeof
(
OT
::
HBUINT16
)
:
sizeof
(
OT
::
HBUINT32
));
DEBUG_MSG
(
SUBSET
,
nullptr
,
"preparing to subset glyf: final size %d, loca size %d, using %s loca"
,
...
...
@@ -207,26 +192,27 @@ _write_glyf_and_loca_prime (const hb_subset_plan_t *plan,
char
*
glyf_prime_data
/* OUT */
,
loca_data_t
*
loca_prime
/* OUT */
)
{
const
hb_vector_t
<
hb_codepoint_t
>
&
glyph_ids
=
plan
->
glyphs
;
char
*
glyf_prime_data_next
=
glyf_prime_data
;
bool
success
=
true
;
unsigned
int
current_gid
=
0
;
for
(
unsigned
int
i
=
0
;
i
<
glyph_ids
.
length
;
i
++
)
unsigned
int
i
=
0
;
hb_codepoint_t
new_gid
;
for
(
new_gid
=
0
;
new_gid
<
plan
->
num_output_glyphs
();
new_gid
++
)
{
hb_codepoint_t
next_gid
=
current_gid
;
success
=
success
&&
plan
->
new_gid_for_old_gid
(
glyph_ids
[
i
],
&
next_gid
);
hb_codepoint_t
old_gid
;
if
(
!
plan
->
old_gid_for_new_gid
(
new_gid
,
&
old_gid
))
{
// Empty glyph, add a loca entry and carry on.
loca_prime
->
_write_loca_entry
(
new_gid
,
glyf_prime_data_next
-
glyf_prime_data
);
continue
;
}
// If we are retaining existing gids then there will potentially be gaps
// in the loca table between glyphs. Fill in this gap with glyphs that have
// no outlines.
success
=
success
&&
loca_prime
->
_add_empty_glyphs_to_loca
(
current_gid
,
next_gid
,
glyf_prime_data_next
-
glyf_prime_data
);
current_gid
=
next_gid
;
unsigned
int
start_offset
,
end_offset
;
if
(
unlikely
(
!
(
glyf
.
get_offsets
(
glyph_ids
[
i
]
,
&
start_offset
,
&
end_offset
)
&&
if
(
unlikely
(
!
(
glyf
.
get_offsets
(
old_gid
,
&
start_offset
,
&
end_offset
)
&&
glyf
.
remove_padding
(
start_offset
,
&
end_offset
))))
end_offset
=
start_offset
=
0
;
...
...
@@ -260,18 +246,19 @@ _write_glyf_and_loca_prime (const hb_subset_plan_t *plan,
memset
(
glyf_prime_data_next
+
instruction_start
-
start_offset
-
2
,
0
,
2
);
}
success
=
success
&&
loca_prime
->
_write_loca_entry
(
current
_gid
,
success
=
success
&&
loca_prime
->
_write_loca_entry
(
new
_gid
,
glyf_prime_data_next
-
glyf_prime_data
);
_update_components
(
plan
,
glyf_prime_data_next
,
length
);
// TODO: don't align to two bytes if using long loca.
glyf_prime_data_next
+=
length
+
(
length
%
2
);
// Align to 2 bytes for short loca.
current_gid
++
;
i
++
;
}
// loca table has n+1 entries where the last entry signifies the end location of the last
// glyph.
success
=
success
&&
loca_prime
->
_write_loca_entry
(
current
_gid
,
success
=
success
&&
loca_prime
->
_write_loca_entry
(
new
_gid
,
glyf_prime_data_next
-
glyf_prime_data
);
return
success
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录