Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Harfbuzz
提交
60d77cf0
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看板
提交
60d77cf0
编写于
5月 19, 2009
作者:
B
Behdad Esfahbod
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[HB] Indentation
上级
90de3dff
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
288 addition
and
265 deletion
+288
-265
src/hb-ot-layout-common-private.h
src/hb-ot-layout-common-private.h
+82
-88
src/hb-ot-layout-gdef-private.h
src/hb-ot-layout-gdef-private.h
+35
-30
src/hb-ot-layout-gsubgpos-private.h
src/hb-ot-layout-gsubgpos-private.h
+84
-66
src/hb-ot-layout-open-private.h
src/hb-ot-layout-open-private.h
+81
-78
src/hb-ot-layout-private.h
src/hb-ot-layout-private.h
+6
-3
未找到文件。
src/hb-ot-layout-common-private.h
浏览文件 @
60d77cf0
...
...
@@ -42,7 +42,8 @@
*/
template
<
typename
Type
>
struct
Record
{
struct
Record
{
Tag
tag
;
/* 4-byte Tag identifier */
OffsetTo
<
Type
>
offset
;
/* Offset from beginning of object holding
...
...
@@ -50,12 +51,15 @@ struct Record {
};
template
<
typename
Type
>
struct
RecordListOf
:
ArrayOf
<
Record
<
Type
>
>
{
inline
const
Type
&
operator
[]
(
unsigned
int
i
)
const
{
struct
RecordListOf
:
ArrayOf
<
Record
<
Type
>
>
{
inline
const
Type
&
operator
[]
(
unsigned
int
i
)
const
{
if
(
HB_UNLIKELY
(
i
>=
this
->
len
))
return
Null
(
Type
);
return
this
+
this
->
array
[
i
].
offset
;
}
inline
const
Tag
&
get_tag
(
unsigned
int
i
)
const
{
inline
const
Tag
&
get_tag
(
unsigned
int
i
)
const
{
if
(
HB_UNLIKELY
(
i
>=
this
->
len
))
return
Null
(
Tag
);
return
this
->
array
[
i
].
tag
;
}
...
...
@@ -73,20 +77,14 @@ typedef Record<Feature> FeatureRecord;
ASSERT_SIZE
(
FeatureRecord
,
6
);
struct
LangSys
{
struct
LangSys
{
inline
const
unsigned
int
get_feature_index
(
unsigned
int
i
)
const
{
return
featureIndex
[
i
];
}
inline
unsigned
int
get_feature_count
(
void
)
const
{
return
featureIndex
.
len
;
}
inline
const
unsigned
int
get_feature_index
(
unsigned
int
i
)
const
{
return
featureIndex
[
i
];
}
inline
unsigned
int
get_feature_count
(
void
)
const
{
return
featureIndex
.
len
;
}
inline
const
bool
has_required_feature
(
void
)
const
{
return
reqFeatureIndex
!=
0xffff
;
}
/* Returns NO_INDEX if none */
inline
int
get_required_feature_index
(
void
)
const
{
inline
const
bool
has_required_feature
(
void
)
const
{
return
reqFeatureIndex
!=
0xffff
;
}
inline
int
get_required_feature_index
(
void
)
const
{
if
(
reqFeatureIndex
==
0xffff
)
return
NO_INDEX
;
return
reqFeatureIndex
;;
...
...
@@ -103,28 +101,21 @@ struct LangSys {
ASSERT_SIZE_DATA
(
LangSys
,
6
,
"
\0\0\xFF\xFF
"
);
struct
Script
{
inline
const
LangSys
&
get_lang_sys
(
unsigned
int
i
)
const
{
struct
Script
{
inline
const
LangSys
&
get_lang_sys
(
unsigned
int
i
)
const
{
if
(
i
==
NO_INDEX
)
return
get_default_lang_sys
();
return
this
+
langSys
[
i
].
offset
;
}
inline
unsigned
int
get_lang_sys_count
(
void
)
const
{
return
langSys
.
len
;
}
inline
const
Tag
&
get_lang_sys_tag
(
unsigned
int
i
)
const
{
return
langSys
[
i
].
tag
;
}
inline
unsigned
int
get_lang_sys_count
(
void
)
const
{
return
langSys
.
len
;
}
inline
const
Tag
&
get_lang_sys_tag
(
unsigned
int
i
)
const
{
return
langSys
[
i
].
tag
;
}
// LONGTERMTODO bsearch
DEFINE_TAG_FIND_INTERFACE
(
LangSys
,
lang_sys
);
/* find_lang_sys_index (), get_lang_sys_by_tag (tag) */
inline
const
bool
has_default_lang_sys
(
void
)
const
{
return
defaultLangSys
!=
0
;
}
inline
const
LangSys
&
get_default_lang_sys
(
void
)
const
{
return
this
+
defaultLangSys
;
}
inline
const
bool
has_default_lang_sys
(
void
)
const
{
return
defaultLangSys
!=
0
;
}
inline
const
LangSys
&
get_default_lang_sys
(
void
)
const
{
return
this
+
defaultLangSys
;
}
private:
OffsetTo
<
LangSys
>
...
...
@@ -140,14 +131,10 @@ typedef RecordListOf<Script> ScriptList;
ASSERT_SIZE
(
ScriptList
,
2
);
struct
Feature
{
inline
const
unsigned
int
get_lookup_index
(
unsigned
int
i
)
const
{
return
lookupIndex
[
i
];
}
inline
unsigned
int
get_lookup_count
(
void
)
const
{
return
lookupIndex
.
len
;
}
struct
Feature
{
inline
const
unsigned
int
get_lookup_index
(
unsigned
int
i
)
const
{
return
lookupIndex
[
i
];
}
inline
unsigned
int
get_lookup_count
(
void
)
const
{
return
lookupIndex
.
len
;
}
/* TODO: implement get_feature_parameters() */
/* TODO: implement FeatureSize and other special features? */
...
...
@@ -164,7 +151,8 @@ typedef RecordListOf<Feature> FeatureList;
ASSERT_SIZE
(
FeatureList
,
2
);
struct
LookupFlag
:
USHORT
{
struct
LookupFlag
:
USHORT
{
enum
{
RightToLeft
=
0x0001u
,
IgnoreBaseGlyphs
=
0x0002u
,
...
...
@@ -176,20 +164,17 @@ struct LookupFlag : USHORT {
};
ASSERT_SIZE
(
LookupFlag
,
2
);
struct
LookupSubTable
{
struct
LookupSubTable
{
private:
USHORT
format
;
/* Subtable format. Different for GSUB and GPOS */
};
ASSERT_SIZE
(
LookupSubTable
,
2
);
struct
Lookup
{
inline
const
LookupSubTable
&
get_subtable
(
unsigned
int
i
)
const
{
return
this
+
subTable
[
i
];
}
inline
unsigned
int
get_subtable_count
(
void
)
const
{
return
subTable
.
len
;
}
struct
Lookup
{
inline
const
LookupSubTable
&
get_subtable
(
unsigned
int
i
)
const
{
return
this
+
subTable
[
i
];
}
inline
unsigned
int
get_subtable_count
(
void
)
const
{
return
subTable
.
len
;
}
inline
unsigned
int
get_type
(
void
)
const
{
return
lookupType
;
}
inline
unsigned
int
get_flag
(
void
)
const
{
return
lookupFlag
;
}
...
...
@@ -202,8 +187,10 @@ struct Lookup {
ASSERT_SIZE
(
Lookup
,
6
);
template
<
typename
Type
>
struct
OffsetListOf
:
OffsetArrayOf
<
Type
>
{
inline
const
Type
&
operator
[]
(
unsigned
int
i
)
const
{
struct
OffsetListOf
:
OffsetArrayOf
<
Type
>
{
inline
const
Type
&
operator
[]
(
unsigned
int
i
)
const
{
if
(
HB_UNLIKELY
(
i
>=
this
->
len
))
return
Null
(
Type
);
return
this
+
this
->
array
[
i
];
}
...
...
@@ -217,12 +204,13 @@ ASSERT_SIZE (LookupList, 2);
* Coverage Table
*/
struct
CoverageFormat1
{
struct
CoverageFormat1
{
friend
struct
Coverage
;
private:
inline
unsigned
int
get_coverage
(
hb_codepoint_t
glyph_id
)
const
{
inline
unsigned
int
get_coverage
(
hb_codepoint_t
glyph_id
)
const
{
if
(
HB_UNLIKELY
(
glyph_id
>
0xFFFF
))
return
NOT_COVERED
;
GlyphID
gid
;
...
...
@@ -241,12 +229,13 @@ struct CoverageFormat1 {
};
ASSERT_SIZE
(
CoverageFormat1
,
4
);
struct
CoverageRangeRecord
{
struct
CoverageRangeRecord
{
friend
struct
CoverageFormat2
;
private:
inline
unsigned
int
get_coverage
(
hb_codepoint_t
glyph_id
)
const
{
inline
unsigned
int
get_coverage
(
hb_codepoint_t
glyph_id
)
const
{
if
(
glyph_id
>=
start
&&
glyph_id
<=
end
)
return
(
unsigned
int
)
startCoverageIndex
+
(
glyph_id
-
start
);
return
NOT_COVERED
;
...
...
@@ -260,15 +249,17 @@ struct CoverageRangeRecord {
};
ASSERT_SIZE_DATA
(
CoverageRangeRecord
,
6
,
"
\000\001
"
);
struct
CoverageFormat2
{
struct
CoverageFormat2
{
friend
struct
Coverage
;
private:
inline
unsigned
int
get_coverage
(
hb_codepoint_t
glyph_id
)
const
{
inline
unsigned
int
get_coverage
(
hb_codepoint_t
glyph_id
)
const
{
// TODO: bsearch
unsigned
int
count
=
rangeRecord
.
len
;
for
(
unsigned
int
i
=
0
;
i
<
count
;
i
++
)
{
for
(
unsigned
int
i
=
0
;
i
<
count
;
i
++
)
{
unsigned
int
coverage
=
rangeRecord
[
i
].
get_coverage
(
glyph_id
);
if
(
coverage
!=
NOT_COVERED
)
return
coverage
;
...
...
@@ -284,8 +275,10 @@ struct CoverageFormat2 {
};
ASSERT_SIZE
(
CoverageFormat2
,
4
);
struct
Coverage
{
unsigned
int
get_coverage
(
hb_codepoint_t
glyph_id
)
const
{
struct
Coverage
{
unsigned
int
get_coverage
(
hb_codepoint_t
glyph_id
)
const
{
switch
(
u
.
format
)
{
case
1
:
return
u
.
format1
->
get_coverage
(
glyph_id
);
case
2
:
return
u
.
format2
->
get_coverage
(
glyph_id
);
...
...
@@ -293,9 +286,7 @@ struct Coverage {
}
}
inline
unsigned
int
operator
()
(
hb_codepoint_t
glyph_id
)
const
{
return
get_coverage
(
glyph_id
);
}
inline
unsigned
int
operator
()
(
hb_codepoint_t
glyph_id
)
const
{
return
get_coverage
(
glyph_id
);
}
private:
union
{
...
...
@@ -311,12 +302,13 @@ ASSERT_SIZE (Coverage, 2);
* Class Definition Table
*/
struct
ClassDefFormat1
{
struct
ClassDefFormat1
{
friend
struct
ClassDef
;
private:
inline
hb_ot_layout_class_t
get_class
(
hb_codepoint_t
glyph_id
)
const
{
inline
hb_ot_layout_class_t
get_class
(
hb_codepoint_t
glyph_id
)
const
{
if
((
unsigned
int
)
(
glyph_id
-
startGlyph
)
<
classValue
.
len
)
return
classValue
[
glyph_id
-
startGlyph
];
return
0
;
...
...
@@ -329,12 +321,13 @@ struct ClassDefFormat1 {
};
ASSERT_SIZE
(
ClassDefFormat1
,
6
);
struct
ClassRangeRecord
{
struct
ClassRangeRecord
{
friend
struct
ClassDefFormat2
;
private:
inline
hb_ot_layout_class_t
get_class
(
hb_codepoint_t
glyph_id
)
const
{
inline
hb_ot_layout_class_t
get_class
(
hb_codepoint_t
glyph_id
)
const
{
if
(
glyph_id
>=
start
&&
glyph_id
<=
end
)
return
classValue
;
return
0
;
...
...
@@ -347,15 +340,17 @@ struct ClassRangeRecord {
};
ASSERT_SIZE_DATA
(
ClassRangeRecord
,
6
,
"
\000\001
"
);
struct
ClassDefFormat2
{
struct
ClassDefFormat2
{
friend
struct
ClassDef
;
private:
inline
hb_ot_layout_class_t
get_class
(
hb_codepoint_t
glyph_id
)
const
{
inline
hb_ot_layout_class_t
get_class
(
hb_codepoint_t
glyph_id
)
const
{
// TODO: bsearch
unsigned
int
count
=
rangeRecord
.
len
;
for
(
unsigned
int
i
=
0
;
i
<
count
;
i
++
)
{
for
(
unsigned
int
i
=
0
;
i
<
count
;
i
++
)
{
int
classValue
=
rangeRecord
[
i
].
get_class
(
glyph_id
);
if
(
classValue
>
0
)
return
classValue
;
...
...
@@ -370,8 +365,10 @@ struct ClassDefFormat2 {
};
ASSERT_SIZE
(
ClassDefFormat2
,
4
);
struct
ClassDef
{
hb_ot_layout_class_t
get_class
(
hb_codepoint_t
glyph_id
)
const
{
struct
ClassDef
{
hb_ot_layout_class_t
get_class
(
hb_codepoint_t
glyph_id
)
const
{
switch
(
u
.
format
)
{
case
1
:
return
u
.
format1
->
get_class
(
glyph_id
);
case
2
:
return
u
.
format2
->
get_class
(
glyph_id
);
...
...
@@ -379,9 +376,7 @@ struct ClassDef {
}
}
inline
unsigned
int
operator
()
(
hb_codepoint_t
glyph_id
)
const
{
return
get_class
(
glyph_id
);
}
inline
unsigned
int
operator
()
(
hb_codepoint_t
glyph_id
)
const
{
return
get_class
(
glyph_id
);
}
private:
union
{
...
...
@@ -397,9 +392,10 @@ ASSERT_SIZE (ClassDef, 2);
* Device Tables
*/
struct
Device
{
int
get_delta
(
unsigned
int
ppem_size
)
const
{
struct
Device
{
int
get_delta
(
unsigned
int
ppem_size
)
const
{
unsigned
int
f
=
deltaFormat
;
if
(
HB_UNLIKELY
(
f
<
1
||
f
>
3
))
return
0
;
...
...
@@ -421,9 +417,7 @@ struct Device {
return
delta
;
}
inline
int
operator
()
(
unsigned
int
ppem_size
)
const
{
return
get_delta
(
ppem_size
);
}
inline
int
operator
()
(
unsigned
int
ppem_size
)
const
{
return
get_delta
(
ppem_size
);
}
private:
USHORT
startSize
;
/* Smallest size to correct--in ppem */
...
...
src/hb-ot-layout-gdef-private.h
浏览文件 @
60d77cf0
...
...
@@ -31,12 +31,11 @@
#define DEFINE_INDIRECT_GLYPH_ARRAY_LOOKUP(Type, array, name) \
inline const Type& name (hb_codepoint_t glyph) { \
return this+array[(this+coverage)(glyph)]; \
}
inline const Type& name (hb_codepoint_t glyph) { return this+array[(this+coverage)(glyph)]; }
struct
GlyphClassDef
:
ClassDef
{
struct
GlyphClassDef
:
ClassDef
{
enum
{
BaseGlyph
=
0x0001u
,
LigatureGlyph
=
0x0002u
,
...
...
@@ -49,15 +48,16 @@ struct GlyphClassDef : ClassDef {
* Attachment List Table
*/
struct
AttachPoint
{
struct
AttachPoint
{
ArrayOf
<
USHORT
>
pointIndex
;
/* Array of contour point indices--in
* increasing numerical order */
};
ASSERT_SIZE
(
AttachPoint
,
2
);
struct
AttachList
{
struct
AttachList
{
/* const AttachPoint& get_attach_points (hb_codepoint_t glyph); */
DEFINE_INDIRECT_GLYPH_ARRAY_LOOKUP
(
AttachPoint
,
attachPoint
,
get_attach_points
);
...
...
@@ -75,12 +75,14 @@ ASSERT_SIZE (AttachList, 4);
* Ligature Caret Table
*/
struct
CaretValueFormat1
{
struct
CaretValueFormat1
{
friend
struct
CaretValue
;
private:
inline
int
get_caret_value
(
int
ppem
)
const
{
inline
int
get_caret_value
(
int
ppem
)
const
{
/* XXX unsigned int */
return
/* TODO garbage */
coordinate
/
ppem
;
}
...
...
@@ -90,12 +92,13 @@ struct CaretValueFormat1 {
};
ASSERT_SIZE
(
CaretValueFormat1
,
4
);
struct
CaretValueFormat2
{
struct
CaretValueFormat2
{
friend
struct
CaretValue
;
private:
inline
int
get_caret_value
(
int
ppem
)
const
{
inline
int
get_caret_value
(
int
ppem
)
const
{
return
/* TODO garbage */
0
/
ppem
;
}
...
...
@@ -105,17 +108,19 @@ struct CaretValueFormat2 {
};
ASSERT_SIZE
(
CaretValueFormat2
,
4
);
struct
CaretValueFormat3
{
struct
CaretValueFormat3
{
friend
struct
CaretValue
;
private:
inline
const
Device
&
get_device
(
void
)
const
{
inline
const
Device
&
get_device
(
void
)
const
{
if
(
HB_UNLIKELY
(
!
deviceTable
))
return
Null
(
Device
);
return
(
const
Device
&
)
*
((
const
char
*
)
this
+
deviceTable
);
}
inline
int
get_caret_value
(
int
ppem
)
const
{
inline
int
get_caret_value
(
int
ppem
)
const
{
return
/* TODO garbage */
(
coordinate
+
get_device
().
get_delta
(
ppem
))
/
ppem
;
}
...
...
@@ -128,9 +133,11 @@ struct CaretValueFormat3 {
};
ASSERT_SIZE
(
CaretValueFormat3
,
6
);
struct
CaretValue
{
struct
CaretValue
{
/* XXX we need access to a load-contour-point vfunc here */
int
get_caret_value
(
int
ppem
)
const
{
int
get_caret_value
(
int
ppem
)
const
{
switch
(
u
.
format
)
{
case
1
:
return
u
.
format1
->
get_caret_value
(
ppem
);
case
2
:
return
u
.
format2
->
get_caret_value
(
ppem
);
...
...
@@ -149,18 +156,19 @@ struct CaretValue {
};
ASSERT_SIZE
(
CaretValue
,
2
);
struct
LigGlyph
{
struct
LigGlyph
{
friend
struct
LigCaretList
;
private:
OffsetArrayOf
<
CaretValue
>
caret
;
/* Array of CaretValue tables
* in increasing coordinate order */
};
ASSERT_SIZE
(
LigGlyph
,
2
);
struct
LigCaretList
{
struct
LigCaretList
{
friend
struct
GDEF
;
private:
...
...
@@ -181,7 +189,8 @@ ASSERT_SIZE (LigCaretList, 4);
* GDEF
*/
struct
GDEF
{
struct
GDEF
{
static
const
hb_tag_t
Tag
=
HB_TAG
(
'G'
,
'D'
,
'E'
,
'F'
);
enum
{
...
...
@@ -196,14 +205,10 @@ struct GDEF {
/* XXX check version here? */
inline
bool
has_glyph_classes
()
const
{
return
glyphClassDef
!=
0
;
}
inline
hb_ot_layout_class_t
get_glyph_class
(
hb_codepoint_t
glyph
)
const
{
return
glyphClassDef
(
this
).
get_class
(
glyph
);
}
inline
hb_ot_layout_class_t
get_glyph_class
(
hb_codepoint_t
glyph
)
const
{
return
glyphClassDef
(
this
).
get_class
(
glyph
);
}
inline
bool
has_mark_attachment_types
()
const
{
return
markAttachClassDef
!=
0
;
}
inline
hb_ot_layout_class_t
get_mark_attachment_type
(
hb_codepoint_t
glyph
)
const
{
return
markAttachClassDef
(
this
).
get_class
(
glyph
);
}
inline
hb_ot_layout_class_t
get_mark_attachment_type
(
hb_codepoint_t
glyph
)
const
{
return
markAttachClassDef
(
this
).
get_class
(
glyph
);
}
/* TODO get_attach and get_lig_caret */
inline
bool
has_attach_list
()
const
{
return
attachList
!=
0
;
}
...
...
src/hb-ot-layout-gsubgpos-private.h
浏览文件 @
60d77cf0
...
...
@@ -50,22 +50,26 @@
typedef
bool
(
*
match_func_t
)
(
hb_codepoint_t
glyph_id
,
const
USHORT
&
value
,
char
*
data
);
typedef
bool
(
*
apply_lookup_func_t
)
(
APPLY_ARG_DEF
,
unsigned
int
lookup_index
);
struct
ContextFuncs
{
struct
ContextFuncs
{
match_func_t
match
;
apply_lookup_func_t
apply
;
};
static
inline
bool
match_glyph
(
hb_codepoint_t
glyph_id
,
const
USHORT
&
value
,
char
*
data
)
{
static
inline
bool
match_glyph
(
hb_codepoint_t
glyph_id
,
const
USHORT
&
value
,
char
*
data
)
{
return
glyph_id
==
value
;
}
static
inline
bool
match_class
(
hb_codepoint_t
glyph_id
,
const
USHORT
&
value
,
char
*
data
)
{
static
inline
bool
match_class
(
hb_codepoint_t
glyph_id
,
const
USHORT
&
value
,
char
*
data
)
{
const
ClassDef
&
class_def
=
(
const
ClassDef
&
)
*
data
;
return
class_def
.
get_class
(
glyph_id
)
==
value
;
}
static
inline
bool
match_coverage
(
hb_codepoint_t
glyph_id
,
const
USHORT
&
value
,
char
*
data
)
{
static
inline
bool
match_coverage
(
hb_codepoint_t
glyph_id
,
const
USHORT
&
value
,
char
*
data
)
{
const
OffsetTo
<
Coverage
>
&
coverage
=
(
const
OffsetTo
<
Coverage
>&
)
value
;
return
(
data
+
coverage
)
(
glyph_id
)
!=
NOT_COVERED
;
}
...
...
@@ -83,8 +87,10 @@ static inline bool match_input (APPLY_ARG_DEF,
if
(
HB_UNLIKELY
(
buffer
->
in_pos
+
count
>
end
))
return
false
;
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
))
{
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
==
end
))
return
false
;
j
++
;
...
...
@@ -108,8 +114,10 @@ static inline bool match_backtrack (APPLY_ARG_DEF,
if
(
HB_UNLIKELY
(
buffer
->
out_pos
<
count
))
return
false
;
for
(
unsigned
int
i
=
0
,
j
=
buffer
->
out_pos
-
1
;
i
<
count
;
i
++
,
j
--
)
{
while
(
!
_hb_ot_layout_check_glyph_property
(
layout
,
OUT_ITEM
(
j
),
lookup_flag
,
&
property
))
{
for
(
unsigned
int
i
=
0
,
j
=
buffer
->
out_pos
-
1
;
i
<
count
;
i
++
,
j
--
)
{
while
(
!
_hb_ot_layout_check_glyph_property
(
layout
,
OUT_ITEM
(
j
),
lookup_flag
,
&
property
))
{
if
(
HB_UNLIKELY
(
j
+
1
==
count
-
i
))
return
false
;
j
--
;
...
...
@@ -134,8 +142,10 @@ static inline bool match_lookahead (APPLY_ARG_DEF,
if
(
HB_UNLIKELY
(
buffer
->
in_pos
+
offset
+
count
>
end
))
return
false
;
for
(
i
=
0
,
j
=
buffer
->
in_pos
+
offset
;
i
<
count
;
i
++
,
j
++
)
{
while
(
!
_hb_ot_layout_check_glyph_property
(
layout
,
OUT_ITEM
(
j
),
lookup_flag
,
&
property
))
{
for
(
i
=
0
,
j
=
buffer
->
in_pos
+
offset
;
i
<
count
;
i
++
,
j
++
)
{
while
(
!
_hb_ot_layout_check_glyph_property
(
layout
,
OUT_ITEM
(
j
),
lookup_flag
,
&
property
))
{
if
(
HB_UNLIKELY
(
j
+
count
-
i
==
end
))
return
false
;
j
++
;
...
...
@@ -149,8 +159,8 @@ static inline bool match_lookahead (APPLY_ARG_DEF,
}
struct
LookupRecord
{
struct
LookupRecord
{
USHORT
sequenceIndex
;
/* Index into current glyph
* sequence--first glyph = 0 */
USHORT
lookupListIndex
;
/* Lookup to apply to that
...
...
@@ -170,8 +180,10 @@ static inline bool apply_lookup (APPLY_ARG_DEF,
/* TODO We don't support lookupRecord arrays that are not increasing:
* Should be easy for in_place ones at least. */
for
(
unsigned
int
i
=
0
;
i
<
count
;
i
++
)
{
while
(
!
_hb_ot_layout_check_glyph_property
(
layout
,
IN_CURITEM
(),
lookup_flag
,
&
property
))
{
for
(
unsigned
int
i
=
0
;
i
<
count
;
i
++
)
{
while
(
!
_hb_ot_layout_check_glyph_property
(
layout
,
IN_CURITEM
(),
lookup_flag
,
&
property
))
{
if
(
HB_UNLIKELY
(
buffer
->
in_pos
==
end
))
return
true
;
/* No lookup applied for this index */
...
...
@@ -209,7 +221,8 @@ static inline bool apply_lookup (APPLY_ARG_DEF,
/* Contextual lookups */
struct
ContextLookupContext
{
struct
ContextLookupContext
{
ContextFuncs
funcs
;
char
*
match_data
;
};
...
...
@@ -231,12 +244,13 @@ static inline bool context_lookup (APPLY_ARG_DEF,
context
.
funcs
.
apply
);
}
struct
Rule
{
struct
Rule
{
friend
struct
RuleSet
;
private:
inline
bool
apply
(
APPLY_ARG_DEF
,
ContextLookupContext
&
context
)
const
{
inline
bool
apply
(
APPLY_ARG_DEF
,
ContextLookupContext
&
context
)
const
{
const
LookupRecord
*
lookupRecord
=
(
const
LookupRecord
*
)
((
const
char
*
)
input
+
sizeof
(
input
[
0
])
*
(
inputCount
?
inputCount
-
1
:
0
));
...
...
@@ -258,12 +272,13 @@ struct Rule {
};
ASSERT_SIZE
(
Rule
,
4
);
struct
RuleSet
{
inline
bool
apply
(
APPLY_ARG_DEF
,
ContextLookupContext
&
context
)
const
{
struct
RuleSet
{
inline
bool
apply
(
APPLY_ARG_DEF
,
ContextLookupContext
&
context
)
const
{
unsigned
int
num_rules
=
rule
.
len
;
for
(
unsigned
int
i
=
0
;
i
<
num_rules
;
i
++
)
{
for
(
unsigned
int
i
=
0
;
i
<
num_rules
;
i
++
)
{
if
((
this
+
rule
[
i
]).
apply
(
APPLY_ARG
,
context
))
return
true
;
}
...
...
@@ -278,13 +293,13 @@ struct RuleSet {
};
struct
ContextFormat1
{
struct
ContextFormat1
{
friend
struct
Context
;
private:
inline
bool
apply
(
APPLY_ARG_DEF
,
apply_lookup_func_t
apply_func
)
const
{
inline
bool
apply
(
APPLY_ARG_DEF
,
apply_lookup_func_t
apply_func
)
const
{
unsigned
int
index
=
(
this
+
coverage
)
(
IN_CURGLYPH
());
if
(
HB_LIKELY
(
index
==
NOT_COVERED
))
return
false
;
...
...
@@ -309,13 +324,13 @@ struct ContextFormat1 {
ASSERT_SIZE
(
ContextFormat1
,
6
);
struct
ContextFormat2
{
struct
ContextFormat2
{
friend
struct
Context
;
private:
inline
bool
apply
(
APPLY_ARG_DEF
,
apply_lookup_func_t
apply_func
)
const
{
inline
bool
apply
(
APPLY_ARG_DEF
,
apply_lookup_func_t
apply_func
)
const
{
unsigned
int
index
=
(
this
+
coverage
)
(
IN_CURGLYPH
());
if
(
HB_LIKELY
(
index
==
NOT_COVERED
))
return
false
;
...
...
@@ -348,13 +363,13 @@ struct ContextFormat2 {
ASSERT_SIZE
(
ContextFormat2
,
8
);
struct
ContextFormat3
{
struct
ContextFormat3
{
friend
struct
Context
;
private:
inline
bool
apply
(
APPLY_ARG_DEF
,
apply_lookup_func_t
apply_func
)
const
{
inline
bool
apply
(
APPLY_ARG_DEF
,
apply_lookup_func_t
apply_func
)
const
{
unsigned
int
index
=
(
this
+
coverage
[
0
])
(
IN_CURGLYPH
());
if
(
HB_LIKELY
(
index
==
NOT_COVERED
))
return
false
;
...
...
@@ -385,10 +400,11 @@ struct ContextFormat3 {
};
ASSERT_SIZE
(
ContextFormat3
,
6
);
struct
Context
{
struct
Context
{
protected:
bool
apply
(
APPLY_ARG_DEF
,
apply_lookup_func_t
apply_func
)
const
{
bool
apply
(
APPLY_ARG_DEF
,
apply_lookup_func_t
apply_func
)
const
{
switch
(
u
.
format
)
{
case
1
:
return
u
.
format1
->
apply
(
APPLY_ARG
,
apply_func
);
case
2
:
return
u
.
format2
->
apply
(
APPLY_ARG
,
apply_func
);
...
...
@@ -410,7 +426,8 @@ ASSERT_SIZE (Context, 2);
/* Chaining Contextual lookups */
struct
ChainContextLookupContext
{
struct
ChainContextLookupContext
{
ContextFuncs
funcs
;
char
*
match_data
[
3
];
};
...
...
@@ -451,12 +468,13 @@ static inline bool chain_context_lookup (APPLY_ARG_DEF,
context
.
funcs
.
apply
);
}
struct
ChainRule
{
struct
ChainRule
{
friend
struct
ChainRuleSet
;
private:
inline
bool
apply
(
APPLY_ARG_DEF
,
ChainContextLookupContext
&
context
)
const
{
inline
bool
apply
(
APPLY_ARG_DEF
,
ChainContextLookupContext
&
context
)
const
{
const
HeadlessArrayOf
<
USHORT
>
&
input
=
(
const
HeadlessArrayOf
<
USHORT
>&
)
*
((
const
char
*
)
&
backtrack
+
backtrack
.
get_size
());
const
ArrayOf
<
USHORT
>
&
lookahead
=
(
const
ArrayOf
<
USHORT
>&
)
...
...
@@ -490,12 +508,13 @@ struct ChainRule {
};
ASSERT_SIZE
(
ChainRule
,
8
);
struct
ChainRuleSet
{
inline
bool
apply
(
APPLY_ARG_DEF
,
ChainContextLookupContext
&
context
)
const
{
struct
ChainRuleSet
{
inline
bool
apply
(
APPLY_ARG_DEF
,
ChainContextLookupContext
&
context
)
const
{
unsigned
int
num_rules
=
rule
.
len
;
for
(
unsigned
int
i
=
0
;
i
<
num_rules
;
i
++
)
{
for
(
unsigned
int
i
=
0
;
i
<
num_rules
;
i
++
)
{
if
((
this
+
rule
[
i
]).
apply
(
APPLY_ARG
,
context
))
return
true
;
}
...
...
@@ -510,13 +529,13 @@ struct ChainRuleSet {
};
ASSERT_SIZE
(
ChainRuleSet
,
2
);
struct
ChainContextFormat1
{
struct
ChainContextFormat1
{
friend
struct
ChainContext
;
private:
inline
bool
apply
(
APPLY_ARG_DEF
,
apply_lookup_func_t
apply_func
)
const
{
inline
bool
apply
(
APPLY_ARG_DEF
,
apply_lookup_func_t
apply_func
)
const
{
unsigned
int
index
=
(
this
+
coverage
)
(
IN_CURGLYPH
());
if
(
HB_LIKELY
(
index
==
NOT_COVERED
))
return
false
;
...
...
@@ -539,13 +558,13 @@ struct ChainContextFormat1 {
};
ASSERT_SIZE
(
ChainContextFormat1
,
6
);
struct
ChainContextFormat2
{
struct
ChainContextFormat2
{
friend
struct
ChainContext
;
private:
inline
bool
apply
(
APPLY_ARG_DEF
,
apply_lookup_func_t
apply_func
)
const
{
inline
bool
apply
(
APPLY_ARG_DEF
,
apply_lookup_func_t
apply_func
)
const
{
unsigned
int
index
=
(
this
+
coverage
)
(
IN_CURGLYPH
());
if
(
HB_LIKELY
(
index
==
NOT_COVERED
))
return
false
;
...
...
@@ -591,17 +610,14 @@ struct ChainContextFormat2 {
};
ASSERT_SIZE
(
ChainContextFormat2
,
12
);
struct
ChainContextFormat3
{
struct
ChainContextFormat3
{
friend
struct
ChainContext
;
private:
inline
bool
apply_coverage
(
APPLY_ARG_DEF
,
apply_lookup_func_t
apply_func
)
const
{
}
inline
bool
apply
(
APPLY_ARG_DEF
,
apply_lookup_func_t
apply_func
)
const
{
inline
bool
apply
(
APPLY_ARG_DEF
,
apply_lookup_func_t
apply_func
)
const
{
const
OffsetArrayOf
<
Coverage
>
&
input
=
(
const
OffsetArrayOf
<
Coverage
>&
)
*
((
const
char
*
)
&
backtrack
+
backtrack
.
get_size
());
...
...
@@ -646,10 +662,11 @@ struct ChainContextFormat3 {
};
ASSERT_SIZE
(
ChainContextFormat3
,
10
);
struct
ChainContext
{
struct
ChainContext
{
protected:
bool
apply
(
APPLY_ARG_DEF
,
apply_lookup_func_t
apply_func
)
const
{
bool
apply
(
APPLY_ARG_DEF
,
apply_lookup_func_t
apply_func
)
const
{
switch
(
u
.
format
)
{
case
1
:
return
u
.
format1
->
apply
(
APPLY_ARG
,
apply_func
);
case
2
:
return
u
.
format2
->
apply
(
APPLY_ARG
,
apply_func
);
...
...
@@ -673,7 +690,8 @@ ASSERT_SIZE (ChainContext, 2);
* GSUB/GPOS Common
*/
struct
GSUBGPOS
{
struct
GSUBGPOS
{
static
const
hb_tag_t
GSUBTag
=
HB_TAG
(
'G'
,
'S'
,
'U'
,
'B'
);
static
const
hb_tag_t
GPOSTag
=
HB_TAG
(
'G'
,
'P'
,
'O'
,
'S'
);
...
...
src/hb-ot-layout-open-private.h
浏览文件 @
60d77cf0
...
...
@@ -55,7 +55,8 @@
DEFINE_INDEX_OPERATOR(Type, array, num) \
DEFINE_LEN(Type, array, num)
#define DEFINE_INDEX_OPERATOR(Type, array, num) \
inline const Type& operator[] (unsigned int i) const { \
inline const Type& operator[] (unsigned int i) const \
{ \
if (HB_UNLIKELY (i >= num)) return Null(Type); \
return array[i]; \
}
...
...
@@ -67,7 +68,8 @@
DEFINE_OFFSET_INDEX_OPERATOR(Type, array, num) \
DEFINE_LEN(Offset, array, num)
#define DEFINE_OFFSET_INDEX_OPERATOR(Type, array, num) \
inline const Type& operator[] (unsigned int i) const { \
inline const Type& operator[] (unsigned int i) const \
{ \
if (HB_UNLIKELY (i >= num)) return Null(Type); \
if (HB_UNLIKELY (!array[i])) return Null(Type); \
return (const Type&)*((const char*)this + array[i]); \
...
...
@@ -75,20 +77,15 @@
#define DEFINE_ARRAY_INTERFACE(Type, name) \
inline const Type& get_##name (unsigned int i) const { \
return (*this)[i]; \
} \
inline unsigned int get_##name##_count (void) const { \
return this->get_len (); \
}
inline const Type& get_##name (unsigned int i) const { return (*this)[i]; } \
inline unsigned int get_##name##_count (void) const { return this->get_len (); }
#define DEFINE_INDEX_ARRAY_INTERFACE(name) \
inline unsigned int get_##name##_index (unsigned int i) const { \
inline unsigned int get_##name##_index (unsigned int i) const \
{ \
if (HB_UNLIKELY (i >= get_len ())) return NO_INDEX; \
return (*this)[i]; \
} \
inline unsigned int get_##name##_count (void) const { \
return get_len (); \
}
inline unsigned int get_##name##_count (void) const { return get_len (); }
/*
...
...
@@ -96,12 +93,8 @@
*/
#define DEFINE_LIST_INTERFACE(Type, name) \
inline const Type& get_##name (unsigned int i) const { \
return (this+name##List)[i]; \
} \
inline unsigned int get_##name##_count (void) const { \
return (this+name##List).len; \
}
inline const Type& get_##name (unsigned int i) const { return (this+name##List)[i]; } \
inline unsigned int get_##name##_count (void) const { return (this+name##List).len; }
/*
* Tag types
...
...
@@ -109,20 +102,18 @@
#define DEFINE_TAG_ARRAY_INTERFACE(Type, name) \
DEFINE_ARRAY_INTERFACE (Type, name); \
inline const Tag& get_##name##_tag (unsigned int i) const { \
return (*this)[i].tag; \
}
inline const Tag& get_##name##_tag (unsigned int i) const { return (*this)[i].tag; }
#define DEFINE_TAG_LIST_INTERFACE(Type, name) \
DEFINE_LIST_INTERFACE (Type, name); \
inline const Tag& get_##name##_tag (unsigned int i) const { \
return (this+name##List).get_tag (i); \
}
inline const Tag& get_##name##_tag (unsigned int i) const { return (this+name##List).get_tag (i); }
#define DEFINE_TAG_FIND_INTERFACE(Type, name) \
inline bool find_##name##_index (hb_tag_t tag, unsigned int *name##_index) const { \
const Tag t = tag; \
for (unsigned int i = 0; i < get_##name##_count (); i++) { \
if (t == get_##name##_tag (i)) { \
for (unsigned int i = 0; i < get_##name##_count (); i++) \
{ \
if (t == get_##name##_tag (i)) \
{ \
if (name##_index) *name##_index = i; \
return true; \
} \
...
...
@@ -130,7 +121,8 @@
if (name##_index) *name##_index = NO_INDEX; \
return false; \
} \
inline const Type& get_##name##_by_tag (hb_tag_t tag) const { \
inline const Type& get_##name##_by_tag (hb_tag_t tag) const \
{ \
unsigned int i; \
if (find_##name##_index (tag, &i)) \
return get_##name (i); \
...
...
@@ -150,7 +142,8 @@ static const char NullPool[16] = "";
/* Generic template for nul-content sizeof-sized Null objects. */
template
<
typename
Type
>
struct
Null
{
struct
Null
{
ASSERT_STATIC
(
sizeof
(
Type
)
<=
sizeof
(
NullPool
));
static
inline
const
Type
&
get
()
{
return
(
const
Type
&
)
*
NullPool
;
}
};
...
...
@@ -158,7 +151,8 @@ struct Null {
/* Specializaiton for arbitrary-content arbitrary-sized Null objects. */
#define DEFINE_NULL_DATA(Type, size, data) \
template <> \
struct Null <Type> { \
struct Null <Type> \
{ \
static inline const Type &get () { static const char bytes[size] = data; return (const Type&) *bytes;
/* XXX */
} \
}
...
...
@@ -174,13 +168,12 @@ struct Null <Type> { \
* instance of Type located at the input data location. It's just a
* fancy, NULL-safe, cast! */
#define STATIC_DEFINE_GET_FOR_DATA(Type) \
static inline const Type& get_for_data (const char *data) { \
static inline const Type& get_for_data (const char *data) \
{ \
if (HB_UNLIKELY (data == NULL)) return Null(Type); \
return (const Type&)*data; \
} \
static inline Type& get_for_data (char *data) { \
return (Type&)*data; \
}
static inline Type& get_for_data (char *data) { return (Type&)*data; }
...
...
@@ -214,7 +207,8 @@ struct Null <Type> { \
#define DEFINE_INT_TYPE0(NAME, type) DEFINE_INT_TYPE1 (NAME, type, hb_be_##type)
#define DEFINE_INT_TYPE(NAME, u, w) DEFINE_INT_TYPE0 (NAME, u##int##w##_t)
#define DEFINE_INT_TYPE_STRUCT(NAME, u, w) \
struct NAME { \
struct NAME \
{ \
DEFINE_INT_TYPE(NAME, u, w) \
}; \
ASSERT_SIZE (NAME, w / 8)
...
...
@@ -232,7 +226,8 @@ DEFINE_INT_TYPE_STRUCT (LONG, , 32); /* 32-bit signed integer. */
DEFINE_INT_TYPE_STRUCT
(
LONGDATETIME
,
,
64
);
/* 32-bit signed fixed-point number (16.16) */
struct
Fixed
{
struct
Fixed
{
inline
Fixed
&
operator
=
(
int32_t
v
)
{
i
=
(
int16_t
)
(
v
>>
16
);
f
=
(
uint16_t
)
v
;
return
*
this
;
}
\
inline
operator
int32_t
(
void
)
const
{
return
(((
int32_t
)
i
)
<<
16
)
+
(
uint16_t
)
f
;
}
\
inline
bool
operator
==
(
Fixed
o
)
const
{
return
i
==
o
.
i
&&
f
==
o
.
f
;
}
\
...
...
@@ -251,24 +246,24 @@ ASSERT_SIZE (Fixed, 4);
struct
FUNIT
;
/* 16-bit signed integer (SHORT) that describes a quantity in FUnits. */
struct
FWORD
:
SHORT
{
};
struct
FWORD
:
SHORT
{};
ASSERT_SIZE
(
FWORD
,
2
);
/* 16-bit unsigned integer (USHORT) that describes a quantity in FUnits. */
struct
UFWORD
:
USHORT
{
};
struct
UFWORD
:
USHORT
{};
ASSERT_SIZE
(
UFWORD
,
2
);
/* 16-bit signed fixed number with the low 14 bits of fraction (2.14). */
struct
F2DOT14
:
SHORT
{
struct
F2DOT14
:
SHORT
{
inline
operator
double
()
const
{
return
(
uint32_t
)
this
/
16384.
;
}
};
ASSERT_SIZE
(
F2DOT14
,
2
);
/* Array of four uint8s (length = 32 bits) used to identify a script, language
* system, feature, or baseline */
struct
Tag
{
struct
Tag
{
inline
Tag
(
void
)
{
v
[
0
]
=
v
[
1
]
=
v
[
2
]
=
v
[
3
]
=
0
;
}
inline
Tag
(
uint32_t
v
)
{
(
ULONG
&
)(
*
this
)
=
v
;
}
inline
Tag
(
const
char
*
c
)
{
v
[
0
]
=
c
[
0
];
v
[
1
]
=
c
[
1
];
v
[
2
]
=
c
[
2
];
v
[
3
]
=
c
[
3
];
}
...
...
@@ -296,22 +291,24 @@ DEFINE_INT_TYPE_STRUCT (Offset, u, 16);
/* Template subclass of Offset that does the dereferencing. Use: (this+memberName) */
template
<
typename
Type
>
struct
OffsetTo
:
Offset
{
inline
const
Type
&
operator
()
(
const
void
*
base
)
const
{
struct
OffsetTo
:
Offset
{
inline
const
Type
&
operator
()
(
const
void
*
base
)
const
{
unsigned
int
offset
=
*
this
;
if
(
HB_UNLIKELY
(
!
offset
))
return
Null
(
Type
);
return
(
const
Type
&
)
*
((
const
char
*
)
base
+
offset
);
}
};
template
<
typename
Base
,
typename
Type
>
inline
const
Type
&
operator
+
(
const
Base
&
base
,
OffsetTo
<
Type
>
offset
)
{
return
offset
(
base
);
}
inline
const
Type
&
operator
+
(
const
Base
&
base
,
OffsetTo
<
Type
>
offset
)
{
return
offset
(
base
);
}
/* CheckSum */
struct
CheckSum
:
ULONG
{
static
uint32_t
CalcTableChecksum
(
ULONG
*
Table
,
uint32_t
Length
)
{
struct
CheckSum
:
ULONG
{
static
uint32_t
CalcTableChecksum
(
ULONG
*
Table
,
uint32_t
Length
)
{
uint32_t
Sum
=
0L
;
ULONG
*
EndPtr
=
Table
+
((
Length
+
3
)
&
~
3
)
/
sizeof
(
ULONG
);
...
...
@@ -327,11 +324,11 @@ ASSERT_SIZE (CheckSum, 4);
* Version Numbers
*/
struct
USHORT_Version
:
USHORT
{
};
struct
USHORT_Version
:
USHORT
{};
ASSERT_SIZE
(
USHORT_Version
,
2
);
struct
Fixed_Version
:
Fixed
{
struct
Fixed_Version
:
Fixed
{
inline
int16_t
major
(
void
)
const
{
return
this
->
int_part
();
}
inline
int16_t
minor
(
void
)
const
{
return
this
->
frac_part
();
}
};
...
...
@@ -343,12 +340,15 @@ ASSERT_SIZE (Fixed_Version, 4);
/* An array with a USHORT number of elements. */
template
<
typename
Type
>
struct
ArrayOf
{
inline
const
Type
&
operator
[]
(
unsigned
int
i
)
const
{
struct
ArrayOf
{
inline
const
Type
&
operator
[]
(
unsigned
int
i
)
const
{
if
(
HB_UNLIKELY
(
i
>=
len
))
return
Null
(
Type
);
return
array
[
i
];
}
inline
unsigned
int
get_size
()
const
{
inline
unsigned
int
get_size
()
const
{
return
sizeof
(
len
)
+
len
*
sizeof
(
array
[
0
]);
}
...
...
@@ -359,12 +359,15 @@ struct ArrayOf {
/* An array with a USHORT number of elements,
* starting at second element. */
template
<
typename
Type
>
struct
HeadlessArrayOf
{
inline
const
Type
&
operator
[]
(
unsigned
int
i
)
const
{
struct
HeadlessArrayOf
{
inline
const
Type
&
operator
[]
(
unsigned
int
i
)
const
{
if
(
HB_UNLIKELY
(
i
>=
len
||
!
i
))
return
Null
(
Type
);
return
array
[
i
-
1
];
}
inline
unsigned
int
get_size
()
const
{
inline
unsigned
int
get_size
()
const
{
return
sizeof
(
len
)
+
(
len
?
len
-
1
:
0
)
*
sizeof
(
array
[
0
]);
}
...
...
@@ -374,8 +377,7 @@ struct HeadlessArrayOf {
/* Array of Offset's */
template
<
typename
Type
>
struct
OffsetArrayOf
:
ArrayOf
<
OffsetTo
<
Type
>
>
{
};
struct
OffsetArrayOf
:
ArrayOf
<
OffsetTo
<
Type
>
>
{};
/* An array type is one that contains a variable number of objects
* as its last item. An array object is extended with get_len()
...
...
@@ -384,7 +386,8 @@ struct OffsetArrayOf : ArrayOf<OffsetTo<Type> > {
DEFINE_INDEX_OPERATOR(Type, array, num) \
DEFINE_LEN(Type, array, num)
#define DEFINE_INDEX_OPERATOR(Type, array, num) \
inline const Type& operator[] (unsigned int i) const { \
inline const Type& operator[] (unsigned int i) const \
{ \
if (HB_UNLIKELY (i >= num)) return Null(Type); \
return array[i]; \
}
...
...
@@ -398,8 +401,8 @@ struct OpenTypeFontFile;
struct
OffsetTable
;
struct
TTCHeader
;
typedef
struct
TableDirectory
{
typedef
struct
TableDirectory
{
friend
struct
OpenTypeFontFile
;
friend
struct
OffsetTable
;
...
...
@@ -418,8 +421,8 @@ typedef struct TableDirectory {
}
OpenTypeTable
;
ASSERT_SIZE
(
TableDirectory
,
16
);
typedef
struct
OffsetTable
{
typedef
struct
OffsetTable
{
friend
struct
OpenTypeFontFile
;
friend
struct
TTCHeader
;
...
...
@@ -444,8 +447,8 @@ ASSERT_SIZE (OffsetTable, 12);
* TrueType Collections
*/
struct
TTCHeader
{
struct
TTCHeader
{
friend
struct
OpenTypeFontFile
;
private:
...
...
@@ -468,8 +471,8 @@ ASSERT_SIZE (TTCHeader, 12);
* OpenType Font File
*/
struct
OpenTypeFontFile
{
struct
OpenTypeFontFile
{
static
const
hb_tag_t
TrueTypeTag
=
HB_TAG
(
0
,
1
,
0
,
0
);
static
const
hb_tag_t
CFFTag
=
HB_TAG
(
'O'
,
'T'
,
'T'
,
'O'
);
static
const
hb_tag_t
TTCTag
=
HB_TAG
(
't'
,
't'
,
'c'
,
'f'
);
...
...
@@ -481,31 +484,31 @@ struct OpenTypeFontFile {
inline
const
Tag
&
get_tag
(
void
)
const
{
return
tag
;
}
/* This is how you get a table */
inline
const
char
*
get_table_data
(
const
OpenTypeTable
&
table
)
const
{
return
(
*
this
)[
table
];
}
inline
char
*
get_table_data
(
const
OpenTypeTable
&
table
)
{
return
(
*
this
)[
table
];
}
inline
const
char
*
get_table_data
(
const
OpenTypeTable
&
table
)
const
{
return
(
*
this
)[
table
];
}
inline
char
*
get_table_data
(
const
OpenTypeTable
&
table
)
{
return
(
*
this
)[
table
];
}
private:
inline
const
char
*
operator
[]
(
const
OpenTypeTable
&
table
)
const
{
inline
const
char
*
operator
[]
(
const
OpenTypeTable
&
table
)
const
{
if
(
HB_UNLIKELY
(
table
.
offset
==
0
))
return
NULL
;
return
((
const
char
*
)
this
)
+
table
.
offset
;
}
inline
char
*
operator
[]
(
const
OpenTypeTable
&
table
)
{
inline
char
*
operator
[]
(
const
OpenTypeTable
&
table
)
{
if
(
HB_UNLIKELY
(
table
.
offset
==
0
))
return
NULL
;
return
((
char
*
)
this
)
+
table
.
offset
;
}
unsigned
int
get_len
(
void
)
const
{
unsigned
int
get_len
(
void
)
const
{
switch
(
tag
)
{
default:
return
0
;
case
TrueTypeTag
:
case
CFFTag
:
return
1
;
case
TTCTag
:
return
((
const
TTCHeader
&
)
*
this
).
get_len
();
}
}
const
OpenTypeFontFace
&
operator
[]
(
unsigned
int
i
)
const
{
const
OpenTypeFontFace
&
operator
[]
(
unsigned
int
i
)
const
{
if
(
HB_UNLIKELY
(
i
>=
get_len
()))
return
Null
(
OpenTypeFontFace
);
switch
(
tag
)
{
default:
case
TrueTypeTag
:
case
CFFTag
:
return
(
const
OffsetTable
&
)
*
this
;
...
...
src/hb-ot-layout-private.h
浏览文件 @
60d77cf0
...
...
@@ -36,18 +36,21 @@
typedef
unsigned
int
hb_ot_layout_class_t
;
struct
_hb_ot_layout_t
{
struct
_hb_ot_layout_t
{
const
struct
GDEF
*
gdef
;
const
struct
GSUB
*
gsub
;
const
struct
GPOS
*
gpos
;
struct
{
struct
{
unsigned
char
*
klasses
;
unsigned
int
len
;
}
new_gdef
;
/* TODO full-matrix transformation? */
struct
gpos_info_t
{
struct
gpos_info_t
{
unsigned
int
x_ppem
,
y_ppem
;
hb_16dot16_t
x_scale
,
y_scale
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录