Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Harfbuzz
提交
5caece67
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看板
提交
5caece67
编写于
4月 23, 2012
作者:
B
Behdad Esfahbod
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Make closure() return void
上级
0b08adb3
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
157 addition
and
188 deletion
+157
-188
src/hb-ot-layout-gsub-table.hh
src/hb-ot-layout-gsub-table.hh
+59
-83
src/hb-ot-layout-gsubgpos-private.hh
src/hb-ot-layout-gsubgpos-private.hh
+83
-82
src/hb-ot-layout.cc
src/hb-ot-layout.cc
+5
-5
src/hb-ot-layout.h
src/hb-ot-layout.h
+4
-4
src/hb-set-private.hh
src/hb-set-private.hh
+6
-14
未找到文件。
src/hb-ot-layout-gsub-table.hh
浏览文件 @
5caece67
...
...
@@ -39,17 +39,15 @@ struct SingleSubstFormat1
private:
inline
bool
closure
(
hb_closure_context_t
*
c
)
const
inline
void
closure
(
hb_closure_context_t
*
c
)
const
{
TRACE_CLOSURE
();
bool
ret
=
false
;
Coverage
::
Iter
iter
;
for
(
iter
.
init
(
this
+
coverage
);
iter
.
more
();
iter
.
next
())
{
hb_codepoint_t
glyph_id
=
iter
.
get_glyph
();
if
(
c
->
glyphs
->
has
(
glyph_id
))
ret
=
c
->
glyphs
->
add
((
glyph_id
+
deltaGlyphID
)
&
0xFFFF
)
||
ret
;
c
->
glyphs
->
add
((
glyph_id
+
deltaGlyphID
)
&
0xFFFF
)
;
}
return
ret
;
}
inline
bool
would_apply
(
hb_codepoint_t
glyph_id
)
const
...
...
@@ -96,16 +94,14 @@ struct SingleSubstFormat2
private:
inline
bool
closure
(
hb_closure_context_t
*
c
)
const
inline
void
closure
(
hb_closure_context_t
*
c
)
const
{
TRACE_CLOSURE
();
bool
ret
=
false
;
Coverage
::
Iter
iter
;
for
(
iter
.
init
(
this
+
coverage
);
iter
.
more
();
iter
.
next
())
{
if
(
c
->
glyphs
->
has
(
iter
.
get_glyph
()))
ret
=
c
->
glyphs
->
add
(
substitute
[
iter
.
get_coverage
()])
||
ret
;
c
->
glyphs
->
add
(
substitute
[
iter
.
get_coverage
()])
;
}
return
ret
;
}
inline
bool
would_apply
(
hb_codepoint_t
glyph_id
)
const
...
...
@@ -154,13 +150,13 @@ struct SingleSubst
private:
inline
bool
closure
(
hb_closure_context_t
*
c
)
const
inline
void
closure
(
hb_closure_context_t
*
c
)
const
{
TRACE_CLOSURE
();
switch
(
u
.
format
)
{
case
1
:
return
u
.
format1
.
closure
(
c
)
;
case
2
:
return
u
.
format2
.
closure
(
c
)
;
default:
return
false
;
case
1
:
u
.
format1
.
closure
(
c
);
break
;
case
2
:
u
.
format2
.
closure
(
c
);
break
;
default:
break
;
}
}
...
...
@@ -208,14 +204,12 @@ struct Sequence
private:
inline
bool
closure
(
hb_closure_context_t
*
c
)
const
inline
void
closure
(
hb_closure_context_t
*
c
)
const
{
TRACE_CLOSURE
();
unsigned
int
count
=
substitute
.
len
;
bool
ret
=
false
;
for
(
unsigned
int
i
=
0
;
i
<
count
;
i
++
)
ret
=
c
->
glyphs
->
add
(
substitute
[
i
])
||
ret
;
return
ret
;
c
->
glyphs
->
add
(
substitute
[
i
]);
}
inline
bool
apply
(
hb_apply_context_t
*
c
)
const
...
...
@@ -250,16 +244,14 @@ struct MultipleSubstFormat1
private:
inline
bool
closure
(
hb_closure_context_t
*
c
)
const
inline
void
closure
(
hb_closure_context_t
*
c
)
const
{
TRACE_CLOSURE
();
bool
ret
=
false
;
Coverage
::
Iter
iter
;
for
(
iter
.
init
(
this
+
coverage
);
iter
.
more
();
iter
.
next
())
{
if
(
c
->
glyphs
->
has
(
iter
.
get_glyph
()))
ret
=
(
this
+
sequence
[
iter
.
get_coverage
()]).
closure
(
c
)
||
ret
;
(
this
+
sequence
[
iter
.
get_coverage
()]).
closure
(
c
)
;
}
return
ret
;
}
inline
bool
would_apply
(
hb_codepoint_t
glyph_id
)
const
...
...
@@ -302,12 +294,12 @@ struct MultipleSubst
private:
inline
bool
closure
(
hb_closure_context_t
*
c
)
const
inline
void
closure
(
hb_closure_context_t
*
c
)
const
{
TRACE_CLOSURE
();
switch
(
u
.
format
)
{
case
1
:
return
u
.
format1
.
closure
(
c
)
;
default:
return
false
;
case
1
:
u
.
format1
.
closure
(
c
);
break
;
default:
break
;
}
}
...
...
@@ -354,20 +346,18 @@ struct AlternateSubstFormat1
private:
inline
bool
closure
(
hb_closure_context_t
*
c
)
const
inline
void
closure
(
hb_closure_context_t
*
c
)
const
{
TRACE_CLOSURE
();
bool
ret
=
false
;
Coverage
::
Iter
iter
;
for
(
iter
.
init
(
this
+
coverage
);
iter
.
more
();
iter
.
next
())
{
if
(
c
->
glyphs
->
has
(
iter
.
get_glyph
()))
{
const
AlternateSet
&
alt_set
=
this
+
alternateSet
[
iter
.
get_coverage
()];
unsigned
int
count
=
alt_set
.
len
;
for
(
unsigned
int
i
=
0
;
i
<
count
;
i
++
)
ret
=
c
->
glyphs
->
add
(
alt_set
[
i
])
||
ret
;
c
->
glyphs
->
add
(
alt_set
[
i
])
;
}
}
return
ret
;
}
inline
bool
would_apply
(
hb_codepoint_t
glyph_id
)
const
...
...
@@ -430,12 +420,12 @@ struct AlternateSubst
private:
inline
bool
closure
(
hb_closure_context_t
*
c
)
const
inline
void
closure
(
hb_closure_context_t
*
c
)
const
{
TRACE_CLOSURE
();
switch
(
u
.
format
)
{
case
1
:
return
u
.
format1
.
closure
(
c
)
;
default:
return
false
;
case
1
:
u
.
format1
.
closure
(
c
);
break
;
default:
break
;
}
}
...
...
@@ -479,14 +469,14 @@ struct Ligature
private:
inline
bool
closure
(
hb_closure_context_t
*
c
)
const
inline
void
closure
(
hb_closure_context_t
*
c
)
const
{
TRACE_CLOSURE
();
unsigned
int
count
=
component
.
len
;
for
(
unsigned
int
i
=
1
;
i
<
count
;
i
++
)
if
(
!
c
->
glyphs
->
has
(
component
[
i
]))
return
false
;
return
c
->
glyphs
->
add
(
ligGlyph
);
return
;
c
->
glyphs
->
add
(
ligGlyph
);
}
inline
bool
would_apply
(
hb_codepoint_t
second
)
const
...
...
@@ -584,17 +574,12 @@ struct LigatureSet
private:
inline
bool
closure
(
hb_closure_context_t
*
c
)
const
inline
void
closure
(
hb_closure_context_t
*
c
)
const
{
TRACE_CLOSURE
();
bool
ret
=
false
;
unsigned
int
num_ligs
=
ligature
.
len
;
for
(
unsigned
int
i
=
0
;
i
<
num_ligs
;
i
++
)
{
const
Ligature
&
lig
=
this
+
ligature
[
i
];
ret
=
lig
.
closure
(
c
)
||
ret
;
}
return
ret
;
(
this
+
ligature
[
i
]).
closure
(
c
);
}
inline
bool
would_apply
(
hb_codepoint_t
second
)
const
...
...
@@ -643,17 +628,14 @@ struct LigatureSubstFormat1
private:
inline
bool
closure
(
hb_closure_context_t
*
c
)
const
inline
void
closure
(
hb_closure_context_t
*
c
)
const
{
TRACE_CLOSURE
();
bool
ret
=
false
;
Coverage
::
Iter
iter
;
for
(
iter
.
init
(
this
+
coverage
);
iter
.
more
();
iter
.
next
())
{
if
(
c
->
glyphs
->
has
(
iter
.
get_glyph
()))
ret
=
(
this
+
ligatureSet
[
iter
.
get_coverage
()]).
closure
(
c
)
||
ret
;
(
this
+
ligatureSet
[
iter
.
get_coverage
()]).
closure
(
c
)
;
}
return
ret
;
return
false
;
}
inline
bool
would_apply
(
hb_codepoint_t
first
,
hb_codepoint_t
second
)
const
...
...
@@ -700,12 +682,12 @@ struct LigatureSubst
private:
inline
bool
closure
(
hb_closure_context_t
*
c
)
const
inline
void
closure
(
hb_closure_context_t
*
c
)
const
{
TRACE_CLOSURE
();
switch
(
u
.
format
)
{
case
1
:
return
u
.
format1
.
closure
(
c
)
;
default:
return
false
;
case
1
:
u
.
format1
.
closure
(
c
);
break
;
default:
break
;
}
}
...
...
@@ -744,7 +726,7 @@ struct LigatureSubst
static
inline
bool
substitute_lookup
(
hb_apply_context_t
*
c
,
unsigned
int
lookup_index
);
static
inline
bool
closure_lookup
(
hb_closure_context_t
*
c
,
unsigned
int
lookup_index
);
static
inline
void
closure_lookup
(
hb_closure_context_t
*
c
,
unsigned
int
lookup_index
);
struct
ContextSubst
:
Context
{
...
...
@@ -752,7 +734,7 @@ struct ContextSubst : Context
private:
inline
bool
closure
(
hb_closure_context_t
*
c
)
const
inline
void
closure
(
hb_closure_context_t
*
c
)
const
{
TRACE_CLOSURE
();
return
Context
::
closure
(
c
,
closure_lookup
);
...
...
@@ -771,7 +753,7 @@ struct ChainContextSubst : ChainContext
private:
inline
bool
closure
(
hb_closure_context_t
*
c
)
const
inline
void
closure
(
hb_closure_context_t
*
c
)
const
{
TRACE_CLOSURE
();
return
ChainContext
::
closure
(
c
,
closure_lookup
);
...
...
@@ -798,7 +780,7 @@ struct ExtensionSubst : Extension
return
StructAtOffset
<
SubstLookupSubTable
>
(
this
,
offset
);
}
inline
bool
closure
(
hb_closure_context_t
*
c
)
const
;
inline
void
closure
(
hb_closure_context_t
*
c
)
const
;
inline
bool
would_apply
(
hb_codepoint_t
glyph_id
)
const
;
inline
bool
would_apply
(
hb_codepoint_t
first
,
hb_codepoint_t
second
)
const
;
...
...
@@ -816,7 +798,7 @@ struct ReverseChainSingleSubstFormat1
private:
inline
bool
closure
(
hb_closure_context_t
*
c
)
const
inline
void
closure
(
hb_closure_context_t
*
c
)
const
{
TRACE_CLOSURE
();
const
OffsetArrayOf
<
Coverage
>
&
lookahead
=
StructAfter
<
OffsetArrayOf
<
Coverage
>
>
(
backtrack
);
...
...
@@ -826,21 +808,19 @@ struct ReverseChainSingleSubstFormat1
count
=
backtrack
.
len
;
for
(
unsigned
int
i
=
0
;
i
<
count
;
i
++
)
if
(
!
(
this
+
backtrack
[
i
]).
intersects
(
c
->
glyphs
))
return
false
;
return
;
count
=
lookahead
.
len
;
for
(
unsigned
int
i
=
0
;
i
<
count
;
i
++
)
if
(
!
(
this
+
lookahead
[
i
]).
intersects
(
c
->
glyphs
))
return
false
;
return
;
const
ArrayOf
<
GlyphID
>
&
substitute
=
StructAfter
<
ArrayOf
<
GlyphID
>
>
(
lookahead
);
bool
ret
=
false
;
Coverage
::
Iter
iter
;
for
(
iter
.
init
(
this
+
coverage
);
iter
.
more
();
iter
.
next
())
{
if
(
c
->
glyphs
->
has
(
iter
.
get_glyph
()))
ret
=
c
->
glyphs
->
add
(
substitute
[
iter
.
get_coverage
()])
||
ret
;
c
->
glyphs
->
add
(
substitute
[
iter
.
get_coverage
()])
;
}
return
false
;
}
inline
bool
apply
(
hb_apply_context_t
*
c
)
const
...
...
@@ -910,12 +890,12 @@ struct ReverseChainSingleSubst
private:
inline
bool
closure
(
hb_closure_context_t
*
c
)
const
inline
void
closure
(
hb_closure_context_t
*
c
)
const
{
TRACE_CLOSURE
();
switch
(
u
.
format
)
{
case
1
:
return
u
.
format1
.
closure
(
c
)
;
default:
return
false
;
case
1
:
u
.
format1
.
closure
(
c
);
break
;
default:
break
;
}
}
...
...
@@ -965,20 +945,20 @@ struct SubstLookupSubTable
ReverseChainSingle
=
8
};
inline
bool
closure
(
hb_closure_context_t
*
c
,
inline
void
closure
(
hb_closure_context_t
*
c
,
unsigned
int
lookup_type
)
const
{
TRACE_CLOSURE
();
switch
(
lookup_type
)
{
case
Single
:
return
u
.
single
.
closure
(
c
)
;
case
Multiple
:
return
u
.
multiple
.
closure
(
c
)
;
case
Alternate
:
return
u
.
alternate
.
closure
(
c
)
;
case
Ligature
:
return
u
.
ligature
.
closure
(
c
)
;
case
Context
:
return
u
.
c
.
closure
(
c
)
;
case
ChainContext
:
return
u
.
chainContext
.
closure
(
c
)
;
case
Extension
:
return
u
.
extension
.
closure
(
c
)
;
case
ReverseChainSingle
:
return
u
.
reverseChainContextSingle
.
closure
(
c
)
;
default:
return
false
;
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
.
c
.
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
;
}
}
...
...
@@ -1068,14 +1048,12 @@ struct SubstLookup : Lookup
return
lookup_type_is_reverse
(
type
);
}
inline
bool
closure
(
hb_closure_context_t
*
c
)
const
inline
void
closure
(
hb_closure_context_t
*
c
)
const
{
unsigned
int
lookup_type
=
get_type
();
bool
ret
=
false
;
unsigned
int
count
=
get_subtable_count
();
for
(
unsigned
int
i
=
0
;
i
<
count
;
i
++
)
ret
=
get_subtable
(
i
).
closure
(
c
,
lookup_type
)
||
ret
;
return
ret
;
get_subtable
(
i
).
closure
(
c
,
lookup_type
);
}
inline
bool
would_apply
(
hb_codepoint_t
glyph_id
)
const
...
...
@@ -1196,7 +1174,7 @@ struct GSUB : GSUBGPOS
static
inline
void
substitute_start
(
hb_buffer_t
*
buffer
);
static
inline
void
substitute_finish
(
hb_buffer_t
*
buffer
);
inline
bool
closure_lookup
(
hb_closure_context_t
*
c
,
inline
void
closure_lookup
(
hb_closure_context_t
*
c
,
unsigned
int
lookup_index
)
const
{
return
get_lookup
(
lookup_index
).
closure
(
c
);
}
...
...
@@ -1231,9 +1209,9 @@ GSUB::substitute_finish (hb_buffer_t *buffer)
/* Out-of-class implementation for methods recursing */
inline
bool
ExtensionSubst
::
closure
(
hb_closure_context_t
*
c
)
const
inline
void
ExtensionSubst
::
closure
(
hb_closure_context_t
*
c
)
const
{
return
get_subtable
().
closure
(
c
,
get_type
());
get_subtable
().
closure
(
c
,
get_type
());
}
inline
bool
ExtensionSubst
::
would_apply
(
hb_codepoint_t
glyph_id
)
const
...
...
@@ -1269,19 +1247,17 @@ inline bool ExtensionSubst::is_reverse (void) const
return
SubstLookup
::
lookup_type_is_reverse
(
type
);
}
static
inline
bool
closure_lookup
(
hb_closure_context_t
*
c
,
unsigned
int
lookup_index
)
static
inline
void
closure_lookup
(
hb_closure_context_t
*
c
,
unsigned
int
lookup_index
)
{
const
GSUB
&
gsub
=
*
(
c
->
face
->
ot_layout
->
gsub
);
const
SubstLookup
&
l
=
gsub
.
get_lookup
(
lookup_index
);
if
(
unlikely
(
c
->
nesting_level_left
==
0
))
return
false
;
return
;
c
->
nesting_level_left
--
;
bool
ret
=
l
.
closure
(
c
);
l
.
closure
(
c
);
c
->
nesting_level_left
++
;
return
ret
;
}
static
inline
bool
substitute_lookup
(
hb_apply_context_t
*
c
,
unsigned
int
lookup_index
)
...
...
src/hb-ot-layout-gsubgpos-private.hh
浏览文件 @
5caece67
...
...
@@ -229,7 +229,7 @@ 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
bool
(
*
closure_lookup_func_t
)
(
hb_closure_context_t
*
c
,
unsigned
int
lookup_index
);
typedef
void
(
*
closure_lookup_func_t
)
(
hb_closure_context_t
*
c
,
unsigned
int
lookup_index
);
typedef
bool
(
*
apply_lookup_func_t
)
(
hb_apply_context_t
*
c
,
unsigned
int
lookup_index
);
struct
ContextClosureFuncs
...
...
@@ -375,15 +375,13 @@ struct LookupRecord
};
static
inline
bool
closure_lookup
(
hb_closure_context_t
*
c
,
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
)
{
bool
ret
=
false
;
for
(
unsigned
int
i
=
0
;
i
<
lookupCount
;
i
++
)
ret
=
closure_func
(
c
,
lookupRecord
->
lookupListIndex
)
||
ret
;
return
ret
;
closure_func
(
c
,
lookupRecord
->
lookupListIndex
);
}
static
inline
bool
apply_lookup
(
hb_apply_context_t
*
c
,
...
...
@@ -460,19 +458,19 @@ struct ContextApplyLookupContext
const
void
*
match_data
;
};
static
inline
bool
context_closure_lookup
(
hb_closure_context_t
*
c
,
static
inline
void
context_closure_lookup
(
hb_closure_context_t
*
c
,
unsigned
int
inputCount
,
/* Including the first glyph (not matched) */
const
USHORT
input
[],
/* Array of input values--start with second glyph */
unsigned
int
lookupCount
,
const
LookupRecord
lookupRecord
[],
ContextClosureLookupContext
&
lookup_context
)
{
return
intersects_array
(
c
,
inputCount
?
inputCount
-
1
:
0
,
input
,
lookup_context
.
funcs
.
intersects
,
lookup_context
.
intersects_data
)
&&
closure_lookup
(
c
,
lookupCount
,
lookupRecord
,
lookup_context
.
funcs
.
closure
);
if
(
intersects_array
(
c
,
inputCount
?
inputCount
-
1
:
0
,
input
,
lookup_context
.
funcs
.
intersects
,
lookup_context
.
intersects_data
)
)
closure_lookup
(
c
,
lookupCount
,
lookupRecord
,
lookup_context
.
funcs
.
closure
);
}
...
...
@@ -500,14 +498,14 @@ struct Rule
private:
inline
bool
closure
(
hb_closure_context_t
*
c
,
ContextClosureLookupContext
&
lookup_context
)
const
inline
void
closure
(
hb_closure_context_t
*
c
,
ContextClosureLookupContext
&
lookup_context
)
const
{
TRACE_CLOSURE
();
const
LookupRecord
*
lookupRecord
=
&
StructAtOffset
<
LookupRecord
>
(
input
,
input
[
0
].
static_size
*
(
inputCount
?
inputCount
-
1
:
0
));
return
context_closure_lookup
(
c
,
inputCount
,
input
,
lookupCount
,
lookupRecord
,
lookup_context
);
context_closure_lookup
(
c
,
inputCount
,
input
,
lookupCount
,
lookupRecord
,
lookup_context
);
}
inline
bool
apply
(
hb_apply_context_t
*
c
,
ContextApplyLookupContext
&
lookup_context
)
const
...
...
@@ -545,14 +543,12 @@ struct Rule
struct
RuleSet
{
inline
bool
closure
(
hb_closure_context_t
*
c
,
ContextClosureLookupContext
&
lookup_context
)
const
inline
void
closure
(
hb_closure_context_t
*
c
,
ContextClosureLookupContext
&
lookup_context
)
const
{
TRACE_CLOSURE
();
bool
ret
=
false
;
unsigned
int
num_rules
=
rule
.
len
;
for
(
unsigned
int
i
=
0
;
i
<
num_rules
;
i
++
)
ret
=
(
this
+
rule
[
i
]).
closure
(
c
,
lookup_context
)
||
ret
;
return
ret
;
(
this
+
rule
[
i
]).
closure
(
c
,
lookup_context
);
}
inline
bool
apply
(
hb_apply_context_t
*
c
,
ContextApplyLookupContext
&
lookup_context
)
const
...
...
@@ -587,7 +583,7 @@ struct ContextFormat1
private:
inline
bool
closure
(
hb_closure_context_t
*
c
,
closure_lookup_func_t
closure_func
)
const
inline
void
closure
(
hb_closure_context_t
*
c
,
closure_lookup_func_t
closure_func
)
const
{
TRACE_CLOSURE
();
...
...
@@ -598,14 +594,12 @@ struct ContextFormat1
NULL
};
bool
ret
=
false
;
unsigned
int
count
=
ruleSet
.
len
;
for
(
unsigned
int
i
=
0
;
i
<
count
;
i
++
)
if
(
cov
.
intersects_coverage
(
c
->
glyphs
,
i
))
{
const
RuleSet
&
rule_set
=
this
+
ruleSet
[
i
];
r
et
=
rule_set
.
closure
(
c
,
lookup_context
)
||
ret
;
r
ule_set
.
closure
(
c
,
lookup_context
)
;
}
return
ret
;
}
inline
bool
apply
(
hb_apply_context_t
*
c
,
apply_lookup_func_t
apply_func
)
const
...
...
@@ -648,11 +642,11 @@ struct ContextFormat2
private:
inline
bool
closure
(
hb_closure_context_t
*
c
,
closure_lookup_func_t
closure_func
)
const
inline
void
closure
(
hb_closure_context_t
*
c
,
closure_lookup_func_t
closure_func
)
const
{
TRACE_CLOSURE
();
if
(
!
(
this
+
coverage
).
intersects
(
c
->
glyphs
))
return
false
;
return
;
const
ClassDef
&
class_def
=
this
+
classDef
;
...
...
@@ -661,14 +655,12 @@ struct ContextFormat2
NULL
};
bool
ret
=
false
;
unsigned
int
count
=
ruleSet
.
len
;
for
(
unsigned
int
i
=
0
;
i
<
count
;
i
++
)
if
(
class_def
.
intersects_class
(
c
->
glyphs
,
i
))
{
const
RuleSet
&
rule_set
=
this
+
ruleSet
[
i
];
r
et
=
rule_set
.
closure
(
c
,
lookup_context
)
||
ret
;
r
ule_set
.
closure
(
c
,
lookup_context
)
;
}
return
ret
;
}
inline
bool
apply
(
hb_apply_context_t
*
c
,
apply_lookup_func_t
apply_func
)
const
...
...
@@ -717,21 +709,21 @@ struct ContextFormat3
private:
inline
bool
closure
(
hb_closure_context_t
*
c
,
closure_lookup_func_t
closure_func
)
const
inline
void
closure
(
hb_closure_context_t
*
c
,
closure_lookup_func_t
closure_func
)
const
{
TRACE_CLOSURE
();
if
(
!
(
this
+
coverage
[
0
]).
intersects
(
c
->
glyphs
))
return
false
;
return
;
const
LookupRecord
*
lookupRecord
=
&
StructAtOffset
<
LookupRecord
>
(
coverage
,
coverage
[
0
].
static_size
*
glyphCount
);
struct
ContextClosureLookupContext
lookup_context
=
{
{
intersects_coverage
,
closure_func
},
this
};
return
context_closure_lookup
(
c
,
glyphCount
,
(
const
USHORT
*
)
(
coverage
+
1
),
lookupCount
,
lookupRecord
,
lookup_context
);
context_closure_lookup
(
c
,
glyphCount
,
(
const
USHORT
*
)
(
coverage
+
1
),
lookupCount
,
lookupRecord
,
lookup_context
);
}
inline
bool
apply
(
hb_apply_context_t
*
c
,
apply_lookup_func_t
apply_func
)
const
...
...
@@ -781,14 +773,14 @@ struct Context
{
protected:
inline
bool
closure
(
hb_closure_context_t
*
c
,
closure_lookup_func_t
closure_func
)
const
inline
void
closure
(
hb_closure_context_t
*
c
,
closure_lookup_func_t
closure_func
)
const
{
TRACE_CLOSURE
();
switch
(
u
.
format
)
{
case
1
:
return
u
.
format1
.
closure
(
c
,
closure_func
)
;
case
2
:
return
u
.
format2
.
closure
(
c
,
closure_func
)
;
case
3
:
return
u
.
format3
.
closure
(
c
,
closure_func
)
;
default:
return
false
;
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
;
}
}
...
...
@@ -838,7 +830,7 @@ struct ChainContextApplyLookupContext
const
void
*
match_data
[
3
];
};
static
inline
bool
chain_context_closure_lookup
(
hb_closure_context_t
*
c
,
static
inline
void
chain_context_closure_lookup
(
hb_closure_context_t
*
c
,
unsigned
int
backtrackCount
,
const
USHORT
backtrack
[],
unsigned
int
inputCount
,
/* Including the first glyph (not matched) */
...
...
@@ -849,18 +841,18 @@ static inline bool chain_context_closure_lookup (hb_closure_context_t *c,
const
LookupRecord
lookupRecord
[],
ChainContextClosureLookupContext
&
lookup_context
)
{
return
intersects_array
(
c
,
backtrackCount
,
backtrack
,
lookup_context
.
funcs
.
intersects
,
lookup_context
.
intersects_data
[
0
])
&&
intersects_array
(
c
,
inputCount
?
inputCount
-
1
:
0
,
input
,
lookup_context
.
funcs
.
intersects
,
lookup_context
.
intersects_data
[
1
])
&&
intersects_array
(
c
,
lookaheadCount
,
lookahead
,
lookup_context
.
funcs
.
intersects
,
lookup_context
.
intersects_data
[
2
]
)
&&
closure_lookup
(
c
,
lookupCount
,
lookupRecord
,
lookup_context
.
funcs
.
closure
);
if
(
intersects_array
(
c
,
backtrackCount
,
backtrack
,
lookup_context
.
funcs
.
intersects
,
lookup_context
.
intersects_data
[
0
])
&&
intersects_array
(
c
,
inputCount
?
inputCount
-
1
:
0
,
input
,
lookup_context
.
funcs
.
intersects
,
lookup_context
.
intersects_data
[
1
])
&&
intersects_array
(
c
,
lookaheadCount
,
lookahead
,
lookup_context
.
funcs
.
intersects
,
lookup_context
.
intersects_data
[
2
])
)
closure_lookup
(
c
,
lookupCount
,
lookupRecord
,
lookup_context
.
funcs
.
closure
);
}
static
inline
bool
chain_context_apply_lookup
(
hb_apply_context_t
*
c
,
...
...
@@ -904,18 +896,18 @@ struct ChainRule
private:
inline
bool
closure
(
hb_closure_context_t
*
c
,
ChainContextClosureLookupContext
&
lookup_context
)
const
inline
void
closure
(
hb_closure_context_t
*
c
,
ChainContextClosureLookupContext
&
lookup_context
)
const
{
TRACE_CLOSURE
();
const
HeadlessArrayOf
<
USHORT
>
&
input
=
StructAfter
<
HeadlessArrayOf
<
USHORT
>
>
(
backtrack
);
const
ArrayOf
<
USHORT
>
&
lookahead
=
StructAfter
<
ArrayOf
<
USHORT
>
>
(
input
);
const
ArrayOf
<
LookupRecord
>
&
lookup
=
StructAfter
<
ArrayOf
<
LookupRecord
>
>
(
lookahead
);
return
chain_context_closure_lookup
(
c
,
backtrack
.
len
,
backtrack
.
array
,
input
.
len
,
input
.
array
,
lookahead
.
len
,
lookahead
.
array
,
lookup
.
len
,
lookup
.
array
,
lookup_context
);
chain_context_closure_lookup
(
c
,
backtrack
.
len
,
backtrack
.
array
,
input
.
len
,
input
.
array
,
lookahead
.
len
,
lookahead
.
array
,
lookup
.
len
,
lookup
.
array
,
lookup_context
);
}
inline
bool
apply
(
hb_apply_context_t
*
c
,
ChainContextApplyLookupContext
&
lookup_context
)
const
...
...
@@ -964,14 +956,12 @@ struct ChainRule
struct
ChainRuleSet
{
inline
bool
closure
(
hb_closure_context_t
*
c
,
ChainContextClosureLookupContext
&
lookup_context
)
const
inline
void
closure
(
hb_closure_context_t
*
c
,
ChainContextClosureLookupContext
&
lookup_context
)
const
{
TRACE_CLOSURE
();
bool
ret
=
false
;
unsigned
int
num_rules
=
rule
.
len
;
for
(
unsigned
int
i
=
0
;
i
<
num_rules
;
i
++
)
ret
=
(
this
+
rule
[
i
]).
closure
(
c
,
lookup_context
)
||
ret
;
return
ret
;
(
this
+
rule
[
i
]).
closure
(
c
,
lookup_context
);
}
inline
bool
apply
(
hb_apply_context_t
*
c
,
ChainContextApplyLookupContext
&
lookup_context
)
const
...
...
@@ -1006,7 +996,7 @@ struct ChainContextFormat1
private:
inline
bool
closure
(
hb_closure_context_t
*
c
,
closure_lookup_func_t
closure_func
)
const
inline
void
closure
(
hb_closure_context_t
*
c
,
closure_lookup_func_t
closure_func
)
const
{
TRACE_CLOSURE
();
const
Coverage
&
cov
=
(
this
+
coverage
);
...
...
@@ -1016,14 +1006,12 @@ struct ChainContextFormat1
{
NULL
,
NULL
,
NULL
}
};
bool
ret
=
false
;
unsigned
int
count
=
ruleSet
.
len
;
for
(
unsigned
int
i
=
0
;
i
<
count
;
i
++
)
if
(
cov
.
intersects_coverage
(
c
->
glyphs
,
i
))
{
const
ChainRuleSet
&
rule_set
=
this
+
ruleSet
[
i
];
r
et
=
rule_set
.
closure
(
c
,
lookup_context
)
||
ret
;
r
ule_set
.
closure
(
c
,
lookup_context
)
;
}
return
ret
;
}
inline
bool
apply
(
hb_apply_context_t
*
c
,
apply_lookup_func_t
apply_func
)
const
...
...
@@ -1065,11 +1053,11 @@ struct ChainContextFormat2
private:
inline
bool
closure
(
hb_closure_context_t
*
c
,
closure_lookup_func_t
closure_func
)
const
inline
void
closure
(
hb_closure_context_t
*
c
,
closure_lookup_func_t
closure_func
)
const
{
TRACE_CLOSURE
();
if
(
!
(
this
+
coverage
).
intersects
(
c
->
glyphs
))
return
false
;
return
;
const
ClassDef
&
backtrack_class_def
=
this
+
backtrackClassDef
;
const
ClassDef
&
input_class_def
=
this
+
inputClassDef
;
...
...
@@ -1082,14 +1070,12 @@ struct ChainContextFormat2
&
lookahead_class_def
}
};
bool
ret
=
false
;
unsigned
int
count
=
ruleSet
.
len
;
for
(
unsigned
int
i
=
0
;
i
<
count
;
i
++
)
if
(
input_class_def
.
intersects_class
(
c
->
glyphs
,
i
))
{
const
ChainRuleSet
&
rule_set
=
this
+
ruleSet
[
i
];
r
et
=
rule_set
.
closure
(
c
,
lookup_context
)
||
ret
;
r
ule_set
.
closure
(
c
,
lookup_context
)
;
}
return
ret
;
}
inline
bool
apply
(
hb_apply_context_t
*
c
,
apply_lookup_func_t
apply_func
)
const
...
...
@@ -1153,11 +1139,26 @@ struct ChainContextFormat3
private:
inline
bool
closure
(
hb_closure_context_t
*
c
,
closure_lookup_func_t
closure_func
)
const
inline
void
closure
(
hb_closure_context_t
*
c
,
closure_lookup_func_t
closure_func
)
const
{
TRACE_CLOSURE
();
/* TODO FILLME */
return
false
;
const
OffsetArrayOf
<
Coverage
>
&
input
=
StructAfter
<
OffsetArrayOf
<
Coverage
>
>
(
backtrack
);
if
(
!
(
this
+
input
[
0
]).
intersects
(
c
->
glyphs
))
return
;
const
OffsetArrayOf
<
Coverage
>
&
lookahead
=
StructAfter
<
OffsetArrayOf
<
Coverage
>
>
(
input
);
const
ArrayOf
<
LookupRecord
>
&
lookup
=
StructAfter
<
ArrayOf
<
LookupRecord
>
>
(
lookahead
);
struct
ChainContextClosureLookupContext
lookup_context
=
{
{
intersects_coverage
,
closure_func
},
{
this
,
this
,
this
}
};
chain_context_closure_lookup
(
c
,
backtrack
.
len
,
(
const
USHORT
*
)
backtrack
.
array
,
input
.
len
,
(
const
USHORT
*
)
input
.
array
+
1
,
lookahead
.
len
,
(
const
USHORT
*
)
lookahead
.
array
,
lookup
.
len
,
lookup
.
array
,
lookup_context
);
}
inline
bool
apply
(
hb_apply_context_t
*
c
,
apply_lookup_func_t
apply_func
)
const
...
...
@@ -1219,14 +1220,14 @@ struct ChainContext
{
protected:
inline
bool
closure
(
hb_closure_context_t
*
c
,
closure_lookup_func_t
closure_func
)
const
inline
void
closure
(
hb_closure_context_t
*
c
,
closure_lookup_func_t
closure_func
)
const
{
TRACE_CLOSURE
();
switch
(
u
.
format
)
{
case
1
:
return
u
.
format1
.
closure
(
c
,
closure_func
)
;
case
2
:
return
u
.
format2
.
closure
(
c
,
closure_func
)
;
case
3
:
return
u
.
format3
.
closure
(
c
,
closure_func
)
;
default:
return
false
;
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
;
}
}
...
...
src/hb-ot-layout.cc
浏览文件 @
5caece67
...
...
@@ -470,13 +470,13 @@ hb_ot_layout_substitute_finish (hb_buffer_t *buffer HB_UNUSED)
GSUB
::
substitute_finish
(
buffer
);
}
hb_bool_t
hb_ot_layout_substitute_closure_lookup
(
hb_face_t
*
face
,
hb_set_t
*
glyphs
,
unsigned
int
lookup_index
)
void
hb_ot_layout_substitute_closure_lookup
(
hb_face_t
*
face
,
hb_set_t
*
glyphs
,
unsigned
int
lookup_index
)
{
hb_closure_context_t
c
(
face
,
glyphs
);
return
_get_gsub
(
face
).
closure_lookup
(
&
c
,
lookup_index
);
_get_gsub
(
face
).
closure_lookup
(
&
c
,
lookup_index
);
}
/*
...
...
src/hb-ot-layout.h
浏览文件 @
5caece67
...
...
@@ -183,10 +183,10 @@ void
hb_ot_layout_substitute_finish
(
hb_buffer_t
*
buffer
);
hb_bool_t
hb_ot_layout_substitute_closure_lookup
(
hb_face_t
*
face
,
hb_set_t
*
glyphs
,
unsigned
int
lookup_index
);
void
hb_ot_layout_substitute_closure_lookup
(
hb_face_t
*
face
,
hb_set_t
*
glyphs
,
unsigned
int
lookup_index
);
/*
* GPOS
...
...
src/hb-set-private.hh
浏览文件 @
5caece67
...
...
@@ -38,23 +38,15 @@ struct _hb_set_t
inline
void
clear
(
void
)
{
memset
(
elts
,
0
,
sizeof
elts
);
}
inline
bool
add
(
hb_codepoint_t
g
)
inline
void
add
(
hb_codepoint_t
g
)
{
if
(
unlikely
(
g
>
MAX_G
))
return
false
;
elt_t
&
e
=
elt
(
g
);
elt_t
m
=
mask
(
g
);
bool
ret
=
!
(
e
&
m
);
e
|=
m
;
return
ret
;
if
(
unlikely
(
g
>
MAX_G
))
return
;
elt
(
g
)
|=
mask
(
g
);
}
inline
bool
del
(
hb_codepoint_t
g
)
inline
void
del
(
hb_codepoint_t
g
)
{
if
(
unlikely
(
g
>
MAX_G
))
return
false
;
elt_t
&
e
=
elt
(
g
);
elt_t
m
=
mask
(
g
);
bool
ret
=
!!
(
e
&
m
);
e
&=
~
m
;
return
ret
;
if
(
unlikely
(
g
>
MAX_G
))
return
;
elt
(
g
)
&=
~
mask
(
g
);
}
inline
bool
has
(
hb_codepoint_t
g
)
const
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录