Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Harfbuzz
提交
1ff926a5
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,发现更多精彩内容 >>
提交
1ff926a5
编写于
5月 15, 2009
作者:
B
Behdad Esfahbod
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[GSUB] Implement ContextSubstFormat2
上级
fc36d945
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
97 addition
and
8 deletion
+97
-8
src/hb-ot-layout-gsub-private.h
src/hb-ot-layout-gsub-private.h
+97
-8
未找到文件。
src/hb-ot-layout-gsub-private.h
浏览文件 @
1ff926a5
...
...
@@ -540,12 +540,8 @@ DEFINE_NULL (LigatureSubst, 2);
struct
SubstLookupRecord
{
friend
struct
SubRule
;
private:
inline
bool
substitute
(
SUBTABLE_SUBSTITUTE_ARGS_DEF
)
const
;
private:
USHORT
sequenceIndex
;
/* Index into current glyph
* sequence--first glyph = 0 */
USHORT
lookupListIndex
;
/* Lookup to apply to that
...
...
@@ -615,7 +611,6 @@ struct SubRule {
}
}
private:
USHORT
glyphCount
;
/* Total number of glyphs in input
* glyph sequence--includes the first
...
...
@@ -694,7 +689,66 @@ ASSERT_SIZE (ContextSubstFormat1, 6);
struct
SubClassRule
{
/* TODO */
friend
struct
SubClassSet
;
private:
DEFINE_ARRAY_TYPE
(
USHORT
,
klass
,
(
glyphCount
?
glyphCount
-
1
:
0
));
inline
bool
substitute_class
(
SUBTABLE_SUBSTITUTE_ARGS_DEF
,
const
ClassDef
&
class_def
)
const
{
unsigned
int
i
,
j
;
unsigned
int
property
;
unsigned
int
count
=
glyphCount
;
if
(
HB_UNLIKELY
(
buffer
->
in_pos
+
count
>
buffer
->
in_length
||
context_length
<
count
))
return
false
;
/* Not enough glyphs in input or context */
/* XXX context_length should also be checked when skipping glyphs, right?
* What does context_length really mean, anyway? */
for
(
i
=
1
,
j
=
buffer
->
in_pos
+
1
;
i
<
count
;
i
++
,
j
++
)
{
while
(
!
_hb_ot_layout_check_glyph_property
(
layout
,
IN_ITEM
(
j
),
lookup_flag
,
&
property
))
{
if
(
HB_UNLIKELY
(
j
+
count
-
i
==
buffer
->
in_length
))
return
false
;
j
++
;
}
if
(
HB_LIKELY
(
class_def
.
get_class
(
IN_GLYPH
(
j
))
!=
(
*
this
)[
i
-
1
]))
return
false
;
}
/* XXX right? or j - buffer_inpos? */
context_length
=
count
;
unsigned
int
subst_count
=
substCount
;
const
SubstLookupRecord
*
subst
=
(
const
SubstLookupRecord
*
)
((
const
char
*
)
klass
+
sizeof
(
klass
[
0
])
*
glyphCount
);
for
(
i
=
0
;
i
<
count
;)
{
if
(
subst_count
&&
i
==
subst
->
sequenceIndex
)
{
unsigned
int
old_pos
=
buffer
->
in_pos
;
/* Do a substitution */
bool
done
=
subst
->
substitute
(
SUBTABLE_SUBSTITUTE_ARGS
);
subst
++
;
subst_count
--
;
i
+=
buffer
->
in_pos
-
old_pos
;
if
(
!
done
)
goto
no_subst
;
}
else
{
no_subst:
/* No substitution for this index */
_hb_buffer_copy_output_glyph
(
buffer
);
i
++
;
}
}
}
private:
USHORT
glyphCount
;
/* Total number of classes
...
...
@@ -710,7 +764,27 @@ struct SubClassRule {
DEFINE_NULL_ASSERT_SIZE
(
SubClassRule
,
4
);
struct
SubClassSet
{
/* TODO */
friend
struct
ContextSubstFormat2
;
private:
DEFINE_OFFSET_ARRAY_TYPE
(
SubClassRule
,
subClassRule
,
subClassRuleCnt
);
inline
bool
substitute_class
(
SUBTABLE_SUBSTITUTE_ARGS_DEF
,
const
ClassDef
&
class_def
)
const
{
/* LONGTERMTODO: Old code fetches glyph classes at most once and caches
* them across subrule lookups. Not sure it's worth it.
*/
unsigned
int
num_rules
=
get_len
();
for
(
unsigned
int
i
=
0
;
i
<
num_rules
;
i
++
)
{
const
SubClassRule
&
rule
=
(
*
this
)[
i
];
if
(
rule
.
substitute_class
(
SUBTABLE_SUBSTITUTE_ARGS
,
class_def
))
return
true
;
}
return
false
;
}
private:
USHORT
subClassRuleCnt
;
/* Number of SubClassRule tables */
...
...
@@ -725,9 +799,24 @@ struct ContextSubstFormat2 {
friend
struct
ContextSubst
;
private:
/* SubClassSet tables, in Coverage Index order */
DEFINE_OFFSET_ARRAY_TYPE
(
SubClassSet
,
subClassSet
,
subClassSetCnt
);
DEFINE_GET_ACCESSOR
(
Coverage
,
coverage
,
coverage
);
DEFINE_GET_ACCESSOR
(
ClassDef
,
class_def
,
classDef
);
DEFINE_GET_GLYPH_COVERAGE
(
glyph_coverage
);
inline
bool
substitute
(
SUBTABLE_SUBSTITUTE_ARGS_DEF
)
const
{
return
false
;
unsigned
int
property
;
if
(
!
_hb_ot_layout_check_glyph_property
(
layout
,
IN_CURITEM
(),
lookup_flag
,
&
property
))
return
false
;
hb_codepoint_t
glyph_id
=
IN_CURGLYPH
();
unsigned
int
index
=
get_glyph_coverage
(
glyph_id
);
const
SubClassSet
&
class_set
=
(
*
this
)[
index
];
return
class_set
.
substitute_class
(
SUBTABLE_SUBSTITUTE_ARGS
,
get_class_def
());
}
private:
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录