Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Harfbuzz
提交
962f95cf
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看板
提交
962f95cf
编写于
5月 09, 2019
作者:
G
Garret Rieger
提交者:
Behdad Esfahbod
5月 15, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[subset] Switch SingleSubst to use iterators in serialize.
上级
78d35f0e
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
62 addition
and
41 deletion
+62
-41
src/hb-ot-layout-common.hh
src/hb-ot-layout-common.hh
+3
-3
src/hb-ot-layout-gsub-table.hh
src/hb-ot-layout-gsub-table.hh
+59
-38
未找到文件。
src/hb-ot-layout-common.hh
浏览文件 @
962f95cf
...
...
@@ -804,7 +804,7 @@ struct CoverageFormat1
}
template
<
typename
Iterator
,
hb_requires
(
hb_is_sorted_source_of
(
Iterator
,
hb_codepoint_t
))>
hb_requires
(
hb_is_sorted_source_of
(
Iterator
,
hb_codepoint_t
))>
bool
serialize
(
hb_serialize_context_t
*
c
,
Iterator
glyphs
)
{
TRACE_SERIALIZE
(
this
);
...
...
@@ -873,7 +873,7 @@ struct CoverageFormat2
}
template
<
typename
Iterator
,
hb_requires
(
hb_is_sorted_source_of
(
Iterator
,
hb_codepoint_t
))>
hb_requires
(
hb_is_sorted_source_of
(
Iterator
,
hb_codepoint_t
))>
bool
serialize
(
hb_serialize_context_t
*
c
,
Iterator
glyphs
)
{
TRACE_SERIALIZE
(
this
);
...
...
@@ -1043,7 +1043,7 @@ struct Coverage
}
template
<
typename
Iterator
,
hb_requires
(
hb_is_sorted_source_of
(
Iterator
,
hb_codepoint_t
))>
hb_requires
(
hb_is_sorted_source_of
(
Iterator
,
hb_codepoint_t
))>
bool
serialize
(
hb_serialize_context_t
*
c
,
Iterator
glyphs
)
{
TRACE_SERIALIZE
(
this
);
...
...
src/hb-ot-layout-gsub-table.hh
浏览文件 @
962f95cf
...
...
@@ -34,10 +34,14 @@
namespace
OT
{
typedef
hb_pair_t
<
hb_codepoint_t
,
hb_codepoint_t
>
hb_codepoint_pair_t
;
template
<
typename
Iterator
,
hb_requires
(
hb_is_sorted_source_of
(
Iterator
,
const
hb_codepoint_pair_t
))>
static
inline
void
SingleSubst_serialize
(
hb_serialize_context_t
*
c
,
hb_sorted_array_t
<
const
GlyphID
>
glyphs
,
hb_array_t
<
const
GlyphID
>
substitutes
);
Iterator
it
);
struct
SingleSubstFormat1
{
...
...
@@ -84,8 +88,11 @@ struct SingleSubstFormat1
return_trace
(
true
);
}
template
<
typename
Iterator
,
hb_requires
(
hb_is_sorted_source_of
(
Iterator
,
hb_codepoint_t
))>
bool
serialize
(
hb_serialize_context_t
*
c
,
hb_sorted_array_t
<
const
GlyphID
>
glyphs
,
Iterator
glyphs
,
unsigned
delta
)
{
TRACE_SERIALIZE
(
this
);
...
...
@@ -101,20 +108,18 @@ struct SingleSubstFormat1
const
hb_set_t
&
glyphset
=
*
c
->
plan
->
glyphset
();
const
hb_map_t
&
glyph_map
=
*
c
->
plan
->
glyph_map
;
hb_sorted_vector_t
<
GlyphID
>
from
;
hb_vector_t
<
GlyphID
>
to
;
hb_codepoint_t
delta
=
deltaGlyphID
;
auto
it
=
+
hb_iter
(
this
+
coverage
)
|
hb_filter
(
glyphset
)
|
hb_map
([
&
]
(
hb_codepoint_t
g
)
->
hb_pair_t
<
hb_codepoint_t
,
hb_codepoint_t
>
{
return
hb_pair
<
hb_codepoint_t
,
hb_codepoint_t
>
(
glyph_map
[
g
],
glyph_map
[(
g
+
delta
)
&
0xFFFF
]);
})
|
hb_unzip
(
from
,
to
)
;
|
hb_map
_retains_sorting
([
&
]
(
hb_codepoint_t
g
)
{
return
hb_codepoint_pair_t
(
glyph_map
[
g
],
glyph_map
[(
g
+
delta
)
&
0xFFFF
]);
})
;
c
->
serializer
->
propagate_error
(
from
,
to
);
SingleSubst_serialize
(
c
->
serializer
,
from
,
to
);
return_trace
(
from
.
length
);
SingleSubst_serialize
(
c
->
serializer
,
it
);
return_trace
(
it
.
len
());
}
bool
sanitize
(
hb_sanitize_context_t
*
c
)
const
...
...
@@ -175,11 +180,21 @@ struct SingleSubstFormat2
return_trace
(
true
);
}
template
<
typename
Iterator
,
hb_requires
(
hb_is_sorted_source_of
(
Iterator
,
const
hb_codepoint_pair_t
))>
bool
serialize
(
hb_serialize_context_t
*
c
,
hb_sorted_array_t
<
const
GlyphID
>
glyphs
,
hb_array_t
<
const
GlyphID
>
substitutes
)
Iterator
it
)
{
TRACE_SERIALIZE
(
this
);
auto
substitutes
=
+
it
|
hb_map
(
hb_second
)
;
auto
glyphs
=
+
it
|
hb_map_retains_sorting
(
hb_first
)
;
if
(
unlikely
(
!
c
->
extend_min
(
*
this
)))
return_trace
(
false
);
if
(
unlikely
(
!
substitute
.
serialize
(
c
,
substitutes
)))
return_trace
(
false
);
if
(
unlikely
(
!
coverage
.
serialize
(
c
,
this
).
serialize
(
c
,
glyphs
)))
return_trace
(
false
);
...
...
@@ -192,18 +207,15 @@ struct SingleSubstFormat2
const
hb_set_t
&
glyphset
=
*
c
->
plan
->
glyphset
();
const
hb_map_t
&
glyph_map
=
*
c
->
plan
->
glyph_map
;
hb_sorted_vector_t
<
GlyphID
>
from
;
hb_vector_t
<
GlyphID
>
to
;
auto
it
=
+
hb_zip
(
this
+
coverage
,
substitute
)
|
hb_filter
(
glyphset
,
hb_first
)
|
hb_map
([
&
]
(
hb_pair_t
<
hb_codepoint_t
,
const
GlyphID
&>
p
)
->
hb_pair_t
<
hb_codepoint_t
,
hb_codepoint_t
>
{
return
hb_pair
(
glyph_map
[
p
.
first
],
glyph_map
[
p
.
second
]);
})
|
hb_unzip
(
from
,
to
)
;
|
hb_map
_retains_sorting
([
&
]
(
hb_pair_t
<
hb_codepoint_t
,
const
GlyphID
&>
p
)
->
hb_codepoint_pair_t
{
return
hb_pair
(
glyph_map
[
p
.
first
],
glyph_map
[
p
.
second
]);
})
;
c
->
serializer
->
propagate_error
(
from
,
to
);
SingleSubst_serialize
(
c
->
serializer
,
from
,
to
);
return_trace
(
from
.
length
);
SingleSubst_serialize
(
c
->
serializer
,
it
);
return_trace
(
it
.
len
());
}
bool
sanitize
(
hb_sanitize_context_t
*
c
)
const
...
...
@@ -226,28 +238,33 @@ struct SingleSubstFormat2
struct
SingleSubst
{
template
<
typename
Iterator
,
hb_requires
(
hb_is_sorted_source_of
(
Iterator
,
const
hb_codepoint_pair_t
))>
bool
serialize
(
hb_serialize_context_t
*
c
,
hb_sorted_array_t
<
const
GlyphID
>
glyphs
,
hb_array_t
<
const
GlyphID
>
substitutes
)
Iterator
glyphs
)
{
TRACE_SERIALIZE
(
this
);
if
(
unlikely
(
!
c
->
extend_min
(
u
.
format
)))
return_trace
(
false
);
unsigned
format
=
2
;
unsigned
delta
=
0
;
if
(
glyphs
.
len
gth
)
if
(
glyphs
.
len
()
)
{
format
=
1
;
delta
=
(
unsigned
)
(
substitutes
[
0
]
-
glyphs
[
0
])
&
0xFFFF
;
for
(
unsigned
int
i
=
1
;
i
<
glyphs
.
length
;
i
++
)
if
(
delta
!=
((
unsigned
)
(
substitutes
[
i
]
-
glyphs
[
i
])
&
0xFFFF
))
{
format
=
2
;
break
;
}
auto
get_delta
=
[
=
]
(
hb_codepoint_pair_t
_
)
{
return
(
unsigned
)
(
_
.
second
-
_
.
first
)
&
0xFFFF
;
};
delta
=
get_delta
(
*
glyphs
);
if
(
!
hb_all
(
++
(
+
glyphs
),
delta
,
get_delta
))
format
=
2
;
}
u
.
format
=
format
;
switch
(
u
.
format
)
{
case
1
:
return_trace
(
u
.
format1
.
serialize
(
c
,
glyphs
,
delta
));
case
2
:
return_trace
(
u
.
format2
.
serialize
(
c
,
glyphs
,
substitutes
));
case
1
:
return_trace
(
u
.
format1
.
serialize
(
c
,
+
glyphs
|
hb_map_retains_sorting
(
hb_first
),
delta
));
case
2
:
return_trace
(
u
.
format2
.
serialize
(
c
,
glyphs
));
default:
return_trace
(
false
);
}
}
...
...
@@ -272,11 +289,13 @@ struct SingleSubst
}
u
;
};
template
<
typename
Iterator
,
hb_requires
(
hb_is_sorted_source_of
(
Iterator
,
const
hb_codepoint_pair_t
))>
static
inline
void
SingleSubst_serialize
(
hb_serialize_context_t
*
c
,
hb_sorted_array_t
<
const
GlyphID
>
glyphs
,
hb_array_t
<
const
GlyphID
>
substitutes
)
{
c
->
start_embed
<
SingleSubst
>
()
->
serialize
(
c
,
glyphs
,
substitutes
);
}
Iterator
it
)
{
c
->
start_embed
<
SingleSubst
>
()
->
serialize
(
c
,
it
);
}
struct
Sequence
{
...
...
@@ -1265,7 +1284,9 @@ struct SubstLookup : Lookup
{
TRACE_SERIALIZE
(
this
);
if
(
unlikely
(
!
Lookup
::
serialize
(
c
,
SubTable
::
Single
,
lookup_props
,
1
)))
return_trace
(
false
);
return_trace
(
serialize_subtable
(
c
,
0
).
u
.
single
.
serialize
(
c
,
glyphs
,
substitutes
));
return_trace
(
serialize_subtable
(
c
,
0
).
u
.
single
.
serialize
(
c
,
hb_zip
(
glyphs
,
substitutes
)));
}
bool
serialize_multiple
(
hb_serialize_context_t
*
c
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录