Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Harfbuzz
提交
727135f3
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看板
提交
727135f3
编写于
7月 03, 2012
作者:
B
Behdad Esfahbod
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Towards templatizing common Lookup types
上级
1167c7bf
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
55 addition
and
18 deletion
+55
-18
src/hb-ot-layout-gpos-table.hh
src/hb-ot-layout-gpos-table.hh
+10
-6
src/hb-ot-layout-gsub-table.hh
src/hb-ot-layout-gsub-table.hh
+14
-10
src/hb-ot-layout-gsubgpos-private.hh
src/hb-ot-layout-gsubgpos-private.hh
+31
-2
未找到文件。
src/hb-ot-layout-gpos-table.hh
浏览文件 @
727135f3
...
...
@@ -1268,7 +1268,7 @@ struct ChainContextPos : ChainContext
};
struct
ExtensionPos
:
Extension
struct
ExtensionPos
:
Extension
<
struct
GPOS
>
{
friend
struct
PosLookupSubTable
;
...
...
@@ -1382,8 +1382,10 @@ struct PosLookupSubTable
struct
PosLookup
:
Lookup
{
inline
const
PosLookupSubTable
&
get_subtable
(
unsigned
int
i
)
const
{
return
this
+
CastR
<
OffsetArrayOf
<
PosLookupSubTable
>
>
(
subTable
)[
i
];
}
typedef
struct
PosLookupSubTable
SubTable
;
inline
const
SubTable
&
get_subtable
(
unsigned
int
i
)
const
{
return
this
+
CastR
<
OffsetArrayOf
<
SubTable
>
>
(
subTable
)[
i
];
}
inline
bool
apply_once
(
hb_apply_context_t
*
c
)
const
{
...
...
@@ -1424,7 +1426,7 @@ struct PosLookup : Lookup
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
)
{
TRACE_SANITIZE
();
if
(
unlikely
(
!
Lookup
::
sanitize
(
c
)))
return
TRACE_RETURN
(
false
);
OffsetArrayOf
<
PosLookupSubTable
>
&
list
=
CastR
<
OffsetArrayOf
<
PosLookup
SubTable
>
>
(
subTable
);
OffsetArrayOf
<
SubTable
>
&
list
=
CastR
<
OffsetArrayOf
<
SubTable
>
>
(
subTable
);
return
TRACE_RETURN
(
list
.
sanitize
(
c
,
this
,
get_type
()));
}
};
...
...
@@ -1437,6 +1439,8 @@ typedef OffsetListOf<PosLookup> PosLookupList;
struct
GPOS
:
GSUBGPOS
{
typedef
struct
PosLookup
Lookup
;
static
const
hb_tag_t
Tag
=
HB_OT_TAG_GPOS
;
inline
const
PosLookup
&
get_lookup
(
unsigned
int
i
)
const
...
...
@@ -1545,10 +1549,10 @@ inline bool ExtensionPos::apply (hb_apply_context_t *c) const
inline
bool
ExtensionPos
::
sanitize
(
hb_sanitize_context_t
*
c
)
{
TRACE_SANITIZE
();
if
(
unlikely
(
!
Extension
::
sanitize
(
c
)))
return
TRACE_RETURN
(
false
);
if
(
unlikely
(
!
Extension
<
GPOS
>
::
sanitize
(
c
)))
return
TRACE_RETURN
(
false
);
unsigned
int
offset
=
get_offset
();
if
(
unlikely
(
!
offset
))
return
TRACE_RETURN
(
true
);
return
TRACE_RETURN
(
StructAtOffset
<
PosLookupSubTable
>
(
this
,
offset
).
sanitize
(
c
,
get_type
()));
return
TRACE_RETURN
(
StructAtOffset
<
PosLookup
::
SubTable
>
(
this
,
offset
).
sanitize
(
c
,
get_type
()));
}
static
inline
bool
position_lookup
(
hb_apply_context_t
*
c
,
unsigned
int
lookup_index
)
...
...
src/hb-ot-layout-gsub-table.hh
浏览文件 @
727135f3
...
...
@@ -750,7 +750,7 @@ struct ChainContextSubst : ChainContext
};
struct
ExtensionSubst
:
Extension
struct
ExtensionSubst
:
Extension
<
struct
GSUB
>
{
friend
struct
SubstLookupSubTable
;
friend
struct
SubstLookup
;
...
...
@@ -1037,16 +1037,18 @@ struct SubstLookupSubTable
struct
SubstLookup
:
Lookup
{
inline
const
SubstLookupSubTable
&
get_subtable
(
unsigned
int
i
)
const
{
return
this
+
CastR
<
OffsetArrayOf
<
SubstLookupSubTable
>
>
(
subTable
)[
i
];
}
typedef
struct
SubstLookupSubTable
SubTable
;
inline
const
SubTable
&
get_subtable
(
unsigned
int
i
)
const
{
return
this
+
CastR
<
OffsetArrayOf
<
SubTable
>
>
(
subTable
)[
i
];
}
inline
static
bool
lookup_type_is_reverse
(
unsigned
int
lookup_type
)
{
return
lookup_type
==
Sub
stLookupSub
Table
::
ReverseChainSingle
;
}
{
return
lookup_type
==
SubTable
::
ReverseChainSingle
;
}
inline
bool
is_reverse
(
void
)
const
{
unsigned
int
type
=
get_type
();
if
(
unlikely
(
type
==
Sub
stLookupSub
Table
::
Extension
))
if
(
unlikely
(
type
==
SubTable
::
Extension
))
return
CastR
<
ExtensionSubst
>
(
get_subtable
(
0
)).
is_reverse
();
return
lookup_type_is_reverse
(
type
);
}
...
...
@@ -1087,7 +1089,7 @@ struct SubstLookup : Lookup
/* TODO: For the most common case this can move out of the main
* loop, but it's not a big deal for now. */
if
(
unlikely
(
lookup_type
==
Sub
stLookupSub
Table
::
Extension
))
if
(
unlikely
(
lookup_type
==
SubTable
::
Extension
))
{
/* The spec says all subtables should have the same type.
* This is specially important if one has a reverse type!
...
...
@@ -1155,7 +1157,7 @@ struct SubstLookup : Lookup
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
)
{
TRACE_SANITIZE
();
if
(
unlikely
(
!
Lookup
::
sanitize
(
c
)))
return
TRACE_RETURN
(
false
);
OffsetArrayOf
<
Sub
stLookupSubTable
>
&
list
=
CastR
<
OffsetArrayOf
<
SubstLookup
SubTable
>
>
(
subTable
);
OffsetArrayOf
<
Sub
Table
>
&
list
=
CastR
<
OffsetArrayOf
<
SubTable
>
>
(
subTable
);
return
TRACE_RETURN
(
list
.
sanitize
(
c
,
this
,
get_type
()));
}
};
...
...
@@ -1168,6 +1170,8 @@ typedef OffsetListOf<SubstLookup> SubstLookupList;
struct
GSUB
:
GSUBGPOS
{
typedef
struct
SubstLookup
Lookup
;
static
const
hb_tag_t
Tag
=
HB_OT_TAG_GSUB
;
inline
const
SubstLookup
&
get_lookup
(
unsigned
int
i
)
const
...
...
@@ -1238,16 +1242,16 @@ inline bool ExtensionSubst::apply (hb_apply_context_t *c) const
inline
bool
ExtensionSubst
::
sanitize
(
hb_sanitize_context_t
*
c
)
{
TRACE_SANITIZE
();
if
(
unlikely
(
!
Extension
::
sanitize
(
c
)))
return
TRACE_RETURN
(
false
);
if
(
unlikely
(
!
Extension
<
GSUB
>
::
sanitize
(
c
)))
return
TRACE_RETURN
(
false
);
unsigned
int
offset
=
get_offset
();
if
(
unlikely
(
!
offset
))
return
TRACE_RETURN
(
true
);
return
TRACE_RETURN
(
StructAtOffset
<
SubstLookup
SubTable
>
(
this
,
offset
).
sanitize
(
c
,
get_type
()));
return
TRACE_RETURN
(
StructAtOffset
<
GSUB
::
Lookup
::
SubTable
>
(
this
,
offset
).
sanitize
(
c
,
get_type
()));
}
inline
bool
ExtensionSubst
::
is_reverse
(
void
)
const
{
unsigned
int
type
=
get_type
();
if
(
unlikely
(
type
==
SubstLookupSubTable
::
Extension
))
if
(
unlikely
(
type
==
SubstLookup
::
SubTable
::
Extension
))
return
CastR
<
ExtensionSubst
>
(
get_subtable
()).
is_reverse
();
return
SubstLookup
::
lookup_type_is_reverse
(
type
);
}
...
...
src/hb-ot-layout-gsubgpos-private.hh
浏览文件 @
727135f3
...
...
@@ -298,6 +298,27 @@ static inline bool intersects_array (hb_closure_context_t *c,
}
struct
match_glyph_t
{
inline
bool
operator
()
(
hb_codepoint_t
glyph_id
,
const
USHORT
&
value
,
const
void
*
data
)
{
return
glyph_id
==
value
;
}
};
struct
match_class_t
{
inline
bool
operator
()
(
hb_codepoint_t
glyph_id
,
const
USHORT
&
value
,
const
void
*
data
)
{
const
ClassDef
&
class_def
=
*
reinterpret_cast
<
const
ClassDef
*>
(
data
);
return
class_def
.
get_class
(
glyph_id
)
==
value
;
}
};
struct
match_coverage_t
{
inline
bool
operator
()
(
hb_codepoint_t
glyph_id
,
const
USHORT
&
value
,
const
void
*
data
)
{
const
OffsetTo
<
Coverage
>
&
coverage
=
(
const
OffsetTo
<
Coverage
>&
)
value
;
return
(
data
+
coverage
).
get_coverage
(
glyph_id
)
!=
NOT_COVERED
;
}
};
static
inline
bool
match_glyph
(
hb_codepoint_t
glyph_id
,
const
USHORT
&
value
,
const
void
*
data
HB_UNUSED
)
{
return
glyph_id
==
value
;
...
...
@@ -314,6 +335,7 @@ static inline bool match_coverage (hb_codepoint_t glyph_id, const USHORT &value,
}
template
<
typename
match_func_t
>
static
inline
bool
match_input
(
hb_apply_context_t
*
c
,
unsigned
int
count
,
/* Including the first glyph (not matched) */
const
USHORT
input
[],
/* Array of input values--start with second glyph */
...
...
@@ -340,6 +362,7 @@ static inline bool match_input (hb_apply_context_t *c,
return
true
;
}
template
<
typename
match_func_t
>
static
inline
bool
match_backtrack
(
hb_apply_context_t
*
c
,
unsigned
int
count
,
const
USHORT
backtrack
[],
...
...
@@ -362,6 +385,7 @@ static inline bool match_backtrack (hb_apply_context_t *c,
return
true
;
}
template
<
typename
match_func_t
>
static
inline
bool
match_lookahead
(
hb_apply_context_t
*
c
,
unsigned
int
count
,
const
USHORT
lookahead
[],
...
...
@@ -1262,9 +1286,12 @@ struct ChainContext
};
template
<
typename
Table
>
struct
Extension
;
template
<
typename
Table
>
struct
ExtensionFormat1
{
friend
struct
Extension
;
friend
struct
Extension
<
Table
>
;
protected:
inline
unsigned
int
get_type
(
void
)
const
{
return
extensionLookupType
;
}
...
...
@@ -1286,6 +1313,7 @@ struct ExtensionFormat1
DEFINE_SIZE_STATIC
(
8
);
};
template
<
typename
Table
>
struct
Extension
{
inline
unsigned
int
get_type
(
void
)
const
...
...
@@ -1315,7 +1343,8 @@ struct Extension
private:
union
{
USHORT
format
;
/* Format identifier */
ExtensionFormat1
format1
;
ExtensionFormat1
<
Table
>
format1
;
}
u
;
};
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录