Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Harfbuzz
提交
349d692b
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看板
提交
349d692b
编写于
5月 21, 2019
作者:
R
Rod Sheeter
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[subset] Iter in and out for loca
上级
95445d79
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
18 addition
and
20 deletion
+18
-20
src/hb-ot-glyf-table.hh
src/hb-ot-glyf-table.hh
+16
-15
test/api/hb-test.h
test/api/hb-test.h
+2
-5
未找到文件。
src/hb-ot-glyf-table.hh
浏览文件 @
349d692b
...
...
@@ -81,21 +81,23 @@ struct glyf
}
template
<
typename
Iterator
,
hb_requires
(
hb_is_source_of
(
Iterator
,
unsigned
int
))>
static
void
hb_requires
(
hb_is_source_of
(
Iterator
,
unsigned
int
))>
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
()
+
1
)
*
(
use_short_loca
?
2
:
4
);
unsigned
int
loca_prime_size
=
padded_offsets
.
len
(
)
*
(
use_short_loca
?
2
:
4
);
char
*
loca_prime_data
=
(
char
*
)
calloc
(
1
,
loca_prime_size
);
if
(
unlikely
(
!
loca_prime_data
))
return
false
;
if
(
use_short_loca
)
_write_loca
<
decltype
(
padded_offsets
),
HBUINT16
>
(
padded_offsets
,
1
,
loca_prime_data
);
_write_loca
<
decltype
(
padded_offsets
),
HBUINT16
>
(
padded_offsets
,
1
,
hb_array_t
<
HBUINT16
>
((
HBUINT16
*
)
loca_prime_data
,
padded_offsets
.
len
())
);
else
_write_loca
<
decltype
(
padded_offsets
),
HBUINT32
>
(
padded_offsets
,
0
,
loca_prime_data
);
_write_loca
<
decltype
(
padded_offsets
),
HBUINT32
>
(
padded_offsets
,
0
,
hb_array_t
<
HBUINT32
>
((
HBUINT32
*
)
loca_prime_data
,
padded_offsets
.
len
())
);
hb_blob_t
*
loca_blob
=
hb_blob_create
(
loca_prime_data
,
loca_prime_size
,
...
...
@@ -107,14 +109,15 @@ struct glyf
_add_head_and_set_loca_version
(
plan
,
use_short_loca
);
hb_blob_destroy
(
loca_blob
);
return
true
;
}
template
<
typename
Iterator
,
typename
EntryType
,
hb_requires
(
hb_is_source_of
(
Iterator
,
unsigned
int
))>
template
<
typename
IteratorIn
,
typename
EntryType
,
typename
IteratorOut
,
hb_requires
(
hb_is_source_of
(
IteratorIn
,
unsigned
int
)),
hb_requires
(
hb_is_source_of
(
IteratorOut
,
EntryType
))>
static
void
_write_loca
(
Iterator
it
,
unsigned
right_shift
,
char
*
dest
)
_write_loca
(
Iterator
In
it
,
unsigned
right_shift
,
IteratorOut
dest
)
{
hb_array_t
<
EntryType
>
entries
((
EntryType
*
)
dest
,
it
.
len
()
+
1
);
unsigned
int
offset
=
0
;
+
it
|
hb_map
([
&
]
(
unsigned
int
padded_size
)
{
...
...
@@ -123,10 +126,7 @@ struct glyf
offset
+=
padded_size
;
return
result
;
})
|
hb_sink
(
hb_iter
(
entries
));
// one bonus element so loca[numGlyphs] - loca[numGlyphs -1] is size of last glyph
entries
.
arrayZ
[
entries
.
length
-
1
]
=
offset
>>
right_shift
;
DEBUG_MSG
(
SUBSET
,
nullptr
,
"loca entry offset %d"
,
(
int16_t
)
entries
.
arrayZ
[
entries
.
length
-
1
]);
|
hb_sink
(
dest
);
}
// requires source of SubsetGlyph complains the identifier isn't declared
...
...
@@ -163,9 +163,10 @@ struct glyf
|
hb_map
([
&
]
(
const
SubsetGlyph
&
_
)
{
return
_
.
padded_size
();
})
|
hb_sink
(
padded_offsets
);
_add_loca_and_head
(
c
->
plan
,
hb_iter
(
padded_offsets
));
// loca ends with a final entry == last offset (+0)
padded_offsets
<<
0
;
return_trace
(
true
);
return_trace
(
c
->
serializer
->
check_success
(
_add_loca_and_head
(
c
->
plan
,
hb_iter
(
padded_offsets
)))
);
}
template
<
typename
SubsetGlyph
>
...
...
test/api/hb-test.h
浏览文件 @
349d692b
...
...
@@ -179,11 +179,8 @@ static inline void hb_test_assert_blobs_equal (hb_blob_t *expected_blob, hb_blob
{
int
expected
=
*
(
raw_expected
+
i
);
int
actual
=
*
(
raw_actual
+
i
);
if
(
expected
!=
actual
)
{
fprintf
(
stderr
,
"+%d %02x != %02x
\n
"
,
i
,
expected
,
actual
);
}
if
(
expected
!=
actual
)
fprintf
(
stderr
,
"+%d %02x != %02x
\n
"
,
i
,
expected
,
actual
);
else
fprintf
(
stderr
,
"+%d %02x
\n
"
,
i
,
expected
);
}
}
g_assert_cmpint
(
0
,
==
,
memcmp
(
raw_expected
,
raw_actual
,
expected_length
));
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录