Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Harfbuzz
提交
14e3b0cf
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看板
提交
14e3b0cf
编写于
5月 21, 2019
作者:
R
Rod Sheeter
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[subset] Code review feedback
上级
4ea44112
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
27 addition
and
26 deletion
+27
-26
src/hb-ot-glyf-table.hh
src/hb-ot-glyf-table.hh
+27
-26
未找到文件。
src/hb-ot-glyf-table.hh
浏览文件 @
14e3b0cf
...
...
@@ -85,23 +85,22 @@ struct glyf
static
bool
_add_loca_and_head
(
hb_subset_plan_t
*
plan
,
Iterator
padded_offsets
)
{
unsigned
int
max_offset
=
+
padded_offsets
|
hb_reduce
(
hb_max
,
0
);
bool
use_short_loca
=
max_offset
<=
131070
;
unsigned
int
loca_prime_size
=
padded_offsets
.
len
()
*
(
use_short_loca
?
2
:
4
);
char
*
loca_prime_data
=
(
char
*
)
calloc
(
1
,
loca_prime_size
);
unsigned
int
max_offset
=
+
padded_offsets
|
hb_reduce
(
hb_max
,
0
);
unsigned
num_offsets
=
padded_offsets
.
len
()
+
1
;
bool
use_short_loca
=
max_offset
<
0x1FFFF
;
unsigned
entry_size
=
use_short_loca
?
2
:
4
;
char
*
loca_prime_data
=
(
char
*
)
calloc
(
entry_size
,
num_offsets
);
if
(
unlikely
(
!
loca_prime_data
))
return
false
;
if
(
use_short_loca
)
_write_loca
<
decltype
(
padded_offsets
),
HBUINT16
>
(
padded_offsets
,
1
,
hb_array_t
<
HBUINT16
>
((
HBUINT16
*
)
loca_prime_data
,
padded_offsets
.
len
()
));
_write_loca
<
HBUINT16
>
(
padded_offsets
,
1
,
hb_array_t
<
HBUINT16
>
((
HBUINT16
*
)
loca_prime_data
,
num_offsets
));
else
_write_loca
<
decltype
(
padded_offsets
),
HBUINT32
>
(
padded_offsets
,
0
,
hb_array_t
<
HBUINT32
>
((
HBUINT32
*
)
loca_prime_data
,
padded_offsets
.
len
()
));
_write_loca
<
HBUINT32
>
(
padded_offsets
,
0
,
hb_array_t
<
HBUINT32
>
((
HBUINT32
*
)
loca_prime_data
,
num_offsets
));
hb_blob_t
*
loca_blob
=
hb_blob_create
(
loca_prime_data
,
loca_prime_size
,
HB_MEMORY_MODE_
READONLY
,
entry_size
*
num_offsets
,
HB_MEMORY_MODE_
WRITABLE
,
loca_prime_data
,
free
);
...
...
@@ -112,21 +111,24 @@ struct glyf
return
true
;
}
template
<
typename
IteratorIn
,
typename
EntryType
,
typename
IteratorOut
,
template
<
typename
EntryType
,
typename
IteratorIn
,
typename
IteratorOut
,
hb_requires
(
hb_is_source_of
(
IteratorIn
,
unsigned
int
)),
hb_requires
(
hb_is_s
ource
_of
(
IteratorOut
,
EntryType
))>
hb_requires
(
hb_is_s
ink
_of
(
IteratorOut
,
EntryType
))>
static
void
_write_loca
(
IteratorIn
it
,
unsigned
right_shift
,
IteratorOut
dest
)
{
unsigned
int
offset
=
0
;
+
it
|
hb_map
([
&
]
(
unsigned
int
padded_size
)
{
unsigned
int
result
=
offset
>>
right_shift
;
DEBUG_MSG
(
SUBSET
,
nullptr
,
"loca entry offset %d
shifted %d"
,
offset
,
resul
t
);
|
hb_map
([
=
,
&
offset
]
(
unsigned
int
padded_size
)
{
unsigned
result
=
offset
>>
right_shift
;
DEBUG_MSG
(
SUBSET
,
nullptr
,
"loca entry offset %d
"
,
offse
t
);
offset
+=
padded_size
;
return
result
;
})
|
hb_sink
(
dest
);
|
hb_sink
(
dest
)
;
DEBUG_MSG
(
SUBSET
,
nullptr
,
"loca entry offset %d"
,
offset
);
dest
<<
(
offset
>>
right_shift
);
}
// requires source of SubsetGlyph complains the identifier isn't declared
...
...
@@ -138,7 +140,8 @@ struct glyf
TRACE_SERIALIZE
(
this
);
+
it
|
hb_apply
(
[
&
]
(
const
SubsetGlyph
&
_
)
{
_
.
serialize
(
c
,
plan
);
});
|
hb_apply
([
=
]
(
const
SubsetGlyph
&
_
)
{
_
.
serialize
(
c
,
plan
);
})
;
return_trace
(
true
);
}
...
...
@@ -148,7 +151,7 @@ struct glyf
TRACE_SUBSET
(
this
);
glyf
*
glyf_prime
=
c
->
serializer
->
start_embed
<
glyf
>
();
if
(
unlikely
(
!
glyf_prime
))
return_trace
(
false
);
if
(
unlikely
(
!
c
->
serializer
->
check_success
(
glyf_prime
)
))
return_trace
(
false
);
// Byte region(s) per glyph to output
// unpadded, hints removed if so requested
...
...
@@ -158,15 +161,12 @@ struct glyf
glyf_prime
->
serialize
(
c
->
serializer
,
hb_iter
(
glyphs
),
c
->
plan
);
hb_vector_t
<
unsigned
int
>
padded_offsets
;
auto
padded_offsets
=
+
hb_iter
(
glyphs
)
|
hb_map
(
[
&
]
(
const
SubsetGlyph
&
_
)
{
return
_
.
padded_size
();
}
)
|
hb_sink
(
padded_offsets
)
;
|
hb_map
(
&
SubsetGlyph
::
padded_size
)
;
// loca ends with a final entry == last offset (+0)
padded_offsets
<<
0
;
return_trace
(
c
->
serializer
->
check_success
(
_add_loca_and_head
(
c
->
plan
,
hb_iter
(
padded_offsets
))));
return_trace
(
c
->
serializer
->
check_success
(
_add_loca_and_head
(
c
->
plan
,
padded_offsets
)));
}
template
<
typename
SubsetGlyph
>
...
...
@@ -191,7 +191,8 @@ struct glyf
return
subset_glyph
;
})
|
hb_sink
(
glyphs
);
|
hb_sink
(
glyphs
)
;
glyf
.
fini
();
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录