Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Harfbuzz
提交
44fc237b
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,发现更多精彩内容 >>
提交
44fc237b
编写于
11月 21, 2012
作者:
B
Behdad Esfahbod
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[OTLayout] Port closure() to process() template
上级
5be86b1b
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
171 addition
and
345 deletion
+171
-345
src/hb-ot-layout-gsub-table.hh
src/hb-ot-layout-gsub-table.hh
+67
-230
src/hb-ot-layout-gsubgpos-private.hh
src/hb-ot-layout-gsubgpos-private.hh
+100
-109
src/hb-ot-layout.cc
src/hb-ot-layout.cc
+4
-6
未找到文件。
src/hb-ot-layout-gsub-table.hh
浏览文件 @
44fc237b
...
...
@@ -37,10 +37,6 @@ namespace OT {
struct
SingleSubstFormat1
{
friend
struct
SingleSubst
;
private:
inline
void
closure
(
hb_closure_context_t
*
c
)
const
{
TRACE_CLOSURE
();
...
...
@@ -112,10 +108,6 @@ struct SingleSubstFormat1
struct
SingleSubstFormat2
{
friend
struct
SingleSubst
;
private:
inline
void
closure
(
hb_closure_context_t
*
c
)
const
{
TRACE_CLOSURE
();
...
...
@@ -186,28 +178,13 @@ struct SingleSubstFormat2
struct
SingleSubst
{
friend
struct
SubstLookupSubTable
;
friend
struct
SubstLookup
;
private:
inline
void
closure
(
hb_closure_context_t
*
c
)
const
template
<
typename
context_t
>
inline
typename
context_t
::
return_t
process
(
context_t
*
c
)
const
{
TRACE_CLOSURE
();
switch
(
u
.
format
)
{
case
1
:
u
.
format1
.
closure
(
c
);
break
;
case
2
:
u
.
format2
.
closure
(
c
);
break
;
default:
break
;
}
}
inline
void
collect_glyphs
(
hb_collect_glyphs_context_t
*
c
)
const
{
TRACE_CLOSURE
();
switch
(
u
.
format
)
{
case
1
:
u
.
format1
.
collect_glyphs
(
c
);
break
;
case
2
:
u
.
format2
.
collect_glyphs
(
c
);
break
;
default:
break
;
case
1
:
return
c
->
process
(
u
.
format1
);
case
2
:
return
c
->
process
(
u
.
format2
);
default:
return
c
->
default_return_value
;
}
}
...
...
@@ -278,10 +255,6 @@ struct SingleSubst
struct
Sequence
{
friend
struct
MultipleSubstFormat1
;
private:
inline
void
closure
(
hb_closure_context_t
*
c
)
const
{
TRACE_CLOSURE
();
...
...
@@ -323,7 +296,6 @@ struct Sequence
return
TRACE_RETURN
(
true
);
}
public:
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
)
{
TRACE_SANITIZE
();
return
TRACE_RETURN
(
substitute
.
sanitize
(
c
));
...
...
@@ -338,10 +310,6 @@ struct Sequence
struct
MultipleSubstFormat1
{
friend
struct
MultipleSubst
;
private:
inline
void
closure
(
hb_closure_context_t
*
c
)
const
{
TRACE_CLOSURE
();
...
...
@@ -412,25 +380,12 @@ struct MultipleSubstFormat1
struct
MultipleSubst
{
friend
struct
SubstLookupSubTable
;
friend
struct
SubstLookup
;
private:
inline
void
closure
(
hb_closure_context_t
*
c
)
const
{
TRACE_CLOSURE
();
switch
(
u
.
format
)
{
case
1
:
u
.
format1
.
closure
(
c
);
break
;
default:
break
;
}
}
inline
void
collect_glyphs
(
hb_collect_glyphs_context_t
*
c
)
const
template
<
typename
context_t
>
inline
typename
context_t
::
return_t
process
(
context_t
*
c
)
const
{
switch
(
u
.
format
)
{
case
1
:
u
.
format1
.
collect_glyphs
(
c
);
break
;
default:
break
;
case
1
:
return
c
->
process
(
u
.
format1
)
;
default:
return
c
->
default_return_value
;
}
}
...
...
@@ -489,10 +444,6 @@ typedef ArrayOf<GlyphID> AlternateSet; /* Array of alternate GlyphIDs--in
struct
AlternateSubstFormat1
{
friend
struct
AlternateSubst
;
private:
inline
void
closure
(
hb_closure_context_t
*
c
)
const
{
TRACE_CLOSURE
();
...
...
@@ -589,25 +540,12 @@ struct AlternateSubstFormat1
struct
AlternateSubst
{
friend
struct
SubstLookupSubTable
;
friend
struct
SubstLookup
;
private:
inline
void
closure
(
hb_closure_context_t
*
c
)
const
template
<
typename
context_t
>
inline
typename
context_t
::
return_t
process
(
context_t
*
c
)
const
{
TRACE_CLOSURE
();
switch
(
u
.
format
)
{
case
1
:
u
.
format1
.
closure
(
c
);
break
;
default:
break
;
}
}
inline
void
collect_glyphs
(
hb_collect_glyphs_context_t
*
c
)
const
{
switch
(
u
.
format
)
{
case
1
:
u
.
format1
.
collect_glyphs
(
c
);
break
;
default:
break
;
case
1
:
return
c
->
process
(
u
.
format1
);
default:
return
c
->
default_return_value
;
}
}
...
...
@@ -663,10 +601,6 @@ struct AlternateSubst
struct
Ligature
{
friend
struct
LigatureSet
;
private:
inline
void
closure
(
hb_closure_context_t
*
c
)
const
{
TRACE_CLOSURE
();
...
...
@@ -761,10 +695,6 @@ struct Ligature
struct
LigatureSet
{
friend
struct
LigatureSubstFormat1
;
private:
inline
void
closure
(
hb_closure_context_t
*
c
)
const
{
TRACE_CLOSURE
();
...
...
@@ -824,7 +754,6 @@ struct LigatureSet
return
TRACE_RETURN
(
true
);
}
public:
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
)
{
TRACE_SANITIZE
();
return
TRACE_RETURN
(
ligature
.
sanitize
(
c
,
this
));
...
...
@@ -840,10 +769,6 @@ struct LigatureSet
struct
LigatureSubstFormat1
{
friend
struct
LigatureSubst
;
private:
inline
void
closure
(
hb_closure_context_t
*
c
)
const
{
TRACE_CLOSURE
();
...
...
@@ -926,25 +851,12 @@ struct LigatureSubstFormat1
struct
LigatureSubst
{
friend
struct
SubstLookupSubTable
;
friend
struct
SubstLookup
;
private:
inline
void
closure
(
hb_closure_context_t
*
c
)
const
{
TRACE_CLOSURE
();
switch
(
u
.
format
)
{
case
1
:
u
.
format1
.
closure
(
c
);
break
;
default:
break
;
}
}
inline
void
collect_glyphs
(
hb_collect_glyphs_context_t
*
c
)
const
template
<
typename
context_t
>
inline
typename
context_t
::
return_t
process
(
context_t
*
c
)
const
{
switch
(
u
.
format
)
{
case
1
:
u
.
format1
.
collect_glyphs
(
c
);
break
;
default:
break
;
case
1
:
return
c
->
process
(
u
.
format1
)
;
default:
return
c
->
default_return_value
;
}
}
...
...
@@ -1010,24 +922,13 @@ struct LigatureSubst
static
inline
bool
substitute_lookup
(
hb_apply_context_t
*
c
,
unsigned
int
lookup_index
);
static
inline
void
closure_lookup
(
hb_closure_context_t
*
c
,
unsigned
int
lookup_index
);
static
inline
void
collect_glyphs_lookup
(
hb_collect_glyphs_context_t
*
c
,
unsigned
int
lookup_index
);
struct
ContextSubst
:
Context
{
friend
struct
SubstLookupSubTable
;
private:
inline
void
closure
(
hb_closure_context_t
*
c
)
const
template
<
typename
context_t
>
inline
typename
context_t
::
return_t
process
(
context_t
*
c
)
const
{
TRACE_CLOSURE
();
return
Context
::
closure
(
c
,
closure_lookup
);
}
inline
void
collect_glyphs
(
hb_collect_glyphs_context_t
*
c
)
const
{
return
Context
::
collect_glyphs
(
c
,
collect_glyphs_lookup
);
return
Context
::
process
(
c
);
}
inline
bool
apply
(
hb_apply_context_t
*
c
)
const
...
...
@@ -1039,19 +940,10 @@ struct ContextSubst : Context
struct
ChainContextSubst
:
ChainContext
{
friend
struct
SubstLookupSubTable
;
private:
inline
void
closure
(
hb_closure_context_t
*
c
)
const
template
<
typename
context_t
>
inline
typename
context_t
::
return_t
process
(
context_t
*
c
)
const
{
TRACE_CLOSURE
();
return
ChainContext
::
closure
(
c
,
closure_lookup
);
}
inline
void
collect_glyphs
(
hb_collect_glyphs_context_t
*
c
)
const
{
return
ChainContext
::
collect_glyphs
(
c
,
collect_glyphs_lookup
);
return
ChainContext
::
process
(
c
);
}
inline
bool
apply
(
hb_apply_context_t
*
c
)
const
...
...
@@ -1064,10 +956,6 @@ struct ChainContextSubst : ChainContext
struct
ExtensionSubst
:
Extension
{
friend
struct
SubstLookupSubTable
;
friend
struct
SubstLookup
;
private:
inline
const
struct
SubstLookupSubTable
&
get_subtable
(
void
)
const
{
unsigned
int
offset
=
get_offset
();
...
...
@@ -1075,9 +963,8 @@ struct ExtensionSubst : Extension
return
StructAtOffset
<
SubstLookupSubTable
>
(
this
,
offset
);
}
inline
void
closure
(
hb_closure_context_t
*
c
)
const
;
inline
void
collect_glyphs
(
hb_collect_glyphs_context_t
*
c
)
const
;
template
<
typename
context_t
>
inline
typename
context_t
::
return_t
process
(
context_t
*
c
)
const
;
inline
const
Coverage
&
get_coverage
(
void
)
const
;
...
...
@@ -1093,10 +980,6 @@ struct ExtensionSubst : Extension
struct
ReverseChainSingleSubstFormat1
{
friend
struct
ReverseChainSingleSubst
;
private:
inline
void
closure
(
hb_closure_context_t
*
c
)
const
{
TRACE_CLOSURE
();
...
...
@@ -1210,24 +1093,12 @@ struct ReverseChainSingleSubstFormat1
struct
ReverseChainSingleSubst
{
friend
struct
SubstLookupSubTable
;
private:
inline
void
closure
(
hb_closure_context_t
*
c
)
const
{
TRACE_CLOSURE
();
switch
(
u
.
format
)
{
case
1
:
u
.
format1
.
closure
(
c
);
break
;
default:
break
;
}
}
inline
void
collect_glyphs
(
hb_collect_glyphs_context_t
*
c
)
const
template
<
typename
context_t
>
inline
typename
context_t
::
return_t
process
(
context_t
*
c
)
const
{
switch
(
u
.
format
)
{
case
1
:
u
.
format1
.
collect_glyphs
(
c
);
break
;
default:
break
;
case
1
:
return
c
->
process
(
u
.
format1
)
;
default:
return
c
->
default_return_value
;
}
}
...
...
@@ -1285,36 +1156,19 @@ struct SubstLookupSubTable
ReverseChainSingle
=
8
};
inline
void
closure
(
hb_closure_context_t
*
c
,
unsigned
int
lookup_type
)
const
template
<
typename
context_t
>
inline
typename
context_t
::
return_t
process
(
context_t
*
c
,
unsigned
int
lookup_type
)
const
{
TRACE_CLOSURE
();
switch
(
lookup_type
)
{
case
Single
:
u
.
single
.
closure
(
c
);
break
;
case
Multiple
:
u
.
multiple
.
closure
(
c
);
break
;
case
Alternate
:
u
.
alternate
.
closure
(
c
);
break
;
case
Ligature
:
u
.
ligature
.
closure
(
c
);
break
;
case
Context
:
u
.
context
.
closure
(
c
);
break
;
case
ChainContext
:
u
.
chainContext
.
closure
(
c
);
break
;
case
Extension
:
u
.
extension
.
closure
(
c
);
break
;
case
ReverseChainSingle
:
u
.
reverseChainContextSingle
.
closure
(
c
);
break
;
default:
break
;
}
}
inline
void
collect_glyphs
(
hb_collect_glyphs_context_t
*
c
,
unsigned
int
lookup_type
)
const
{
switch
(
lookup_type
)
{
case
Single
:
u
.
single
.
collect_glyphs
(
c
);
break
;
case
Multiple
:
u
.
multiple
.
collect_glyphs
(
c
);
break
;
case
Alternate
:
u
.
alternate
.
collect_glyphs
(
c
);
break
;
case
Ligature
:
u
.
ligature
.
collect_glyphs
(
c
);
break
;
case
Context
:
u
.
context
.
collect_glyphs
(
c
);
break
;
case
ChainContext
:
u
.
chainContext
.
collect_glyphs
(
c
);
break
;
case
Extension
:
u
.
extension
.
collect_glyphs
(
c
);
break
;
case
ReverseChainSingle
:
u
.
reverseChainContextSingle
.
collect_glyphs
(
c
);
break
;
default:
break
;
case
Single
:
return
u
.
single
.
process
(
c
);
case
Multiple
:
return
u
.
multiple
.
process
(
c
);
case
Alternate
:
return
u
.
alternate
.
process
(
c
);
case
Ligature
:
return
u
.
ligature
.
process
(
c
);
case
Context
:
return
u
.
context
.
process
(
c
);
case
ChainContext
:
return
u
.
chainContext
.
process
(
c
);
case
Extension
:
return
u
.
extension
.
process
(
c
);
case
ReverseChainSingle
:
return
u
.
reverseChainContextSingle
.
process
(
c
);
default:
return
c
->
default_return_value
;
}
}
...
...
@@ -1427,12 +1281,15 @@ struct SubstLookup : Lookup
return
lookup_type_is_reverse
(
type
);
}
inline
void
closure
(
hb_closure_context_t
*
c
)
const
template
<
typename
context_t
>
inline
typename
context_t
::
return_t
process
(
context_t
*
c
)
const
{
unsigned
int
lookup_type
=
get_type
();
unsigned
int
count
=
get_subtable_count
();
for
(
unsigned
int
i
=
0
;
i
<
count
;
i
++
)
get_subtable
(
i
).
closure
(
c
,
lookup_type
);
if
(
c
->
stop_sublookup_iteration
(
get_subtable
(
i
).
process
(
c
,
lookup_type
)))
return
c
->
default_return_value
;
return
c
->
default_return_value
;
}
template
<
typename
set_t
>
...
...
@@ -1449,14 +1306,6 @@ struct SubstLookup : Lookup
}
}
inline
void
collect_glyphs
(
hb_collect_glyphs_context_t
*
c
)
const
{
unsigned
int
lookup_type
=
get_type
();
unsigned
int
count
=
get_subtable_count
();
for
(
unsigned
int
i
=
0
;
i
<
count
;
i
++
)
get_subtable
(
i
).
collect_glyphs
(
c
,
lookup_type
);
}
inline
bool
would_apply
(
hb_would_apply_context_t
*
c
,
const
hb_set_digest_t
*
digest
)
const
{
if
(
unlikely
(
!
c
->
len
))
return
false
;
...
...
@@ -1532,11 +1381,9 @@ struct SubstLookup : Lookup
return
ret
;
}
private:
inline
SubstLookupSubTable
&
serialize_subtable
(
hb_serialize_context_t
*
c
,
unsigned
int
i
)
{
return
CastR
<
OffsetArrayOf
<
SubstLookupSubTable
>
>
(
subTable
)[
i
].
serialize
(
c
,
this
);
}
public:
inline
bool
serialize_single
(
hb_serialize_context_t
*
c
,
uint32_t
lookup_props
,
...
...
@@ -1634,9 +1481,25 @@ struct GSUB : GSUBGPOS
static
inline
void
substitute_start
(
hb_font_t
*
font
,
hb_buffer_t
*
buffer
);
static
inline
void
substitute_finish
(
hb_font_t
*
font
,
hb_buffer_t
*
buffer
);
inline
void
closure_lookup
(
hb_closure_context_t
*
c
,
unsigned
int
lookup_index
)
const
{
return
get_lookup
(
lookup_index
).
closure
(
c
);
}
static
void_t
closure_recurse_func
(
hb_closure_context_t
*
c
,
unsigned
int
lookup_index
)
{
const
GSUB
&
gsub
=
*
(
hb_ot_layout_from_face
(
c
->
face
)
->
gsub
);
const
SubstLookup
&
l
=
gsub
.
get_lookup
(
lookup_index
);
return
l
.
process
(
c
);
}
inline
hb_closure_context_t
::
return_t
closure_lookup
(
hb_face_t
*
face
,
hb_set_t
*
glyphs
,
unsigned
int
lookup_index
)
const
{
OT
::
hb_closure_context_t
c
(
face
,
glyphs
,
closure_recurse_func
);
return
get_lookup
(
lookup_index
).
process
(
&
c
);
}
#if 0
inline hb_collect_glyphs_context_t::return_t collect_glyphs_lookup (hb_collect_glyphs_context_t *c,
unsigned int lookup_index) const
{ return get_lookup (lookup_index).process (c); }
#endif
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
)
{
TRACE_SANITIZE
();
...
...
@@ -1672,14 +1535,10 @@ GSUB::substitute_finish (hb_font_t *font HB_UNUSED, hb_buffer_t *buffer HB_UNUSE
/* Out-of-class implementation for methods recursing */
inline
void
ExtensionSubst
::
closure
(
hb_closure_context_t
*
c
)
const
{
get_subtable
().
closure
(
c
,
get_type
());
}
inline
void
ExtensionSubst
::
collect_glyphs
(
hb_collect_glyphs_context_t
*
c
)
const
template
<
typename
context_t
>
inline
typename
context_t
::
return_t
ExtensionSubst
::
process
(
context_t
*
c
)
const
{
get_subtable
().
collect_glyph
s
(
c
,
get_type
());
return
get_subtable
().
proces
s
(
c
,
get_type
());
}
inline
const
Coverage
&
ExtensionSubst
::
get_coverage
(
void
)
const
...
...
@@ -1715,28 +1574,6 @@ inline bool ExtensionSubst::is_reverse (void) const
return
SubstLookup
::
lookup_type_is_reverse
(
type
);
}
static
inline
void
closure_lookup
(
hb_closure_context_t
*
c
,
unsigned
int
lookup_index
)
{
const
GSUB
&
gsub
=
*
(
hb_ot_layout_from_face
(
c
->
face
)
->
gsub
);
const
SubstLookup
&
l
=
gsub
.
get_lookup
(
lookup_index
);
if
(
unlikely
(
c
->
nesting_level_left
==
0
))
return
;
c
->
nesting_level_left
--
;
l
.
closure
(
c
);
c
->
nesting_level_left
++
;
}
static
inline
void
collect_glyphs_lookup
(
hb_collect_glyphs_context_t
*
c
,
unsigned
int
lookup_index
)
{
const
GSUB
&
gsub
=
*
(
hb_ot_layout_from_face
(
c
->
face
)
->
gsub
);
const
SubstLookup
&
l
=
gsub
.
get_lookup
(
lookup_index
);
/* XXX TODO */
l
.
collect_glyphs
(
c
);
}
static
inline
bool
substitute_lookup
(
hb_apply_context_t
*
c
,
unsigned
int
lookup_index
)
{
const
GSUB
&
gsub
=
*
(
hb_ot_layout_from_face
(
c
->
face
)
->
gsub
);
...
...
src/hb-ot-layout-gsubgpos-private.hh
浏览文件 @
44fc237b
...
...
@@ -37,6 +37,9 @@
namespace
OT
{
typedef
struct
{}
void_t
;
/* To be used as return value when void is meant. */
#ifndef HB_DEBUG_CLOSURE
#define HB_DEBUG_CLOSURE (HB_DEBUG+0)
#endif
...
...
@@ -44,20 +47,38 @@ namespace OT {
#define TRACE_CLOSURE() \
hb_auto_trace_t<HB_DEBUG_CLOSURE> trace (&c->debug_depth, "CLOSURE", this, HB_FUNC, "");
struct
hb_closure_context_t
{
typedef
void_t
return_t
;
typedef
return_t
(
*
recurse_func_t
)
(
hb_closure_context_t
*
c
,
unsigned
int
lookup_index
);
template
<
typename
T
>
inline
return_t
process
(
const
T
&
obj
)
{
obj
.
closure
(
this
);
return
void_t
();
}
static
const
return_t
default_return_value
;
bool
stop_sublookup_iteration
(
const
return_t
r
)
const
{
return
false
;
}
return_t
recurse
(
unsigned
int
lookup_index
)
{
if
(
unlikely
(
nesting_level_left
==
0
))
return
default_return_value
;
nesting_level_left
--
;
recurse_func
(
this
,
lookup_index
);
nesting_level_left
++
;
return
default_return_value
;
}
hb_face_t
*
face
;
hb_set_t
*
glyphs
;
recurse_func_t
recurse_func
;
unsigned
int
nesting_level_left
;
unsigned
int
debug_depth
;
hb_closure_context_t
(
hb_face_t
*
face_
,
hb_set_t
*
glyphs_
,
recurse_func_t
recurse_func_
,
unsigned
int
nesting_level_left_
=
MAX_NESTING_LEVEL
)
:
face
(
face_
),
glyphs
(
glyphs_
),
recurse_func
(
recurse_func_
),
nesting_level_left
(
nesting_level_left_
),
debug_depth
(
0
)
{}
};
...
...
@@ -123,6 +144,19 @@ struct hb_collect_glyphs_context_t
after
(
glyphs_after
?
*
glyphs_after
:
*
hb_set_get_empty
()),
output
(
glyphs_output
?
*
glyphs_output
:
*
hb_set_get_empty
()),
debug_depth
(
0
)
{};
typedef
void_t
return_t
;
template
<
typename
T
>
inline
return_t
process
(
const
T
&
obj
)
{
obj
.
collect_glyphs
(
this
);
return
void_t
();
}
static
const
return_t
default_return_value
;
bool
stop_iteration
(
const
return_t
r
)
const
{
return
false
;
}
return_t
recurse
(
unsigned
int
lookup_index
)
{
#if 0
/* XXX */
#endif
return
default_return_value
;
}
};
...
...
@@ -374,14 +408,11 @@ struct hb_apply_context_t
typedef
bool
(
*
intersects_func_t
)
(
hb_set_t
*
glyphs
,
const
USHORT
&
value
,
const
void
*
data
);
typedef
bool
(
*
match_func_t
)
(
hb_codepoint_t
glyph_id
,
const
USHORT
&
value
,
const
void
*
data
);
typedef
void
(
*
closure_lookup_func_t
)
(
hb_closure_context_t
*
c
,
unsigned
int
lookup_index
);
typedef
void
(
*
collect_glyphs_lookup_func_t
)
(
hb_collect_glyphs_context_t
*
c
,
unsigned
int
lookup_index
);
typedef
bool
(
*
apply_lookup_func_t
)
(
hb_apply_context_t
*
c
,
unsigned
int
lookup_index
);
struct
ContextClosureFuncs
{
intersects_func_t
intersects
;
closure_lookup_func_t
closure
;
};
struct
ContextApplyFuncs
{
...
...
@@ -677,11 +708,10 @@ struct LookupRecord
static
inline
void
closure_lookup
(
hb_closure_context_t
*
c
,
unsigned
int
lookupCount
,
const
LookupRecord
lookupRecord
[],
/* Array of LookupRecords--in design order */
closure_lookup_func_t
closure_func
)
const
LookupRecord
lookupRecord
[]
/* Array of LookupRecords--in design order */
)
{
for
(
unsigned
int
i
=
0
;
i
<
lookupCount
;
i
++
)
c
losure_func
(
c
,
lookupRecord
->
lookupListIndex
);
c
->
recurse
(
lookupRecord
->
lookupListIndex
);
}
static
inline
bool
apply_lookup
(
hb_apply_context_t
*
c
,
...
...
@@ -770,8 +800,7 @@ static inline void context_closure_lookup (hb_closure_context_t *c,
inputCount
?
inputCount
-
1
:
0
,
input
,
lookup_context
.
funcs
.
intersects
,
lookup_context
.
intersects_data
))
closure_lookup
(
c
,
lookupCount
,
lookupRecord
,
lookup_context
.
funcs
.
closure
);
lookupCount
,
lookupRecord
);
}
...
...
@@ -804,10 +833,6 @@ static inline bool context_apply_lookup (hb_apply_context_t *c,
struct
Rule
{
friend
struct
RuleSet
;
private:
inline
void
closure
(
hb_closure_context_t
*
c
,
ContextClosureLookupContext
&
lookup_context
)
const
{
TRACE_CLOSURE
();
...
...
@@ -905,18 +930,14 @@ struct RuleSet
struct
ContextFormat1
{
friend
struct
Context
;
private:
inline
void
closure
(
hb_closure_context_t
*
c
,
closure_lookup_func_t
closure_func
)
const
inline
void
closure
(
hb_closure_context_t
*
c
)
const
{
TRACE_CLOSURE
();
const
Coverage
&
cov
=
(
this
+
coverage
);
struct
ContextClosureLookupContext
lookup_context
=
{
{
intersects_glyph
,
closure_func
},
{
intersects_glyph
},
NULL
};
...
...
@@ -940,6 +961,11 @@ struct ContextFormat1
return
TRACE_RETURN
(
rule_set
.
would_apply
(
c
,
lookup_context
));
}
inline
const
Coverage
&
get_coverage
(
void
)
const
{
return
this
+
coverage
;
}
inline
bool
apply
(
hb_apply_context_t
*
c
,
apply_lookup_func_t
apply_func
)
const
{
TRACE_APPLY
();
...
...
@@ -975,11 +1001,7 @@ struct ContextFormat1
struct
ContextFormat2
{
friend
struct
Context
;
private:
inline
void
closure
(
hb_closure_context_t
*
c
,
closure_lookup_func_t
closure_func
)
const
inline
void
closure
(
hb_closure_context_t
*
c
)
const
{
TRACE_CLOSURE
();
if
(
!
(
this
+
coverage
).
intersects
(
c
->
glyphs
))
...
...
@@ -988,7 +1010,7 @@ struct ContextFormat2
const
ClassDef
&
class_def
=
this
+
classDef
;
struct
ContextClosureLookupContext
lookup_context
=
{
{
intersects_class
,
closure_func
},
{
intersects_class
},
NULL
};
...
...
@@ -1014,6 +1036,11 @@ struct ContextFormat2
return
TRACE_RETURN
(
rule_set
.
would_apply
(
c
,
lookup_context
));
}
inline
const
Coverage
&
get_coverage
(
void
)
const
{
return
this
+
coverage
;
}
inline
bool
apply
(
hb_apply_context_t
*
c
,
apply_lookup_func_t
apply_func
)
const
{
TRACE_APPLY
();
...
...
@@ -1053,11 +1080,7 @@ struct ContextFormat2
struct
ContextFormat3
{
friend
struct
Context
;
private:
inline
void
closure
(
hb_closure_context_t
*
c
,
closure_lookup_func_t
closure_func
)
const
inline
void
closure
(
hb_closure_context_t
*
c
)
const
{
TRACE_CLOSURE
();
if
(
!
(
this
+
coverage
[
0
]).
intersects
(
c
->
glyphs
))
...
...
@@ -1065,7 +1088,7 @@ struct ContextFormat3
const
LookupRecord
*
lookupRecord
=
&
StructAtOffset
<
LookupRecord
>
(
coverage
,
coverage
[
0
].
static_size
*
glyphCount
);
struct
ContextClosureLookupContext
lookup_context
=
{
{
intersects_coverage
,
closure_func
},
{
intersects_coverage
},
this
};
context_closure_lookup
(
c
,
...
...
@@ -1086,6 +1109,11 @@ struct ContextFormat3
return
TRACE_RETURN
(
context_would_apply_lookup
(
c
,
glyphCount
,
(
const
USHORT
*
)
(
coverage
+
1
),
lookupCount
,
lookupRecord
,
lookup_context
));
}
inline
const
Coverage
&
get_coverage
(
void
)
const
{
return
this
+
coverage
[
0
];
}
inline
bool
apply
(
hb_apply_context_t
*
c
,
apply_lookup_func_t
apply_func
)
const
{
TRACE_APPLY
();
...
...
@@ -1127,36 +1155,23 @@ struct ContextFormat3
struct
Context
{
protected:
inline
void
closure
(
hb_closure_context_t
*
c
,
closure_lookup_func_t
closure_func
)
const
{
TRACE_CLOSURE
();
switch
(
u
.
format
)
{
case
1
:
u
.
format1
.
closure
(
c
,
closure_func
);
break
;
case
2
:
u
.
format2
.
closure
(
c
,
closure_func
);
break
;
case
3
:
u
.
format3
.
closure
(
c
,
closure_func
);
break
;
default:
break
;
}
}
inline
void
collect_glyphs
(
hb_collect_glyphs_context_t
*
c
,
collect_glyphs_lookup_func_t
closure_func
)
const
template
<
typename
context_t
>
inline
typename
context_t
::
return_t
process
(
context_t
*
c
)
const
{
TRACE_CLOSURE
();
switch
(
u
.
format
)
{
// case 1: u.format1.collect_glyphs (c); break
;
// case 2: u.format2.collect_glyphs (c); break
;
// case 3: u.format2.collect_glyphs (c); break
;
default:
break
;
case
1
:
return
c
->
process
(
u
.
format1
)
;
case
2
:
return
c
->
process
(
u
.
format2
)
;
case
3
:
return
c
->
process
(
u
.
format3
)
;
default:
return
c
->
default_return_value
;
}
}
inline
const
Coverage
&
get_coverage
(
void
)
const
{
switch
(
u
.
format
)
{
case
1
:
return
this
+
u
.
format1
.
coverage
;
case
2
:
return
this
+
u
.
format2
.
coverage
;
case
3
:
return
this
+
u
.
format3
.
coverage
[
0
]
;
case
1
:
return
u
.
format1
.
get_coverage
()
;
case
2
:
return
u
.
format2
.
get_coverage
()
;
case
3
:
return
u
.
format3
.
get_coverage
()
;
default:
return
Null
(
Coverage
);
}
}
...
...
@@ -1238,8 +1253,7 @@ static inline void chain_context_closure_lookup (hb_closure_context_t *c,
lookaheadCount
,
lookahead
,
lookup_context
.
funcs
.
intersects
,
lookup_context
.
intersects_data
[
2
]))
closure_lookup
(
c
,
lookupCount
,
lookupRecord
,
lookup_context
.
funcs
.
closure
);
lookupCount
,
lookupRecord
);
}
static
inline
bool
chain_context_would_apply_lookup
(
hb_would_apply_context_t
*
c
,
...
...
@@ -1290,10 +1304,6 @@ static inline bool chain_context_apply_lookup (hb_apply_context_t *c,
struct
ChainRule
{
friend
struct
ChainRuleSet
;
private:
inline
void
closure
(
hb_closure_context_t
*
c
,
ChainContextClosureLookupContext
&
lookup_context
)
const
{
TRACE_CLOSURE
();
...
...
@@ -1334,7 +1344,6 @@ struct ChainRule
lookup
.
array
,
lookup_context
));
}
public:
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
)
{
TRACE_SANITIZE
();
if
(
!
backtrack
.
sanitize
(
c
))
return
TRACE_RETURN
(
false
);
...
...
@@ -1411,17 +1420,13 @@ struct ChainRuleSet
struct
ChainContextFormat1
{
friend
struct
ChainContext
;
private:
inline
void
closure
(
hb_closure_context_t
*
c
,
closure_lookup_func_t
closure_func
)
const
inline
void
closure
(
hb_closure_context_t
*
c
)
const
{
TRACE_CLOSURE
();
const
Coverage
&
cov
=
(
this
+
coverage
);
struct
ChainContextClosureLookupContext
lookup_context
=
{
{
intersects_glyph
,
closure_func
},
{
intersects_glyph
},
{
NULL
,
NULL
,
NULL
}
};
...
...
@@ -1445,6 +1450,11 @@ struct ChainContextFormat1
return
TRACE_RETURN
(
rule_set
.
would_apply
(
c
,
lookup_context
));
}
inline
const
Coverage
&
get_coverage
(
void
)
const
{
return
this
+
coverage
;
}
inline
bool
apply
(
hb_apply_context_t
*
c
,
apply_lookup_func_t
apply_func
)
const
{
TRACE_APPLY
();
...
...
@@ -1478,11 +1488,7 @@ struct ChainContextFormat1
struct
ChainContextFormat2
{
friend
struct
ChainContext
;
private:
inline
void
closure
(
hb_closure_context_t
*
c
,
closure_lookup_func_t
closure_func
)
const
inline
void
closure
(
hb_closure_context_t
*
c
)
const
{
TRACE_CLOSURE
();
if
(
!
(
this
+
coverage
).
intersects
(
c
->
glyphs
))
...
...
@@ -1493,7 +1499,7 @@ struct ChainContextFormat2
const
ClassDef
&
lookahead_class_def
=
this
+
lookaheadClassDef
;
struct
ChainContextClosureLookupContext
lookup_context
=
{
{
intersects_class
,
closure_func
},
{
intersects_class
},
{
&
backtrack_class_def
,
&
input_class_def
,
&
lookahead_class_def
}
...
...
@@ -1522,6 +1528,11 @@ struct ChainContextFormat2
return
TRACE_RETURN
(
rule_set
.
would_apply
(
c
,
lookup_context
));
}
inline
const
Coverage
&
get_coverage
(
void
)
const
{
return
this
+
coverage
;
}
inline
bool
apply
(
hb_apply_context_t
*
c
,
apply_lookup_func_t
apply_func
)
const
{
TRACE_APPLY
();
...
...
@@ -1576,11 +1587,7 @@ struct ChainContextFormat2
struct
ChainContextFormat3
{
friend
struct
ChainContext
;
private:
inline
void
closure
(
hb_closure_context_t
*
c
,
closure_lookup_func_t
closure_func
)
const
inline
void
closure
(
hb_closure_context_t
*
c
)
const
{
TRACE_CLOSURE
();
const
OffsetArrayOf
<
Coverage
>
&
input
=
StructAfter
<
OffsetArrayOf
<
Coverage
>
>
(
backtrack
);
...
...
@@ -1591,7 +1598,7 @@ struct ChainContextFormat3
const
OffsetArrayOf
<
Coverage
>
&
lookahead
=
StructAfter
<
OffsetArrayOf
<
Coverage
>
>
(
input
);
const
ArrayOf
<
LookupRecord
>
&
lookup
=
StructAfter
<
ArrayOf
<
LookupRecord
>
>
(
lookahead
);
struct
ChainContextClosureLookupContext
lookup_context
=
{
{
intersects_coverage
,
closure_func
},
{
intersects_coverage
},
{
this
,
this
,
this
}
};
chain_context_closure_lookup
(
c
,
...
...
@@ -1602,12 +1609,6 @@ struct ChainContextFormat3
lookup_context
);
}
inline
const
Coverage
&
get_coverage
(
void
)
const
{
const
OffsetArrayOf
<
Coverage
>
&
input
=
StructAfter
<
OffsetArrayOf
<
Coverage
>
>
(
backtrack
);
return
this
+
input
[
0
];
}
inline
bool
would_apply
(
hb_would_apply_context_t
*
c
)
const
{
TRACE_WOULD_APPLY
();
...
...
@@ -1626,6 +1627,12 @@ struct ChainContextFormat3
lookup
.
len
,
lookup
.
array
,
lookup_context
));
}
inline
const
Coverage
&
get_coverage
(
void
)
const
{
const
OffsetArrayOf
<
Coverage
>
&
input
=
StructAfter
<
OffsetArrayOf
<
Coverage
>
>
(
backtrack
);
return
this
+
input
[
0
];
}
inline
bool
apply
(
hb_apply_context_t
*
c
,
apply_lookup_func_t
apply_func
)
const
{
TRACE_APPLY
();
...
...
@@ -1681,35 +1688,22 @@ struct ChainContextFormat3
struct
ChainContext
{
protected:
inline
void
closure
(
hb_closure_context_t
*
c
,
closure_lookup_func_t
closure_func
)
const
{
TRACE_CLOSURE
();
switch
(
u
.
format
)
{
case
1
:
u
.
format1
.
closure
(
c
,
closure_func
);
break
;
case
2
:
u
.
format2
.
closure
(
c
,
closure_func
);
break
;
case
3
:
u
.
format3
.
closure
(
c
,
closure_func
);
break
;
default:
break
;
}
}
inline
void
collect_glyphs
(
hb_collect_glyphs_context_t
*
c
,
collect_glyphs_lookup_func_t
closure_func
)
const
template
<
typename
context_t
>
inline
typename
context_t
::
return_t
process
(
context_t
*
c
)
const
{
TRACE_CLOSURE
();
switch
(
u
.
format
)
{
// case 1: u.format1.collect_glyphs (c); break
;
// case 2: u.format2.collect_glyphs (c); break
;
// case 3: u.format2.collect_glyphs (c); break
;
default:
break
;
case
1
:
return
c
->
process
(
u
.
format1
)
;
case
2
:
return
c
->
process
(
u
.
format2
)
;
case
3
:
return
c
->
process
(
u
.
format3
)
;
default:
return
c
->
default_return_value
;
}
}
inline
const
Coverage
&
get_coverage
(
void
)
const
{
switch
(
u
.
format
)
{
case
1
:
return
this
+
u
.
format1
.
coverage
;
case
2
:
return
this
+
u
.
format2
.
coverage
;
case
1
:
return
u
.
format1
.
get_coverage
()
;
case
2
:
return
u
.
format2
.
get_coverage
()
;
case
3
:
return
u
.
format3
.
get_coverage
();
default:
return
Null
(
Coverage
);
}
...
...
@@ -1759,9 +1753,6 @@ struct ChainContext
struct
ExtensionFormat1
{
friend
struct
Extension
;
protected:
inline
unsigned
int
get_type
(
void
)
const
{
return
extensionLookupType
;
}
inline
unsigned
int
get_offset
(
void
)
const
{
return
extensionOffset
;
}
...
...
src/hb-ot-layout.cc
浏览文件 @
44fc237b
...
...
@@ -417,14 +417,13 @@ hb_ot_layout_lookup_collect_glyphs (hb_face_t *face,
switch
(
table_tag
)
{
case
HB_OT_TAG_GSUB
:
{
const
OT
::
SubstLookup
&
l
=
hb_ot_layout_from_face
(
face
)
->
gsub
->
get_lookup
(
lookup_index
);
l
.
collect_glyphs
(
&
c
);
// hb_ot_layout_from_face (face)->gsub->collect_glyphs_lookup (&c, lookup_index);
return
;
}
case
HB_OT_TAG_GPOS
:
{
const
OT
::
PosLookup
&
l
=
hb_ot_layout_from_face
(
face
)
->
gpos
->
get_lookup
(
lookup_index
);
// l.collect_glyphs (&c);
// hb_ot_layout_from_face (face)->gpos->collect_glyphs_lookup (&c,
lookup_index);
// l.collect_glyphs
_lookup
(&c);
return
;
}
}
...
...
@@ -499,8 +498,7 @@ hb_ot_layout_lookup_substitute_closure (hb_face_t *face,
unsigned
int
lookup_index
,
hb_set_t
*
glyphs
)
{
OT
::
hb_closure_context_t
c
(
face
,
glyphs
);
_get_gsub
(
face
).
closure_lookup
(
&
c
,
lookup_index
);
_get_gsub
(
face
).
closure_lookup
(
face
,
glyphs
,
lookup_index
);
}
/*
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录