Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Harfbuzz
提交
fa3a69e2
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,发现更多精彩内容 >>
提交
fa3a69e2
编写于
2月 26, 2018
作者:
B
Behdad Esfahbod
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[aat/trak] Simplify sanitize()
上级
f0bc6c09
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
16 addition
and
51 deletion
+16
-51
src/hb-aat-layout-trak-table.hh
src/hb-aat-layout-trak-table.hh
+16
-51
未找到文件。
src/hb-aat-layout-trak-table.hh
浏览文件 @
fa3a69e2
...
...
@@ -42,15 +42,15 @@ struct TrackTableEntry
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
,
const
void
*
base
,
unsigned
int
size
)
const
{
TRACE_SANITIZE
(
this
);
return_trace
(
c
->
check_struct
(
this
)
&&
(
(
base
+
values
).
sanitize
(
c
,
size
)));
return_trace
(
c
->
check_struct
(
this
)
&&
(
values
.
sanitize
(
c
,
base
,
size
)));
}
inline
Fixed
get_track_value
()
const
inline
float
get_track_value
()
const
{
return
track
;
return
track
.
to_float
()
;
}
inline
floa
t
get_value
(
const
void
*
base
,
unsigned
int
index
)
const
inline
in
t
get_value
(
const
void
*
base
,
unsigned
int
index
)
const
{
return
(
base
+
values
)[
index
];
}
...
...
@@ -58,7 +58,7 @@ struct TrackTableEntry
protected:
Fixed
track
;
/* Track value for this record. */
HBUINT16
trackNameID
;
/* The 'name' table index for this track */
OffsetTo
<
UnsizedArrayOf
<
HBINT16
>
>
OffsetTo
<
UnsizedArrayOf
<
FWORD
>
>
values
;
/* Offset from start of tracking table to
* per-size tracking values for this track. */
...
...
@@ -71,26 +71,9 @@ struct TrackData
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
,
const
void
*
base
)
const
{
TRACE_SANITIZE
(
this
);
if
(
!
(
c
->
check_struct
(
this
)))
return_trace
(
false
);
unsigned
int
tracks
=
nTracks
;
unsigned
int
sizes
=
nSizes
;
// It should have at least one track
if
(
tracks
<
1
)
return_trace
(
false
);
// We can not do interpolation with less than two
if
(
sizes
<
2
)
return_trace
(
false
);
if
(
!
((
base
+
sizeTable
).
sanitize
(
c
,
sizes
)))
return_trace
(
false
);
for
(
unsigned
int
i
=
0
;
i
<
tracks
;
++
i
)
if
(
!
(
trackTable
[
i
].
sanitize
(
c
,
base
,
sizes
)))
return_trace
(
false
);
return_trace
(
true
);
return_trace
(
c
->
check_struct
(
this
)
&&
sizeTable
.
sanitize
(
c
,
base
,
nSizes
)
&&
trackTable
.
sanitize
(
c
,
nTracks
,
base
,
nSizes
));
}
inline
float
get_tracking
(
const
void
*
base
,
float
ptem
)
const
...
...
@@ -104,15 +87,14 @@ struct TrackData
Fixed
fixed_size
;
fixed_size
.
set_float
(
csspx
);
/*
TODO Clean this up
. */
/*
XXX Clean this up. Make it work with nSizes==1 and 0
. */
unsigned
int
tracks
=
nTracks
;
unsigned
int
sizes
=
nSizes
;
const
TrackTableEntry
*
trackTableEntry
=
nullptr
;
for
(
unsigned
int
i
=
0
;
i
<
sizes
;
++
i
)
// For now we only seek for track entries with zero tracking value
if
(
trackTable
[
i
].
get_track_value
()
==
0
)
if
(
trackTable
[
i
].
get_track_value
()
==
0
.
)
trackTableEntry
=
&
trackTable
[
0
];
// We couldn't match any, exit
...
...
@@ -142,9 +124,10 @@ struct TrackData
protected:
HBUINT16
nTracks
;
/* Number of separate tracks included in this table. */
HBUINT16
nSizes
;
/* Number of point sizes included in this table. */
LOffsetTo
<
UnsizedArrayOf
<
Fixed
>
>
LOffsetTo
<
UnsizedArrayOf
<
Fixed
>
>
/* Offset to array[nSizes] of size values. */
sizeTable
;
UnsizedArrayOf
<
TrackTableEntry
>
trackTable
;
/* Array[nSizes] of size values. */
UnsizedArrayOf
<
TrackTableEntry
>
trackTable
;
/* Array[nTracks] of TrackTableEntry records. */
public:
DEFINE_SIZE_ARRAY
(
8
,
trackTable
);
...
...
@@ -158,27 +141,9 @@ struct trak
{
TRACE_SANITIZE
(
this
);
if
(
!
(
c
->
check_struct
(
this
)))
return_trace
(
false
);
if
((
format
!=
0
)
||
(
reserved
!=
0
))
return_trace
(
false
);
if
(
horizData
)
{
const
TrackData
&
trackData
=
this
+
horizData
;
if
(
!
trackData
.
sanitize
(
c
,
this
))
return_trace
(
false
);
}
if
(
vertData
)
{
const
TrackData
&
trackData
=
this
+
horizData
;
if
(
!
trackData
.
sanitize
(
c
,
this
))
return_trace
(
false
);
}
return_trace
(
true
);
return_trace
(
c
->
check_struct
(
this
)
&&
horizData
.
sanitize
(
c
,
this
,
this
)
&&
vertData
.
sanitize
(
c
,
this
,
this
));
}
inline
bool
apply
(
hb_aat_apply_context_t
*
c
)
const
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录