Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Harfbuzz
提交
aa3d7adc
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,发现更多精彩内容 >>
提交
aa3d7adc
编写于
5月 17, 2009
作者:
B
Behdad Esfahbod
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[HB] More churning towards ChainContext lookups
上级
48f16ed9
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
125 addition
and
70 deletion
+125
-70
src/hb-ot-layout-common-private.h
src/hb-ot-layout-common-private.h
+5
-1
src/hb-ot-layout-gsub-private.h
src/hb-ot-layout-gsub-private.h
+13
-2
src/hb-ot-layout-gsubgpos-private.h
src/hb-ot-layout-gsubgpos-private.h
+107
-67
未找到文件。
src/hb-ot-layout-common-private.h
浏览文件 @
aa3d7adc
...
...
@@ -296,7 +296,7 @@ struct Coverage {
}
}
unsigned
int
operator
()
(
hb_codepoint_t
glyph_id
)
const
{
inline
unsigned
int
operator
()
(
hb_codepoint_t
glyph_id
)
const
{
return
get_coverage
(
glyph_id
);
}
...
...
@@ -382,6 +382,10 @@ struct ClassDef {
}
}
inline
unsigned
int
operator
()
(
hb_codepoint_t
glyph_id
)
const
{
return
get_class
(
glyph_id
);
}
private:
union
{
USHORT
format
;
/* Format identifier */
...
...
src/hb-ot-layout-gsub-private.h
浏览文件 @
aa3d7adc
...
...
@@ -49,7 +49,7 @@ struct SingleSubstFormat1 {
inline
bool
single_substitute
(
hb_codepoint_t
&
glyph_id
)
const
{
unsigned
int
index
=
(
this
+
coverage
)
(
glyph_id
);
if
(
NOT_COVERED
==
index
)
if
(
G_LIKELY
(
index
==
NOT_COVERED
)
)
return
false
;
glyph_id
+=
deltaGlyphID
;
...
...
@@ -76,8 +76,10 @@ struct SingleSubstFormat2 {
inline
bool
single_substitute
(
hb_codepoint_t
&
glyph_id
)
const
{
unsigned
int
index
=
(
this
+
coverage
)
(
glyph_id
);
if
(
G_LIKELY
(
index
==
NOT_COVERED
))
return
false
;
if
(
index
>=
substitute
.
len
)
if
(
G_UNLIKELY
(
index
>=
substitute
.
len
)
)
return
false
;
glyph_id
=
substitute
[
index
];
...
...
@@ -187,6 +189,9 @@ struct MultipleSubstFormat1 {
inline
bool
substitute
(
LOOKUP_ARGS_DEF
)
const
{
unsigned
int
index
=
(
this
+
coverage
)
(
IN_CURGLYPH
());
if
(
G_LIKELY
(
index
==
NOT_COVERED
))
return
false
;
return
(
this
+
sequence
[
index
]).
substitute_sequence
(
LOOKUP_ARGS
);
}
...
...
@@ -238,6 +243,9 @@ struct AlternateSubstFormat1 {
hb_codepoint_t
glyph_id
=
IN_CURGLYPH
();
unsigned
int
index
=
(
this
+
coverage
)
(
glyph_id
);
if
(
G_LIKELY
(
index
==
NOT_COVERED
))
return
false
;
const
AlternateSet
&
alt_set
=
this
+
alternateSet
[
index
];
if
(
HB_UNLIKELY
(
!
alt_set
.
len
))
...
...
@@ -421,6 +429,9 @@ struct LigatureSubstFormat1 {
property
&
LookupFlag
::
MarkAttachmentType
);
unsigned
int
index
=
(
this
+
coverage
)
(
glyph_id
);
if
(
G_LIKELY
(
index
==
NOT_COVERED
))
return
false
;
const
LigatureSet
&
lig_set
=
this
+
ligatureSet
[
index
];
return
lig_set
.
substitute_ligature
(
LOOKUP_ARGS
,
first_is_mark
);
}
...
...
src/hb-ot-layout-gsubgpos-private.h
浏览文件 @
aa3d7adc
...
...
@@ -155,8 +155,6 @@ struct Rule {
friend
struct
RuleSet
;
private:
DEFINE_ARRAY_TYPE
(
USHORT
,
input
,
(
inputCount
?
inputCount
-
1
:
0
));
inline
bool
apply
(
LOOKUP_ARGS_DEF
,
ContextLookupContext
&
context
)
const
{
const
LookupRecord
*
record
=
(
const
LookupRecord
*
)
((
const
char
*
)
input
+
sizeof
(
input
[
0
])
*
(
inputCount
?
inputCount
-
1
:
0
));
return
context_lookup
(
LOOKUP_ARGS
,
...
...
@@ -174,7 +172,7 @@ struct Rule {
USHORT
lookupCount
;
/* Number of LookupRecords */
USHORT
input
[];
/* Array of match inputs--start with
* second glyph */
LookupRecord
lookupRecord
[];
/* Array of LookupRecords--in
LookupRecord
lookupRecord
X
[];
/* Array of LookupRecords--in
* design order */
};
ASSERT_SIZE
(
Rule
,
4
);
...
...
@@ -207,6 +205,9 @@ struct ContextFormat1 {
inline
bool
apply
(
LOOKUP_ARGS_DEF
,
apply_lookup_func_t
apply_func
)
const
{
unsigned
int
index
=
(
this
+
coverage
)
(
IN_CURGLYPH
());
if
(
G_LIKELY
(
index
==
NOT_COVERED
))
return
false
;
const
RuleSet
&
rule_set
=
this
+
ruleSet
[
index
];
struct
ContextLookupContext
context
=
{
{
match_glyph
,
apply_func
},
...
...
@@ -235,13 +236,18 @@ struct ContextFormat2 {
inline
bool
apply
(
LOOKUP_ARGS_DEF
,
apply_lookup_func_t
apply_func
)
const
{
unsigned
int
index
=
(
this
+
coverage
)
(
IN_CURGLYPH
());
if
(
G_LIKELY
(
index
==
NOT_COVERED
))
return
false
;
const
ClassDef
&
class_def
=
this
+
classDef
;
index
=
class_def
(
IN_CURGLYPH
());
const
RuleSet
&
rule_set
=
this
+
ruleSet
[
index
];
/* LONGTERMTODO: Old code fetches glyph classes at most once and caches
* them across subrule lookups. Not sure it's worth it.
*/
struct
ContextLookupContext
context
=
{
{
match_class
,
apply_func
},
(
char
*
)
&
(
this
+
classDef
)
(
char
*
)
&
class_def
};
return
rule_set
.
apply
(
LOOKUP_ARGS
,
context
);
}
...
...
@@ -267,9 +273,6 @@ struct ContextFormat3 {
private:
/* Coverage tables, in glyph sequence order */
DEFINE_OFFSET_ARRAY_TYPE
(
Coverage
,
coverage
,
glyphCount
);
inline
bool
apply_coverage
(
LOOKUP_ARGS_DEF
,
apply_lookup_func_t
apply_func
)
const
{
const
LookupRecord
*
record
=
(
const
LookupRecord
*
)
((
const
char
*
)
coverage
+
sizeof
(
coverage
[
0
])
*
glyphCount
);
struct
ContextLookupContext
context
=
{
...
...
@@ -286,7 +289,8 @@ struct ContextFormat3 {
inline
bool
apply
(
LOOKUP_ARGS_DEF
,
apply_lookup_func_t
apply_func
)
const
{
if
((
*
this
)[
0
].
get_coverage
(
IN_CURGLYPH
()
==
NOT_COVERED
))
unsigned
int
index
=
(
this
+
coverage
[
0
])
(
IN_CURGLYPH
());
if
(
G_LIKELY
(
index
==
NOT_COVERED
))
return
false
;
return
apply_coverage
(
LOOKUP_ARGS
,
apply_func
);
...
...
@@ -297,11 +301,10 @@ struct ContextFormat3 {
USHORT
glyphCount
;
/* Number of glyphs in the input glyph
* sequence */
USHORT
lookupCount
;
/* Number of LookupRecords */
Offset
coverage
[];
/* Array of offsets to Coverage
* table--from beginning of
* table--in glyph
* sequence order */
LookupRecord
lookupRecord
[];
/* Array of LookupRecords--in
OffsetTo
<
Coverage
>
coverage
[];
/* Array of offsets to Coverage
* table in glyph sequence order */
LookupRecord
lookupRecordX
[];
/* Array of LookupRecords--in
* design order */
};
ASSERT_SIZE
(
ContextFormat3
,
6
);
...
...
@@ -337,9 +340,22 @@ struct ChainContextLookupContext {
};
struct
ChainRule
{
/* TODO */
friend
struct
ChainRuleSet
;
private:
inline
bool
apply
(
LOOKUP_ARGS_DEF
,
ChainContextLookupContext
&
context
)
const
{
return
false
;
// const LookupRecord *record = (const LookupRecord *) ((const char *) input + sizeof (input[0]) * (inputCount ? inputCount - 1 : 0));
// return context_lookup (LOOKUP_ARGS,
// inputCount,
// input,
// lookupCount,
// record,
// context);
}
private:
USHORT
backtrackCount
;
/* Total number of glyphs in the
...
...
@@ -349,24 +365,23 @@ struct ChainRule {
USHORT
backtrack
[];
/* Array of backtracking values
* (to be matched before the input
* sequence) */
USHORT
inputCount
;
/* Total number of values in the input
USHORT
inputCount
X
;
/* Total number of values in the input
* sequence (includes the first glyph) */
USHORT
input
[];
/* Array of input values (start with
USHORT
input
X
[];
/* Array of input values (start with
* second glyph) */
USHORT
lookaheadCount
;
/* Total number of glyphs in the look
USHORT
lookaheadCount
X
;
/* Total number of glyphs in the look
* ahead sequence (number of glyphs to
* be matched after the input sequence) */
USHORT
lookahead
[];
/* Array of lookahead values's (to be
USHORT
lookahead
X
[];
/* Array of lookahead values's (to be
* matched after the input sequence) */
USHORT
lookupCount
;
/* Number of LookupRecords */
LookupRecord
lookupRecord
[];
/* Array of LookupRecords--in
USHORT
lookupCount
X
;
/* Number of LookupRecords */
LookupRecord
lookupRecord
X
[];
/* Array of LookupRecords--in
* design order) */
};
ASSERT_SIZE
(
ChainRule
,
8
);
struct
ChainRuleSet
{
/*
inline
bool
apply
(
LOOKUP_ARGS_DEF
,
ChainContextLookupContext
&
context
)
const
{
unsigned
int
num_rules
=
rule
.
len
;
...
...
@@ -377,7 +392,6 @@ struct ChainRuleSet {
return
false
;
}
*/
private:
OffsetArrayOf
<
ChainRule
>
...
...
@@ -392,30 +406,26 @@ struct ChainContextFormat1 {
private:
inline
bool
apply
(
LOOKUP_ARGS_DEF
,
apply_lookup_func_t
apply_func
)
const
{
/* TODO */
// unsigned int index = (this+coverage) (IN_CURGLYPH ());
// const RuleSet &rule_set = this+ruleSet[index];
// struct ContextLookupContext context = {
// glyph_match, NULL,
// apply_func
// };
// return rule_set.apply (LOOKUP_ARGS, context);
return
false
;
}
unsigned
int
index
=
(
this
+
coverage
)
(
IN_CURGLYPH
());
if
(
G_LIKELY
(
index
==
NOT_COVERED
))
return
false
;
const
ChainRuleSet
&
rule_set
=
this
+
ruleSet
[
index
];
struct
ChainContextLookupContext
context
=
{
{
match_glyph
,
apply_func
},
{
NULL
,
NULL
,
NULL
}
};
return
rule_set
.
apply
(
LOOKUP_ARGS
,
context
);
}
private:
USHORT
format
;
/* Format identifier--format = 1 */
OffsetTo
<
Coverage
>
coverage
;
/* Offset to Coverage table--from
* beginning of table */
USHORT
chainRuleSetCount
;
/* Number of ChainRuleSet
* tables--must equal GlyphCount in
* Coverage table */
Offset
chainRuleSet
[];
/* Array of offsets to ChainRuleSet
* tables--from beginning of
* table--ordered by Coverage Index */
OffsetArrayOf
<
ChainRuleSet
>
ruleSet
;
/* Array of ChainRuleSet tables
* ordered by Coverage Index */
};
ASSERT_SIZE
(
ChainContextFormat1
,
6
);
...
...
@@ -426,37 +436,48 @@ struct ChainContextFormat2 {
private:
inline
bool
apply
(
LOOKUP_ARGS_DEF
,
apply_lookup_func_t
apply_func
)
const
{
// unsigned int index = (this+coverage) (IN_CURGLYPH ());
// const RuleSet &rule_set = this+ruleSet[index];
unsigned
int
index
=
(
this
+
coverage
)
(
IN_CURGLYPH
());
if
(
G_LIKELY
(
index
==
NOT_COVERED
))
return
false
;
const
ClassDef
&
backtrack_class_def
=
this
+
backtrackClassDef
;
const
ClassDef
&
input_class_def
=
this
+
inputClassDef
;
const
ClassDef
&
lookahead_class_def
=
this
+
lookaheadClassDef
;
index
=
input_class_def
(
IN_CURGLYPH
());
const
ChainRuleSet
&
rule_set
=
this
+
ruleSet
[
index
];
/* LONGTERMTODO: Old code fetches glyph classes at most once and caches
* them across subrule lookups. Not sure it's worth it.
*/
// struct ContextLookupContext context = {
// class_match, (char *) &(this+classDef),
// apply_func
// };
// return rule_set.apply (LOOKUP_ARGS, context);
return
false
;
struct
ChainContextLookupContext
context
=
{
{
match_class
,
apply_func
},
{(
char
*
)
&
backtrack_class_def
,
(
char
*
)
&
input_class_def
,
(
char
*
)
&
lookahead_class_def
}
};
return
rule_set
.
apply
(
LOOKUP_ARGS
,
context
);
}
private:
USHORT
format
;
/* Format identifier--format = 2 */
Offset
coverage
;
/* Offset to Coverage table--from
OffsetTo
<
Coverage
>
coverage
;
/* Offset to Coverage table--from
* beginning of table */
Offset
backtrackClassDef
;
/* Offset to glyph ClassDef table
OffsetTo
<
ClassDef
>
backtrackClassDef
;
/* Offset to glyph ClassDef table
* containing backtrack sequence
* data--from beginning of table */
Offset
inputClassDef
;
/* Offset to glyph ClassDef
OffsetTo
<
ClassDef
>
inputClassDef
;
/* Offset to glyph ClassDef
* table containing input sequence
* data--from beginning of table */
Offset
lookaheadClassDef
;
/* Offset to glyph ClassDef table
OffsetTo
<
ClassDef
>
lookaheadClassDef
;
/* Offset to glyph ClassDef table
* containing lookahead sequence
* data--from beginning of table */
USHORT
chainClassSetCnt
;
/* Number of ChainClassSet tables */
Offset
chainClassSet
[];
/* Array of offsets to ChainClassSet
* tables--from beginning of
* table--ordered by input
* class--may be NULL */
OffsetArrayOf
<
ChainRuleSet
>
ruleSet
;
/* Array of ChainRuleSet tables
* ordered by class */
};
ASSERT_SIZE
(
ChainContextFormat2
,
12
);
...
...
@@ -465,13 +486,32 @@ struct ChainContextFormat3 {
friend
struct
ChainContext
;
private:
inline
bool
apply
(
LOOKUP_ARGS_DEF
,
apply_lookup_func_t
apply_func
)
const
{
// if ((*this)[0].get_coverage (IN_CURGLYPH () == NOT_COVERED))
// return false;
inline
bool
apply_coverage
(
LOOKUP_ARGS_DEF
,
apply_lookup_func_t
apply_func
)
const
{
// const LookupRecord *record = (const LookupRecord *) ((const char *) coverage + sizeof (coverage[0]) * glyphCount);
struct
ChainContextLookupContext
context
=
{
{
match_coverage
,
apply_func
},
{(
char
*
)
this
,
(
char
*
)
this
,
(
char
*
)
this
}
};
/*
return context_lookup (LOOKUP_ARGS,
glyphCount,
(const USHORT *) (coverage + 1),
lookupCount,
record,
context);
*/
return
false
;
}
// return apply_coverage (LOOKUP_ARGS, apply_func);
inline
bool
apply
(
LOOKUP_ARGS_DEF
,
apply_lookup_func_t
apply_func
)
const
{
/* XXX */
unsigned
int
index
=
0
;
//(this+coverage[0]) (IN_CURGLYPH ());
if
(
G_LIKELY
(
index
==
NOT_COVERED
))
return
false
;
return
apply_coverage
(
LOOKUP_ARGS
,
apply_func
);
}
private:
...
...
@@ -481,17 +521,17 @@ struct ChainContextFormat3 {
Offset
backtrackCoverage
[];
/* Array of offsets to coverage tables
* in backtracking sequence, in glyph
* sequence order */
USHORT
inputGlyphCount
;
/* Number of glyphs in input sequence */
Offset
inputCoverage
[];
/* Array of offsets to coverage
USHORT
inputGlyphCount
X
;
/* Number of glyphs in input sequence */
Offset
inputCoverage
X
[];
/* Array of offsets to coverage
* tables in input sequence, in glyph
* sequence order */
USHORT
lookaheadGlyphCount
;
/* Number of glyphs in lookahead
USHORT
lookaheadGlyphCount
X
;
/* Number of glyphs in lookahead
* sequence */
Offset
lookaheadCoverage
[];
/* Array of offsets to coverage tables
Offset
lookaheadCoverage
X
[];
/* Array of offsets to coverage tables
* in lookahead sequence, in glyph
* sequence order */
USHORT
substCount
;
/* Number of LookupRecords */
LookupRecord
substLookupRecord
[];
/* Array of LookupRecords--in
USHORT
lookupCountX
;
/* Number of LookupRecords */
LookupRecord
lookupRecordX
[];
/* Array of LookupRecords--in
* design order */
};
ASSERT_SIZE
(
ChainContextFormat3
,
10
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录