Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Harfbuzz
提交
70c9bfd5
T
Third Party Harfbuzz
项目概览
OpenHarmony
/
Third Party Harfbuzz
接近 2 年 前同步成功
通知
1
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看板
提交
70c9bfd5
编写于
5月 11, 2010
作者:
B
Behdad Esfahbod
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Simplify PairSet
上级
97e7f8f3
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
54 addition
and
47 deletion
+54
-47
src/hb-ot-layout-gpos-private.hh
src/hb-ot-layout-gpos-private.hh
+54
-47
未找到文件。
src/hb-ot-layout-gpos-private.hh
浏览文件 @
70c9bfd5
...
...
@@ -546,6 +546,7 @@ struct SinglePos
struct
PairValueRecord
{
friend
struct
PairPosFormat1
;
friend
struct
PairSet
;
private:
GlyphID
secondGlyph
;
/* GlyphID of second glyph in the
...
...
@@ -561,12 +562,50 @@ struct PairSet
{
friend
struct
PairPosFormat1
;
/* Note: Doesn't sanitize the Device entries in the ValueRecord */
inline
bool
sanitize
(
hb_sanitize_context_t
*
context
,
unsigned
int
format_len
)
{
inline
bool
apply
(
hb_apply_context_t
*
context
,
const
ValueFormat
*
valueFormats
,
unsigned
int
pos
)
const
{
TRACE_APPLY
();
unsigned
int
len1
=
valueFormats
[
0
].
get_len
();
unsigned
int
len2
=
valueFormats
[
1
].
get_len
();
unsigned
int
record_size
=
USHORT
::
static_size
*
(
1
+
len1
+
len2
);
unsigned
int
count
=
len
;
const
PairValueRecord
*
record
=
CastP
<
PairValueRecord
>
(
array
);
for
(
unsigned
int
i
=
0
;
i
<
count
;
i
++
)
{
if
(
IN_GLYPH
(
pos
)
==
record
->
secondGlyph
)
{
valueFormats
[
0
].
apply_value
(
context
->
layout
,
this
,
&
record
->
values
[
0
],
CURPOSITION
());
valueFormats
[
1
].
apply_value
(
context
->
layout
,
this
,
&
record
->
values
[
len1
],
POSITION
(
pos
));
if
(
len2
)
pos
++
;
context
->
buffer
->
in_pos
=
pos
;
return
true
;
}
record
=
&
StructAtOffset
<
PairValueRecord
>
(
record
,
record_size
);
}
return
false
;
}
struct
sanitize_closure_t
{
void
*
base
;
ValueFormat
*
valueFormats
;
unsigned
int
len1
;
/* valueFormats[0].get_len() */
unsigned
int
stride
;
/* 1 + len1 + len2 */
};
inline
bool
sanitize
(
hb_sanitize_context_t
*
context
,
const
sanitize_closure_t
*
closure
)
{
TRACE_SANITIZE
();
if
(
!
context
->
check_struct
(
this
))
return
false
;
unsigned
int
count
=
(
1
+
format_len
)
*
len
;
return
context
->
check_array
(
array
,
USHORT
::
static_size
,
count
);
if
(
!
(
context
->
check_struct
(
this
)
&&
context
->
check_array
(
array
,
USHORT
::
static_size
*
closure
->
stride
,
len
)))
return
false
;
unsigned
int
count
=
len
;
PairValueRecord
*
record
=
CastP
<
PairValueRecord
>
(
array
);
return
closure
->
valueFormats
[
0
].
sanitize_values_stride_unsafe
(
context
,
closure
->
base
,
&
record
->
values
[
0
],
count
,
closure
->
stride
)
&&
closure
->
valueFormats
[
1
].
sanitize_values_stride_unsafe
(
context
,
closure
->
base
,
&
record
->
values
[
closure
->
len1
],
count
,
closure
->
stride
);
}
private:
...
...
@@ -601,28 +640,7 @@ struct PairPosFormat1
j
++
;
}
unsigned
int
len1
=
valueFormat1
.
get_len
();
unsigned
int
len2
=
valueFormat2
.
get_len
();
unsigned
int
record_size
=
USHORT
::
static_size
*
(
1
+
len1
+
len2
);
const
PairSet
&
pair_set
=
this
+
pairSet
[
index
];
unsigned
int
count
=
pair_set
.
len
;
const
PairValueRecord
*
record
=
CastP
<
PairValueRecord
>
(
pair_set
.
array
);
for
(
unsigned
int
i
=
0
;
i
<
count
;
i
++
)
{
if
(
IN_GLYPH
(
j
)
==
record
->
secondGlyph
)
{
valueFormat1
.
apply_value
(
context
->
layout
,
this
,
&
record
->
values
[
0
],
CURPOSITION
());
valueFormat2
.
apply_value
(
context
->
layout
,
this
,
&
record
->
values
[
len1
],
POSITION
(
j
));
if
(
len2
)
j
++
;
context
->
buffer
->
in_pos
=
j
;
return
true
;
}
record
=
&
StructAtOffset
<
PairValueRecord
>
(
record
,
record_size
);
}
return
false
;
return
(
this
+
pairSet
[
index
]).
apply
(
context
,
&
valueFormat1
,
j
);
}
inline
bool
sanitize
(
hb_sanitize_context_t
*
context
)
{
...
...
@@ -630,27 +648,16 @@ struct PairPosFormat1
unsigned
int
len1
=
valueFormat1
.
get_len
();
unsigned
int
len2
=
valueFormat2
.
get_len
();
PairSet
::
sanitize_closure_t
closure
=
{
this
,
&
valueFormat1
,
len1
,
1
+
len1
+
len2
};
if
(
!
(
context
->
check_struct
(
this
)
&&
coverage
.
sanitize
(
context
,
this
)
&&
pairSet
.
sanitize
(
context
,
this
,
len1
+
len2
)))
return
false
;
if
(
!
(
valueFormat1
.
has_device
()
||
valueFormat2
.
has_device
()))
return
true
;
unsigned
int
stride
=
1
+
len1
+
len2
;
unsigned
int
count1
=
pairSet
.
len
;
for
(
unsigned
int
i
=
0
;
i
<
count1
;
i
++
)
{
PairSet
&
pair_set
=
const_cast
<
PairSet
&>
(
this
+
pairSet
[
i
]);
/* XXX clean this up */
unsigned
int
count2
=
pair_set
.
len
;
PairValueRecord
*
record
=
CastP
<
PairValueRecord
>
(
pair_set
.
array
);
if
(
!
(
valueFormat1
.
sanitize_values_stride_unsafe
(
context
,
this
,
&
record
->
values
[
0
],
count2
,
stride
)
&&
valueFormat2
.
sanitize_values_stride_unsafe
(
context
,
this
,
&
record
->
values
[
len1
],
count2
,
stride
)))
return
false
;
}
return
true
;
return
context
->
check_struct
(
this
)
&&
coverage
.
sanitize
(
context
,
this
)
&&
pairSet
.
sanitize
(
context
,
this
,
&
closure
);
}
private:
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录