Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Harfbuzz
提交
d7cfb3b2
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,发现更多精彩内容 >>
提交
d7cfb3b2
编写于
5月 13, 2010
作者:
B
Behdad Esfahbod
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
s/\<context\>/c/g
上级
f6796358
变更
8
展开全部
隐藏空白更改
内联
并排
Showing
8 changed file
with
679 addition
and
679 deletion
+679
-679
src/hb-open-file-private.hh
src/hb-open-file-private.hh
+14
-14
src/hb-open-type-private.hh
src/hb-open-type-private.hh
+50
-50
src/hb-ot-layout-common-private.hh
src/hb-ot-layout-common-private.hh
+42
-42
src/hb-ot-layout-gdef-private.hh
src/hb-ot-layout-gdef-private.hh
+49
-49
src/hb-ot-layout-gpos-private.hh
src/hb-ot-layout-gpos-private.hh
+230
-230
src/hb-ot-layout-gsub-private.hh
src/hb-ot-layout-gsub-private.hh
+153
-153
src/hb-ot-layout-gsubgpos-private.hh
src/hb-ot-layout-gsubgpos-private.hh
+129
-129
src/hb-ot-layout.cc
src/hb-ot-layout.cc
+12
-12
未找到文件。
src/hb-open-file-private.hh
浏览文件 @
d7cfb3b2
...
...
@@ -48,9 +48,9 @@ struct TTCHeader;
typedef
struct
TableDirectory
{
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
ontext
)
{
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
)
{
TRACE_SANITIZE
();
return
c
ontext
->
check_struct
(
this
);
return
c
->
check_struct
(
this
);
}
Tag
tag
;
/* 4-byte identifier. */
...
...
@@ -98,10 +98,10 @@ typedef struct OffsetTable
}
public:
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
ontext
)
{
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
)
{
TRACE_SANITIZE
();
return
c
ontext
->
check_struct
(
this
)
&&
c
ontext
->
check_array
(
tableDir
,
TableDirectory
::
static_size
,
numTables
);
return
c
->
check_struct
(
this
)
&&
c
->
check_array
(
tableDir
,
TableDirectory
::
static_size
,
numTables
);
}
private:
...
...
@@ -127,9 +127,9 @@ struct TTCHeaderVersion1
inline
unsigned
int
get_face_count
(
void
)
const
{
return
table
.
len
;
}
inline
const
OpenTypeFontFace
&
get_face
(
unsigned
int
i
)
const
{
return
this
+
table
[
i
];
}
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
ontext
)
{
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
)
{
TRACE_SANITIZE
();
return
table
.
sanitize
(
c
ontext
,
this
);
return
table
.
sanitize
(
c
,
this
);
}
private:
...
...
@@ -166,12 +166,12 @@ struct TTCHeader
}
}
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
ontext
)
{
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
)
{
TRACE_SANITIZE
();
if
(
unlikely
(
!
u
.
header
.
version
.
sanitize
(
c
ontext
)))
return
false
;
if
(
unlikely
(
!
u
.
header
.
version
.
sanitize
(
c
)))
return
false
;
switch
(
u
.
header
.
version
)
{
case
2
:
/* version 2 is compatible with version 1 */
case
1
:
return
u
.
version1
.
sanitize
(
c
ontext
);
case
1
:
return
u
.
version1
.
sanitize
(
c
);
default:
return
true
;
}
}
...
...
@@ -228,15 +228,15 @@ struct OpenTypeFontFile
}
}
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
ontext
)
{
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
)
{
TRACE_SANITIZE
();
if
(
unlikely
(
!
u
.
tag
.
sanitize
(
c
ontext
)))
return
false
;
if
(
unlikely
(
!
u
.
tag
.
sanitize
(
c
)))
return
false
;
switch
(
u
.
tag
)
{
case
CFFTag
:
/* All the non-collection tags */
case
TrueTag
:
case
Typ1Tag
:
case
TrueTypeTag
:
return
u
.
fontFace
.
sanitize
(
c
ontext
);
case
TTCTag
:
return
u
.
ttcHeader
.
sanitize
(
c
ontext
);
case
TrueTypeTag
:
return
u
.
fontFace
.
sanitize
(
c
);
case
TTCTag
:
return
u
.
ttcHeader
.
sanitize
(
c
);
default:
return
true
;
}
}
...
...
src/hb-open-type-private.hh
浏览文件 @
d7cfb3b2
...
...
@@ -176,7 +176,7 @@ struct hb_trace_t<0> {
#define TRACE_SANITIZE() \
hb_trace_t<HB_DEBUG_SANITIZE> trace (&c
ontext
->debug_depth, "SANITIZE", HB_FUNC, this); \
hb_trace_t<HB_DEBUG_SANITIZE> trace (&c->debug_depth, "SANITIZE", HB_FUNC, this); \
struct
hb_sanitize_context_t
...
...
@@ -278,7 +278,7 @@ template <typename Type>
struct
Sanitizer
{
static
hb_blob_t
*
sanitize
(
hb_blob_t
*
blob
)
{
hb_sanitize_context_t
c
ontext
[
1
]
=
{{
0
}};
hb_sanitize_context_t
c
[
1
]
=
{{
0
}};
bool
sane
;
/* TODO is_sane() stuff */
...
...
@@ -287,36 +287,36 @@ struct Sanitizer
if
(
HB_DEBUG_SANITIZE
)
fprintf
(
stderr
,
"Sanitizer %p start %s
\n
"
,
blob
,
HB_FUNC
);
c
ontext
->
init
(
blob
);
c
->
init
(
blob
);
if
(
unlikely
(
!
c
ontext
->
start
))
{
c
ontext
->
finish
();
if
(
unlikely
(
!
c
->
start
))
{
c
->
finish
();
return
blob
;
}
Type
*
t
=
CastP
<
Type
>
(
const_cast
<
char
*>
(
c
ontext
->
start
));
Type
*
t
=
CastP
<
Type
>
(
const_cast
<
char
*>
(
c
->
start
));
sane
=
t
->
sanitize
(
c
ontext
);
sane
=
t
->
sanitize
(
c
);
if
(
sane
)
{
if
(
c
ontext
->
edit_count
)
{
if
(
c
->
edit_count
)
{
if
(
HB_DEBUG_SANITIZE
)
fprintf
(
stderr
,
"Sanitizer %p passed first round with %d edits; doing a second round %s
\n
"
,
blob
,
c
ontext
->
edit_count
,
HB_FUNC
);
blob
,
c
->
edit_count
,
HB_FUNC
);
/* sanitize again to ensure no toe-stepping */
c
ontext
->
edit_count
=
0
;
sane
=
t
->
sanitize
(
c
ontext
);
if
(
c
ontext
->
edit_count
)
{
c
->
edit_count
=
0
;
sane
=
t
->
sanitize
(
c
);
if
(
c
->
edit_count
)
{
if
(
HB_DEBUG_SANITIZE
)
fprintf
(
stderr
,
"Sanitizer %p requested %d edits in second round; FAILLING %s
\n
"
,
blob
,
c
ontext
->
edit_count
,
HB_FUNC
);
blob
,
c
->
edit_count
,
HB_FUNC
);
sane
=
false
;
}
}
c
ontext
->
finish
();
c
->
finish
();
}
else
{
unsigned
int
edit_count
=
c
ontext
->
edit_count
;
c
ontext
->
finish
();
unsigned
int
edit_count
=
c
->
edit_count
;
c
->
finish
();
if
(
edit_count
&&
!
hb_blob_is_writable
(
blob
)
&&
hb_blob_try_writable
(
blob
))
{
/* ok, we made it writable by relocating. try again */
if
(
HB_DEBUG_SANITIZE
)
...
...
@@ -391,9 +391,9 @@ struct IntType
inline
operator
Type
(
void
)
const
{
return
v
;
}
inline
bool
operator
==
(
const
IntType
<
Type
>
&
o
)
const
{
return
v
==
o
.
v
;
}
inline
bool
operator
!=
(
const
IntType
<
Type
>
&
o
)
const
{
return
v
!=
o
.
v
;
}
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
ontext
)
{
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
)
{
TRACE_SANITIZE
();
return
likely
(
c
ontext
->
check_struct
(
this
));
return
likely
(
c
->
check_struct
(
this
));
}
protected:
BEInt
<
Type
,
sizeof
(
Type
)
>
v
;
...
...
@@ -459,9 +459,9 @@ struct FixedVersion
{
inline
operator
uint32_t
(
void
)
const
{
return
(
major
<<
16
)
+
minor
;
}
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
ontext
)
{
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
)
{
TRACE_SANITIZE
();
return
c
ontext
->
check_struct
(
this
);
return
c
->
check_struct
(
this
);
}
USHORT
major
;
...
...
@@ -487,28 +487,28 @@ struct GenericOffsetTo : OffsetType
return
StructAtOffset
<
Type
>
(
base
,
offset
);
}
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
ontext
,
void
*
base
)
{
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
,
void
*
base
)
{
TRACE_SANITIZE
();
if
(
unlikely
(
!
c
ontext
->
check_struct
(
this
)))
return
false
;
if
(
unlikely
(
!
c
->
check_struct
(
this
)))
return
false
;
unsigned
int
offset
=
*
this
;
if
(
unlikely
(
!
offset
))
return
true
;
Type
&
obj
=
StructAtOffset
<
Type
>
(
base
,
offset
);
return
likely
(
obj
.
sanitize
(
c
ontext
))
||
neuter
(
context
);
return
likely
(
obj
.
sanitize
(
c
))
||
neuter
(
c
);
}
template
<
typename
T
>
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
ontext
,
void
*
base
,
T
user_data
)
{
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
,
void
*
base
,
T
user_data
)
{
TRACE_SANITIZE
();
if
(
unlikely
(
!
c
ontext
->
check_struct
(
this
)))
return
false
;
if
(
unlikely
(
!
c
->
check_struct
(
this
)))
return
false
;
unsigned
int
offset
=
*
this
;
if
(
unlikely
(
!
offset
))
return
true
;
Type
&
obj
=
StructAtOffset
<
Type
>
(
base
,
offset
);
return
likely
(
obj
.
sanitize
(
c
ontext
,
user_data
))
||
neuter
(
context
);
return
likely
(
obj
.
sanitize
(
c
,
user_data
))
||
neuter
(
c
);
}
private:
/* Set the offset to Null */
inline
bool
neuter
(
hb_sanitize_context_t
*
c
ontext
)
{
if
(
c
ontext
->
can_edit
(
this
,
this
->
static_size
))
{
inline
bool
neuter
(
hb_sanitize_context_t
*
c
)
{
if
(
c
->
can_edit
(
this
,
this
->
static_size
))
{
this
->
set
(
0
);
/* 0 is Null offset */
return
true
;
}
...
...
@@ -552,9 +552,9 @@ struct GenericArrayOf
inline
unsigned
int
get_size
()
const
{
return
len
.
static_size
+
len
*
Type
::
static_size
;
}
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
ontext
)
{
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
)
{
TRACE_SANITIZE
();
if
(
unlikely
(
!
sanitize_shallow
(
c
ontext
)))
return
false
;
if
(
unlikely
(
!
sanitize_shallow
(
c
)))
return
false
;
/* Note: for structs that do not reference other structs,
* we do not need to call their sanitize() as we already did
* a bound check on the aggregate array size, hence the return.
...
...
@@ -565,35 +565,35 @@ struct GenericArrayOf
* other structs. */
unsigned
int
count
=
len
;
for
(
unsigned
int
i
=
0
;
i
<
count
;
i
++
)
if
(
array
[
i
].
sanitize
(
c
ontext
))
if
(
array
[
i
].
sanitize
(
c
))
return
false
;
return
true
;
}
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
ontext
,
void
*
base
)
{
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
,
void
*
base
)
{
TRACE_SANITIZE
();
if
(
unlikely
(
!
sanitize_shallow
(
c
ontext
)))
return
false
;
if
(
unlikely
(
!
sanitize_shallow
(
c
)))
return
false
;
unsigned
int
count
=
len
;
for
(
unsigned
int
i
=
0
;
i
<
count
;
i
++
)
if
(
unlikely
(
!
array
[
i
].
sanitize
(
c
ontext
,
base
)))
if
(
unlikely
(
!
array
[
i
].
sanitize
(
c
,
base
)))
return
false
;
return
true
;
}
template
<
typename
T
>
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
ontext
,
void
*
base
,
T
user_data
)
{
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
,
void
*
base
,
T
user_data
)
{
TRACE_SANITIZE
();
if
(
unlikely
(
!
sanitize_shallow
(
c
ontext
)))
return
false
;
if
(
unlikely
(
!
sanitize_shallow
(
c
)))
return
false
;
unsigned
int
count
=
len
;
for
(
unsigned
int
i
=
0
;
i
<
count
;
i
++
)
if
(
unlikely
(
!
array
[
i
].
sanitize
(
c
ontext
,
base
,
user_data
)))
if
(
unlikely
(
!
array
[
i
].
sanitize
(
c
,
base
,
user_data
)))
return
false
;
return
true
;
}
private:
inline
bool
sanitize_shallow
(
hb_sanitize_context_t
*
c
ontext
)
{
inline
bool
sanitize_shallow
(
hb_sanitize_context_t
*
c
)
{
TRACE_SANITIZE
();
return
c
ontext
->
check_struct
(
this
)
&&
c
ontext
->
check_array
(
this
,
Type
::
static_size
,
len
);
return
c
->
check_struct
(
this
)
&&
c
->
check_array
(
this
,
Type
::
static_size
,
len
);
}
public:
...
...
@@ -633,14 +633,14 @@ struct OffsetListOf : OffsetArrayOf<Type>
return
this
+
this
->
array
[
i
];
}
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
ontext
)
{
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
)
{
TRACE_SANITIZE
();
return
OffsetArrayOf
<
Type
>::
sanitize
(
c
ontext
,
this
);
return
OffsetArrayOf
<
Type
>::
sanitize
(
c
,
this
);
}
template
<
typename
T
>
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
ontext
,
T
user_data
)
{
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
,
T
user_data
)
{
TRACE_SANITIZE
();
return
OffsetArrayOf
<
Type
>::
sanitize
(
c
ontext
,
this
,
user_data
);
return
OffsetArrayOf
<
Type
>::
sanitize
(
c
,
this
,
user_data
);
}
};
...
...
@@ -658,14 +658,14 @@ struct HeadlessArrayOf
inline
unsigned
int
get_size
()
const
{
return
len
.
static_size
+
(
len
?
len
-
1
:
0
)
*
Type
::
static_size
;
}
inline
bool
sanitize_shallow
(
hb_sanitize_context_t
*
c
ontext
)
{
return
c
ontext
->
check_struct
(
this
)
&&
c
ontext
->
check_array
(
this
,
Type
::
static_size
,
len
);
inline
bool
sanitize_shallow
(
hb_sanitize_context_t
*
c
)
{
return
c
->
check_struct
(
this
)
&&
c
->
check_array
(
this
,
Type
::
static_size
,
len
);
}
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
ontext
)
{
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
)
{
TRACE_SANITIZE
();
if
(
unlikely
(
!
sanitize_shallow
(
c
ontext
)))
return
false
;
if
(
unlikely
(
!
sanitize_shallow
(
c
)))
return
false
;
/* Note: for structs that do not reference other structs,
* we do not need to call their sanitize() as we already did
* a bound check on the aggregate array size, hence the return.
...
...
@@ -677,7 +677,7 @@ struct HeadlessArrayOf
unsigned
int
count
=
len
?
len
-
1
:
0
;
Type
*
a
=
array
;
for
(
unsigned
int
i
=
0
;
i
<
count
;
i
++
)
if
(
unlikely
(
!
a
[
i
].
sanitize
(
c
ontext
)))
if
(
unlikely
(
!
a
[
i
].
sanitize
(
c
)))
return
false
;
return
true
;
}
...
...
src/hb-ot-layout-common-private.hh
浏览文件 @
d7cfb3b2
...
...
@@ -51,10 +51,10 @@
template
<
typename
Type
>
struct
Record
{
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
ontext
,
void
*
base
)
{
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
,
void
*
base
)
{
TRACE_SANITIZE
();
return
c
ontext
->
check_struct
(
this
)
&&
offset
.
sanitize
(
c
ontext
,
base
);
return
c
->
check_struct
(
this
)
&&
offset
.
sanitize
(
c
,
base
);
}
Tag
tag
;
/* 4-byte Tag identifier */
...
...
@@ -110,9 +110,9 @@ struct RecordListOf : RecordArrayOf<Type>
inline
const
Type
&
operator
[]
(
unsigned
int
i
)
const
{
return
this
+
RecordArrayOf
<
Type
>::
operator
[](
i
).
offset
;
}
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
ontext
)
{
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
)
{
TRACE_SANITIZE
();
return
RecordArrayOf
<
Type
>::
sanitize
(
c
ontext
,
this
);
return
RecordArrayOf
<
Type
>::
sanitize
(
c
,
this
);
}
};
...
...
@@ -158,10 +158,10 @@ struct LangSys
return
reqFeatureIndex
;;
}
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
ontext
)
{
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
)
{
TRACE_SANITIZE
();
return
c
ontext
->
check_struct
(
this
)
&&
featureIndex
.
sanitize
(
c
ontext
);
return
c
->
check_struct
(
this
)
&&
featureIndex
.
sanitize
(
c
);
}
Offset
lookupOrder
;
/* = Null (reserved for an offset to a
...
...
@@ -197,10 +197,10 @@ struct Script
inline
bool
has_default_lang_sys
(
void
)
const
{
return
defaultLangSys
!=
0
;
}
inline
const
LangSys
&
get_default_lang_sys
(
void
)
const
{
return
this
+
defaultLangSys
;
}
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
ontext
)
{
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
)
{
TRACE_SANITIZE
();
return
defaultLangSys
.
sanitize
(
c
ontext
,
this
)
&&
langSys
.
sanitize
(
c
ontext
,
this
);
return
defaultLangSys
.
sanitize
(
c
,
this
)
&&
langSys
.
sanitize
(
c
,
this
);
}
private:
...
...
@@ -228,10 +228,10 @@ struct Feature
unsigned
int
*
lookup_tags
/* OUT */
)
const
{
return
lookupIndex
.
get_indexes
(
start_index
,
lookup_count
,
lookup_tags
);
}
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
ontext
)
{
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
)
{
TRACE_SANITIZE
();
return
c
ontext
->
check_struct
(
this
)
&&
lookupIndex
.
sanitize
(
c
ontext
);
return
c
->
check_struct
(
this
)
&&
lookupIndex
.
sanitize
(
c
);
}
/* LONGTERMTODO: implement get_feature_parameters() */
...
...
@@ -280,15 +280,15 @@ struct Lookup
return
flag
;
}
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
ontext
)
{
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
)
{
TRACE_SANITIZE
();
/* Real sanitize of the subtables is done by GSUB/GPOS/... */
if
(
!
(
c
ontext
->
check_struct
(
this
)
&&
subTable
.
sanitize
(
c
ontext
)))
return
false
;
if
(
!
(
c
->
check_struct
(
this
)
&&
subTable
.
sanitize
(
c
)))
return
false
;
if
(
unlikely
(
lookupFlag
&
LookupFlag
::
UseMarkFilteringSet
))
{
USHORT
&
markFilteringSet
=
StructAfter
<
USHORT
>
(
subTable
);
if
(
!
markFilteringSet
.
sanitize
(
c
ontext
))
return
false
;
if
(
!
markFilteringSet
.
sanitize
(
c
))
return
false
;
}
return
true
;
}
...
...
@@ -330,9 +330,9 @@ struct CoverageFormat1
return
NOT_COVERED
;
}
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
ontext
)
{
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
)
{
TRACE_SANITIZE
();
return
glyphArray
.
sanitize
(
c
ontext
);
return
glyphArray
.
sanitize
(
c
);
}
private:
...
...
@@ -356,9 +356,9 @@ struct CoverageRangeRecord
}
public:
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
ontext
)
{
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
)
{
TRACE_SANITIZE
();
return
c
ontext
->
check_struct
(
this
);
return
c
->
check_struct
(
this
);
}
private:
...
...
@@ -389,9 +389,9 @@ struct CoverageFormat2
return
NOT_COVERED
;
}
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
ontext
)
{
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
)
{
TRACE_SANITIZE
();
return
rangeRecord
.
sanitize
(
c
ontext
);
return
rangeRecord
.
sanitize
(
c
);
}
private:
...
...
@@ -417,12 +417,12 @@ struct Coverage
}
}
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
ontext
)
{
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
)
{
TRACE_SANITIZE
();
if
(
!
u
.
format
.
sanitize
(
c
ontext
))
return
false
;
if
(
!
u
.
format
.
sanitize
(
c
))
return
false
;
switch
(
u
.
format
)
{
case
1
:
return
u
.
format1
.
sanitize
(
c
ontext
);
case
2
:
return
u
.
format2
.
sanitize
(
c
ontext
);
case
1
:
return
u
.
format1
.
sanitize
(
c
);
case
2
:
return
u
.
format2
.
sanitize
(
c
);
default:
return
true
;
}
}
...
...
@@ -454,10 +454,10 @@ struct ClassDefFormat1
return
0
;
}
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
ontext
)
{
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
)
{
TRACE_SANITIZE
();
return
c
ontext
->
check_struct
(
this
)
&&
classValue
.
sanitize
(
c
ontext
);
return
c
->
check_struct
(
this
)
&&
classValue
.
sanitize
(
c
);
}
USHORT
classFormat
;
/* Format identifier--format = 1 */
...
...
@@ -481,9 +481,9 @@ struct ClassRangeRecord
}
public:
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
ontext
)
{
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
)
{
TRACE_SANITIZE
();
return
c
ontext
->
check_struct
(
this
);
return
c
->
check_struct
(
this
);
}
private:
...
...
@@ -513,9 +513,9 @@ struct ClassDefFormat2
return
0
;
}
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
ontext
)
{
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
)
{
TRACE_SANITIZE
();
return
rangeRecord
.
sanitize
(
c
ontext
);
return
rangeRecord
.
sanitize
(
c
);
}
USHORT
classFormat
;
/* Format identifier--format = 2 */
...
...
@@ -539,12 +539,12 @@ struct ClassDef
}
}
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
ontext
)
{
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
)
{
TRACE_SANITIZE
();
if
(
!
u
.
format
.
sanitize
(
c
ontext
))
return
false
;
if
(
!
u
.
format
.
sanitize
(
c
))
return
false
;
switch
(
u
.
format
)
{
case
1
:
return
u
.
format1
.
sanitize
(
c
ontext
);
case
2
:
return
u
.
format2
.
sanitize
(
c
ontext
);
case
1
:
return
u
.
format1
.
sanitize
(
c
);
case
2
:
return
u
.
format2
.
sanitize
(
c
);
default:
return
true
;
}
}
...
...
@@ -598,10 +598,10 @@ struct Device
return
USHORT
::
static_size
*
(
4
+
((
endSize
-
startSize
)
>>
(
4
-
f
)));
}
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
ontext
)
{
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
)
{
TRACE_SANITIZE
();
return
c
ontext
->
check_struct
(
this
)
&&
c
ontext
->
check_range
(
this
,
this
->
get_size
());
return
c
->
check_struct
(
this
)
&&
c
->
check_range
(
this
,
this
->
get_size
());
}
private:
...
...
src/hb-ot-layout-gdef-private.hh
浏览文件 @
d7cfb3b2
...
...
@@ -66,10 +66,10 @@ struct AttachList
return
points
.
len
;
}
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
ontext
)
{
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
)
{
TRACE_SANITIZE
();
return
coverage
.
sanitize
(
c
ontext
,
this
)
&&
attachPoint
.
sanitize
(
c
ontext
,
this
);
return
coverage
.
sanitize
(
c
,
this
)
&&
attachPoint
.
sanitize
(
c
,
this
);
}
private:
...
...
@@ -92,15 +92,15 @@ struct CaretValueFormat1
friend
struct
CaretValue
;
private:
inline
int
get_caret_value
(
hb_ot_layout_context_t
*
c
ontext
,
hb_codepoint_t
glyph_id
HB_UNUSED
)
const
inline
int
get_caret_value
(
hb_ot_layout_context_t
*
c
,
hb_codepoint_t
glyph_id
HB_UNUSED
)
const
{
/* TODO vertical */
return
_hb_16dot16_mul_round
(
c
ontext
->
font
->
x_scale
,
coordinate
);
return
_hb_16dot16_mul_round
(
c
->
font
->
x_scale
,
coordinate
);
}
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
ontext
)
{
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
)
{
TRACE_SANITIZE
();
return
c
ontext
->
check_struct
(
this
);
return
c
->
check_struct
(
this
);
}
private:
...
...
@@ -115,19 +115,19 @@ struct CaretValueFormat2
friend
struct
CaretValue
;
private:
inline
int
get_caret_value
(
hb_ot_layout_context_t
*
c
ontext
,
hb_codepoint_t
glyph_id
)
const
inline
int
get_caret_value
(
hb_ot_layout_context_t
*
c
,
hb_codepoint_t
glyph_id
)
const
{
/* TODO vertical */
hb_position_t
x
,
y
;
if
(
hb_font_get_contour_point
(
c
ontext
->
font
,
context
->
face
,
caretValuePoint
,
glyph_id
,
&
x
,
&
y
))
if
(
hb_font_get_contour_point
(
c
->
font
,
c
->
face
,
caretValuePoint
,
glyph_id
,
&
x
,
&
y
))
return
x
;
else
return
0
;
}
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
ontext
)
{
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
)
{
TRACE_SANITIZE
();
return
c
ontext
->
check_struct
(
this
);
return
c
->
check_struct
(
this
);
}
private:
...
...
@@ -141,17 +141,17 @@ struct CaretValueFormat3
{
friend
struct
CaretValue
;
inline
int
get_caret_value
(
hb_ot_layout_context_t
*
c
ontext
,
hb_codepoint_t
glyph_id
HB_UNUSED
)
const
inline
int
get_caret_value
(
hb_ot_layout_context_t
*
c
,
hb_codepoint_t
glyph_id
HB_UNUSED
)
const
{
/* TODO vertical */
return
_hb_16dot16_mul_round
(
c
ontext
->
font
->
x_scale
,
coordinate
)
+
((
this
+
deviceTable
).
get_delta
(
c
ontext
->
font
->
x_ppem
)
<<
16
);
return
_hb_16dot16_mul_round
(
c
->
font
->
x_scale
,
coordinate
)
+
((
this
+
deviceTable
).
get_delta
(
c
->
font
->
x_ppem
)
<<
16
);
}
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
ontext
)
{
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
)
{
TRACE_SANITIZE
();
return
c
ontext
->
check_struct
(
this
)
&&
deviceTable
.
sanitize
(
c
ontext
,
this
);
return
c
->
check_struct
(
this
)
&&
deviceTable
.
sanitize
(
c
,
this
);
}
private:
...
...
@@ -167,23 +167,23 @@ struct CaretValueFormat3
struct
CaretValue
{
inline
int
get_caret_value
(
hb_ot_layout_context_t
*
c
ontext
,
hb_codepoint_t
glyph_id
)
const
inline
int
get_caret_value
(
hb_ot_layout_context_t
*
c
,
hb_codepoint_t
glyph_id
)
const
{
switch
(
u
.
format
)
{
case
1
:
return
u
.
format1
.
get_caret_value
(
c
ontext
,
glyph_id
);
case
2
:
return
u
.
format2
.
get_caret_value
(
c
ontext
,
glyph_id
);
case
3
:
return
u
.
format3
.
get_caret_value
(
c
ontext
,
glyph_id
);
case
1
:
return
u
.
format1
.
get_caret_value
(
c
,
glyph_id
);
case
2
:
return
u
.
format2
.
get_caret_value
(
c
,
glyph_id
);
case
3
:
return
u
.
format3
.
get_caret_value
(
c
,
glyph_id
);
default:
return
0
;
}
}
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
ontext
)
{
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
)
{
TRACE_SANITIZE
();
if
(
!
u
.
format
.
sanitize
(
c
ontext
))
return
false
;
if
(
!
u
.
format
.
sanitize
(
c
))
return
false
;
switch
(
u
.
format
)
{
case
1
:
return
u
.
format1
.
sanitize
(
c
ontext
);
case
2
:
return
u
.
format2
.
sanitize
(
c
ontext
);
case
3
:
return
u
.
format3
.
sanitize
(
c
ontext
);
case
1
:
return
u
.
format1
.
sanitize
(
c
);
case
2
:
return
u
.
format2
.
sanitize
(
c
);
case
3
:
return
u
.
format3
.
sanitize
(
c
);
default:
return
true
;
}
}
...
...
@@ -201,7 +201,7 @@ struct CaretValue
struct
LigGlyph
{
inline
unsigned
int
get_lig_carets
(
hb_ot_layout_context_t
*
c
ontext
,
inline
unsigned
int
get_lig_carets
(
hb_ot_layout_context_t
*
c
,
hb_codepoint_t
glyph_id
,
unsigned
int
start_offset
,
unsigned
int
*
caret_count
/* IN/OUT */
,
...
...
@@ -211,15 +211,15 @@ struct LigGlyph
const
OffsetTo
<
CaretValue
>
*
array
=
carets
.
sub_array
(
start_offset
,
caret_count
);
unsigned
int
count
=
*
caret_count
;
for
(
unsigned
int
i
=
0
;
i
<
count
;
i
++
)
caret_array
[
i
]
=
(
this
+
array
[
i
]).
get_caret_value
(
c
ontext
,
glyph_id
);
caret_array
[
i
]
=
(
this
+
array
[
i
]).
get_caret_value
(
c
,
glyph_id
);
}
return
carets
.
len
;
}
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
ontext
)
{
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
)
{
TRACE_SANITIZE
();
return
carets
.
sanitize
(
c
ontext
,
this
);
return
carets
.
sanitize
(
c
,
this
);
}
private:
...
...
@@ -233,7 +233,7 @@ struct LigGlyph
struct
LigCaretList
{
inline
unsigned
int
get_lig_carets
(
hb_ot_layout_context_t
*
c
ontext
,
inline
unsigned
int
get_lig_carets
(
hb_ot_layout_context_t
*
c
,
hb_codepoint_t
glyph_id
,
unsigned
int
start_offset
,
unsigned
int
*
caret_count
/* IN/OUT */
,
...
...
@@ -247,13 +247,13 @@ struct LigCaretList
return
0
;
}
const
LigGlyph
&
lig_glyph
=
this
+
ligGlyph
[
index
];
return
lig_glyph
.
get_lig_carets
(
c
ontext
,
glyph_id
,
start_offset
,
caret_count
,
caret_array
);
return
lig_glyph
.
get_lig_carets
(
c
,
glyph_id
,
start_offset
,
caret_count
,
caret_array
);
}
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
ontext
)
{
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
)
{
TRACE_SANITIZE
();
return
coverage
.
sanitize
(
c
ontext
,
this
)
&&
ligGlyph
.
sanitize
(
c
ontext
,
this
);
return
coverage
.
sanitize
(
c
,
this
)
&&
ligGlyph
.
sanitize
(
c
,
this
);
}
private:
...
...
@@ -273,9 +273,9 @@ struct MarkGlyphSetsFormat1
inline
bool
covers
(
unsigned
int
set_index
,
hb_codepoint_t
glyph_id
)
const
{
return
(
this
+
coverage
[
set_index
]).
get_coverage
(
glyph_id
)
!=
NOT_COVERED
;
}
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
ontext
)
{
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
)
{
TRACE_SANITIZE
();
return
coverage
.
sanitize
(
c
ontext
,
this
);
return
coverage
.
sanitize
(
c
,
this
);
}
private:
...
...
@@ -297,11 +297,11 @@ struct MarkGlyphSets
}
}
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
ontext
)
{
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
)
{
TRACE_SANITIZE
();
if
(
!
u
.
format
.
sanitize
(
c
ontext
))
return
false
;
if
(
!
u
.
format
.
sanitize
(
c
))
return
false
;
switch
(
u
.
format
)
{
case
1
:
return
u
.
format1
.
sanitize
(
c
ontext
);
case
1
:
return
u
.
format1
.
sanitize
(
c
);
default:
return
true
;
}
}
...
...
@@ -348,25 +348,25 @@ struct GDEF
{
return
(
this
+
attachList
).
get_attach_points
(
glyph_id
,
start_offset
,
point_count
,
point_array
);
}
inline
bool
has_lig_carets
()
const
{
return
ligCaretList
!=
0
;
}
inline
unsigned
int
get_lig_carets
(
hb_ot_layout_context_t
*
c
ontext
,
inline
unsigned
int
get_lig_carets
(
hb_ot_layout_context_t
*
c
,
hb_codepoint_t
glyph_id
,
unsigned
int
start_offset
,
unsigned
int
*
caret_count
/* IN/OUT */
,
int
*
caret_array
/* OUT */
)
const
{
return
(
this
+
ligCaretList
).
get_lig_carets
(
c
ontext
,
glyph_id
,
start_offset
,
caret_count
,
caret_array
);
}
{
return
(
this
+
ligCaretList
).
get_lig_carets
(
c
,
glyph_id
,
start_offset
,
caret_count
,
caret_array
);
}
inline
bool
has_mark_sets
()
const
{
return
version
>=
0x00010002
&&
markGlyphSetsDef
[
0
]
!=
0
;
}
inline
bool
mark_set_covers
(
unsigned
int
set_index
,
hb_codepoint_t
glyph_id
)
const
{
return
version
>=
0x00010002
&&
(
this
+
markGlyphSetsDef
[
0
]).
covers
(
set_index
,
glyph_id
);
}
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
ontext
)
{
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
)
{
TRACE_SANITIZE
();
return
version
.
sanitize
(
c
ontext
)
&&
likely
(
version
.
major
==
1
)
&&
glyphClassDef
.
sanitize
(
c
ontext
,
this
)
&&
attachList
.
sanitize
(
c
ontext
,
this
)
&&
ligCaretList
.
sanitize
(
c
ontext
,
this
)
&&
markAttachClassDef
.
sanitize
(
c
ontext
,
this
)
&&
(
version
<
0x00010002
||
markGlyphSetsDef
[
0
].
sanitize
(
c
ontext
,
this
));
return
version
.
sanitize
(
c
)
&&
likely
(
version
.
major
==
1
)
&&
glyphClassDef
.
sanitize
(
c
,
this
)
&&
attachList
.
sanitize
(
c
,
this
)
&&
ligCaretList
.
sanitize
(
c
,
this
)
&&
markAttachClassDef
.
sanitize
(
c
,
this
)
&&
(
version
<
0x00010002
||
markGlyphSetsDef
[
0
].
sanitize
(
c
,
this
));
}
private:
...
...
src/hb-ot-layout-gpos-private.hh
浏览文件 @
d7cfb3b2
此差异已折叠。
点击以展开。
src/hb-ot-layout-gsub-private.hh
浏览文件 @
d7cfb3b2
此差异已折叠。
点击以展开。
src/hb-ot-layout-gsubgpos-private.hh
浏览文件 @
d7cfb3b2
此差异已折叠。
点击以展开。
src/hb-ot-layout.cc
浏览文件 @
d7cfb3b2
...
...
@@ -320,10 +320,10 @@ hb_ot_layout_get_lig_carets (hb_font_t *font,
unsigned
int
*
caret_count
/* IN/OUT */
,
int
*
caret_array
/* OUT */
)
{
hb_ot_layout_context_t
c
ontext
;
c
ontext
.
font
=
font
;
c
ontext
.
face
=
face
;
return
_get_gdef
(
face
).
get_lig_carets
(
&
c
ontext
,
glyph
,
start_offset
,
caret_count
,
caret_array
);
hb_ot_layout_context_t
c
;
c
.
font
=
font
;
c
.
face
=
face
;
return
_get_gdef
(
face
).
get_lig_carets
(
&
c
,
glyph
,
start_offset
,
caret_count
,
caret_array
);
}
/*
...
...
@@ -564,10 +564,10 @@ hb_ot_layout_substitute_lookup (hb_face_t *face,
unsigned
int
lookup_index
,
hb_mask_t
mask
)
{
hb_ot_layout_context_t
c
ontext
;
c
ontext
.
font
=
NULL
;
c
ontext
.
face
=
face
;
return
_get_gsub
(
face
).
substitute_lookup
(
&
c
ontext
,
buffer
,
lookup_index
,
mask
);
hb_ot_layout_context_t
c
;
c
.
font
=
NULL
;
c
.
face
=
face
;
return
_get_gsub
(
face
).
substitute_lookup
(
&
c
,
buffer
,
lookup_index
,
mask
);
}
...
...
@@ -588,10 +588,10 @@ hb_ot_layout_position_lookup (hb_font_t *font,
unsigned
int
lookup_index
,
hb_mask_t
mask
)
{
hb_ot_layout_context_t
c
ontext
;
c
ontext
.
font
=
font
;
c
ontext
.
face
=
face
;
return
_get_gpos
(
face
).
position_lookup
(
&
c
ontext
,
buffer
,
lookup_index
,
mask
);
hb_ot_layout_context_t
c
;
c
.
font
=
font
;
c
.
face
=
face
;
return
_get_gpos
(
face
).
position_lookup
(
&
c
,
buffer
,
lookup_index
,
mask
);
}
void
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录