Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Harfbuzz
提交
4f27ce7e
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,发现更多精彩内容 >>
提交
4f27ce7e
编写于
4月 16, 2009
作者:
B
Behdad Esfahbod
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[GSUB] Implement Extension subtables
上级
83e61ff4
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
108 addition
and
61 deletion
+108
-61
src/hb-ot-layout-gsub-private.h
src/hb-ot-layout-gsub-private.h
+108
-61
未找到文件。
src/hb-ot-layout-gsub-private.h
浏览文件 @
4f27ce7e
...
...
@@ -40,18 +40,18 @@
return c.get_coverage (glyph); \
}
#define SUBTABLE_SUBSTITUTE \
bool substitute (
hb_ot_layout_t *layout, \
#define SUBTABLE_SUBSTITUTE
_ARGS_DEF
\
hb_ot_layout_t *layout, \
hb_buffer_t *buffer, \
unsigned int context_length, \
unsigned int nesting_level_left, \
unsigned int lookup_flag) const
#define SUBTABLE_SUBSTITUTE_
CHAIN(obj)
\
obj.substitute (
layout, \
unsigned int lookup_flag
#define SUBTABLE_SUBSTITUTE_
ARGS
\
layout, \
buffer, \
context_length, \
nesting_level_left, \
lookup_flag)
lookup_flag
struct
SingleSubstFormat1
{
...
...
@@ -74,17 +74,6 @@ struct SingleSubstFormat1 {
return
true
;
}
#if 0
case 2:
if ( index >= ss->ssf.ssf2.GlyphCount )
return ERR(HB_Err_Invalid_SubTable);
value = ss->ssf.ssf2.Substitute[index];
if ( REPLACE_Glyph( buffer, value, nesting_level ) )
return error;
break;
#endif
private:
USHORT
substFormat
;
/* Format identifier--format = 1 */
Offset
coverage
;
/* Offset to Coverage table--from
...
...
@@ -130,6 +119,8 @@ struct SingleSubst {
friend
struct
SubstLookupSubTable
;
private:
unsigned
int
get_size
(
void
)
const
{
switch
(
u
.
substFormat
)
{
case
1
:
return
sizeof
(
u
.
format1
);
...
...
@@ -138,8 +129,7 @@ struct SingleSubst {
}
}
private:
inline
SUBTABLE_SUBSTITUTE
{
inline
bool
substitute
(
SUBTABLE_SUBSTITUTE_ARGS_DEF
)
const
{
hb_codepoint_t
glyph_id
;
unsigned
int
property
;
...
...
@@ -214,7 +204,7 @@ struct MultipleSubstFormat1 {
DEFINE_GET_ACCESSOR
(
Coverage
,
coverage
,
coverage
);
DEFINE_GET_GLYPH_COVERAGE
(
glyph_coverage
);
inline
SUBTABLE_SUBSTITUTE
{
inline
bool
substitute
(
SUBTABLE_SUBSTITUTE_ARGS_DEF
)
const
{
hb_codepoint_t
glyph_id
;
unsigned
int
index
;
...
...
@@ -267,6 +257,10 @@ ASSERT_SIZE (MultipleSubstFormat1, 6);
struct
MultipleSubst
{
friend
struct
SubstLookupSubTable
;
private:
unsigned
int
get_size
(
void
)
const
{
switch
(
u
.
substFormat
)
{
case
1
:
return
sizeof
(
u
.
format1
);
...
...
@@ -274,10 +268,9 @@ struct MultipleSubst {
}
}
private:
inline
SUBTABLE_SUBSTITUTE
{
inline
bool
substitute
(
SUBTABLE_SUBSTITUTE_ARGS_DEF
)
const
{
switch
(
u
.
substFormat
)
{
case
1
:
return
SUBTABLE_SUBSTITUTE_CHAIN
(
u
.
format1
);
case
1
:
return
u
.
format1
.
substitute
(
SUBTABLE_SUBSTITUTE_ARGS
);
default:
return
false
;
}
}
...
...
@@ -619,8 +612,14 @@ struct ChainContextSubstFormat3 {
};
ASSERT_SIZE
(
ChainContextSubstFormat3
,
10
);
struct
ExtensionSubstFormat1
{
/* TODO */
friend
struct
ExtensionSubst
;
private:
inline
unsigned
int
get_type
(
void
)
const
{
return
extensionLookupType
;
}
inline
bool
substitute
(
SUBTABLE_SUBSTITUTE_ARGS_DEF
)
const
;
private:
USHORT
substFormat
;
/* Format identifier. Set to 1. */
...
...
@@ -632,6 +631,44 @@ struct ExtensionSubstFormat1 {
};
ASSERT_SIZE
(
ExtensionSubstFormat1
,
8
);
struct
ExtensionSubst
{
friend
struct
SubstLookup
;
friend
struct
SubstLookupSubTable
;
private:
unsigned
int
get_size
(
void
)
const
{
switch
(
u
.
substFormat
)
{
case
1
:
return
sizeof
(
u
.
format1
);
default:
return
sizeof
(
u
.
substFormat
);
}
}
inline
unsigned
int
get_type
(
void
)
const
{
switch
(
u
.
substFormat
)
{
case
1
:
return
u
.
format1
.
get_type
();
default:
return
0
;
}
}
inline
bool
substitute
(
SUBTABLE_SUBSTITUTE_ARGS_DEF
)
const
{
switch
(
u
.
substFormat
)
{
case
1
:
return
u
.
format1
.
substitute
(
SUBTABLE_SUBSTITUTE_ARGS
);
default:
return
false
;
}
}
private:
union
{
USHORT
substFormat
;
/* Format identifier */
ExtensionSubstFormat1
format1
;
}
u
;
};
DEFINE_NULL
(
ExtensionSubst
,
2
);
struct
ReverseChainSingleSubstFormat1
{
/* TODO */
...
...
@@ -678,37 +715,35 @@ struct SubstLookupSubTable {
unsigned
int
get_size
(
unsigned
int
lookup_type
)
const
{
switch
(
lookup_type
)
{
// case 1: return u.format1
.get_size ();
// case 2: return u.format2
.get_size ();
case
GSUB_Single
:
return
u
.
single
.
get_size
();
case
GSUB_Multiple
:
return
u
.
multiple
.
get_size
();
/*
case GSUB_Single:
case GSUB_Multiple:
case GSUB_Alternate:
case GSUB_Ligature:
case GSUB_Context:
case GSUB_ChainingContext:
case GSUB_Extension:
*/
case
GSUB_Extension
:
return
u
.
extension
.
get_size
();
/*
case GSUB_ReverseChainingContextSingle:
*/
default:
return
sizeof
(
LookupSubTable
);
}
}
inline
bool
substitute
(
hb_ot_layout_t
*
layout
,
hb_buffer_t
*
buffer
,
unsigned
int
context_length
,
unsigned
int
nesting_level_left
,
unsigned
int
lookup_type
,
unsigned
int
lookup_flag
)
const
{
inline
bool
substitute
(
SUBTABLE_SUBSTITUTE_ARGS_DEF
,
unsigned
int
lookup_type
)
const
{
switch
(
lookup_type
)
{
case
GSUB_Single
:
return
SUBTABLE_SUBSTITUTE_CHAIN
(
u
.
singleSubst
);
case
GSUB_Single
:
return
u
.
single
.
substitute
(
SUBTABLE_SUBSTITUTE_ARGS
);
case
GSUB_Multiple
:
return
u
.
multiple
.
substitute
(
SUBTABLE_SUBSTITUTE_ARGS
);
/*
case GSUB_Multiple:
case GSUB_Alternate:
case GSUB_Ligature:
case GSUB_Context:
case GSUB_ChainingContext:
case GSUB_Extension:
*/
case
GSUB_Extension
:
return
u
.
extension
.
substitute
(
SUBTABLE_SUBSTITUTE_ARGS
);
/*
case GSUB_ReverseChainingContextSingle:
*/
default:
return
false
;
...
...
@@ -718,10 +753,23 @@ struct SubstLookupSubTable {
private:
union
{
USHORT
substFormat
;
SingleSubst
singleSubst
;
SingleSubst
single
;
MultipleSubst
multiple
;
ExtensionSubst
extension
;
}
u
;
};
/* Out-of-class implementation for methods chaining */
inline
bool
ExtensionSubstFormat1
::
substitute
(
SUBTABLE_SUBSTITUTE_ARGS_DEF
)
const
{
return
(
*
(
SubstLookupSubTable
*
)(((
char
*
)
this
)
+
extensionOffset
)).
substitute
(
SUBTABLE_SUBSTITUTE_ARGS
,
get_type
());
}
struct
SubstLookup
:
Lookup
{
DEFINE_NON_INSTANTIABLE
(
SubstLookup
);
...
...
@@ -739,7 +787,7 @@ struct SubstLookup : Lookup {
/* Return lookup type of first extension subtable.
* The spec says all of them should have the same type.
* XXX check for that somehow */
//XXX type = get_subtable(0).v
.extension.get_type ();
type
=
get_subtable
(
0
).
u
.
extension
.
get_type
();
}
return
type
;
...
...
@@ -752,7 +800,7 @@ struct SubstLookup : Lookup {
}
}
inline
bool
substitute_once
(
hb_ot_layout_t
*
layout
,
bool
substitute_once
(
hb_ot_layout_t
*
layout
,
hb_buffer_t
*
buffer
,
unsigned
int
context_length
,
unsigned
int
nesting_level_left
)
const
{
...
...
@@ -765,15 +813,14 @@ struct SubstLookup : Lookup {
nesting_level_left
--
;
for
(
unsigned
int
i
=
0
;
i
<
get_subtable_count
();
i
++
)
if
(
get_subtable
(
i
).
substitute
(
layout
,
buffer
,
context_length
,
nesting_level_left
,
lookup_type
,
lookup_flag
))
if
(
get_subtable
(
i
).
substitute
(
SUBTABLE_SUBSTITUTE_ARGS
,
lookup_type
))
return
true
;
return
false
;
}
inline
bool
substitute_string
(
hb_ot_layout_t
*
layout
,
bool
substitute_string
(
hb_ot_layout_t
*
layout
,
hb_buffer_t
*
buffer
,
hb_ot_layout_feature_mask_t
mask
)
const
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录