Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Harfbuzz
提交
bd75fd45
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看板
提交
bd75fd45
编写于
9月 11, 2018
作者:
B
Behdad Esfahbod
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[dfont] Some renaming, plus add link to reference doc
上级
4134ec13
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
35 addition
and
44 deletion
+35
-44
src/hb-open-file.hh
src/hb-open-file.hh
+35
-44
未找到文件。
src/hb-open-file.hh
浏览文件 @
bd75fd45
...
...
@@ -287,9 +287,11 @@ struct TTCHeader
/*
* Mac Resource Fork
*
* http://mirror.informatimago.com/next/developer.apple.com/documentation/mac/MoreToolbox/MoreToolbox-99.html
*/
struct
ResourceRe
fItem
struct
ResourceRe
cord
{
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
)
const
{
...
...
@@ -298,10 +300,10 @@ struct ResourceRefItem
return_trace
(
likely
(
c
->
check_struct
(
this
)));
}
HBINT16
id
;
/* Resource ID, is really should be signed? */
HB
U
INT16
id
;
/* Resource ID, is really should be signed? */
HBINT16
nameOffset
;
/* Offset from beginning of resource name list
* to resource name, -1 means there is none. */
HBUINT8
attr
;
/* Resource attributes */
HBUINT8
attr
s
;
/* Resource attributes */
HBUINT24
dataOffset
;
/* Offset from beginning of resource data to
* data for this resource */
HBUINT32
reserved
;
/* Reserved for handle to resource */
...
...
@@ -309,7 +311,7 @@ struct ResourceRefItem
DEFINE_SIZE_STATIC
(
12
);
};
struct
ResourceType
Item
struct
ResourceType
Record
{
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
)
const
{
...
...
@@ -318,20 +320,20 @@ struct ResourceTypeItem
return_trace
(
likely
(
c
->
check_struct
(
this
)));
}
inline
unsigned
int
get_resource_count
()
const
{
return
numRes
+
1
;
}
inline
unsigned
int
get_resource_count
()
const
{
return
resCountM1
+
1
;
}
inline
bool
is_sfnt
()
const
{
return
t
ype
==
HB_TAG
(
's'
,
'f'
,
'n'
,
't'
);
}
inline
bool
is_sfnt
()
const
{
return
t
ag
==
HB_TAG
(
's'
,
'f'
,
'n'
,
't'
);
}
inline
const
ResourceRe
fItem
&
get_ref_item
(
const
void
*
base
,
unsigned
int
i
)
const
inline
const
ResourceRe
cord
&
get_resource_record
(
const
void
*
base
,
unsigned
int
i
)
const
{
return
(
base
+
refList
)[
i
];
}
protected:
Tag
t
ype
;
/* Resource type. */
HBUINT16
numRes
;
/* Number of resources minus 1. */
OffsetTo
<
UnsizedArrayOf
<
ResourceRe
fItem
>
>
Tag
t
ag
;
/* Resource type. */
HBUINT16
resCountM1
;
/* Number of resources minus 1. */
OffsetTo
<
UnsizedArrayOf
<
ResourceRe
cord
>
>
refList
;
/* Offset from beginning of resource type list
* to reference item list for this type. */
public:
...
...
@@ -347,51 +349,41 @@ struct ResourceMap
return_trace
(
false
);
for
(
unsigned
int
i
=
0
;
i
<
get_types_count
();
++
i
)
{
const
ResourceType
Item
&
type
=
get_type
(
i
);
const
ResourceType
Record
&
type
=
get_type_record
(
i
);
if
(
unlikely
(
!
type
.
sanitize
(
c
)))
return_trace
(
false
);
for
(
unsigned
int
j
=
0
;
j
<
type
.
get_resource_count
();
++
j
)
if
(
unlikely
(
!
get_re
f_item
(
type
,
j
).
sanitize
(
c
)))
if
(
unlikely
(
!
get_re
source_record
(
type
,
j
).
sanitize
(
c
)))
return_trace
(
false
);
}
return_trace
(
true
);
}
inline
const
ResourceType
Item
&
get_type
(
unsigned
int
i
)
const
inline
const
ResourceType
Record
&
get_type_record
(
unsigned
int
i
)
const
{
// Why offset from the
secon
d byte of the object? I'm not sure
return
((
&
reserved
[
2
])
+
typeList
)[
i
];
// Why offset from the
thir
d byte of the object? I'm not sure
return
((
(
const
char
*
)
this
+
2
)
+
typeListZ
)[
i
];
}
inline
unsigned
int
get_types_count
()
const
{
return
nTypes
+
1
;
}
inline
const
ResourceRefItem
&
get_ref_item
(
const
ResourceTypeItem
&
type
,
unsigned
int
i
)
const
{
return
type
.
get_ref_item
(
&
(
this
+
typeList
),
i
);
}
inline
unsigned
int
get_types_count
()
const
{
return
typeCountM1
+
1
;
}
inline
const
PString
&
get_name
(
const
ResourceRefItem
&
item
,
unsigned
int
i
)
const
inline
const
ResourceRecord
&
get_resource_record
(
const
ResourceTypeRecord
&
type
,
unsigned
int
i
)
const
{
if
(
item
.
nameOffset
<
0
)
return
Null
(
PString
);
return
StructAtOffset
<
PString
>
(
this
,
nameList
+
item
.
nameOffset
);
return
type
.
get_resource_record
(
&
(
this
+
typeListZ
),
i
);
}
protected:
HBUINT8
reserved
[
16
];
/* Reserved for copy of resource header */
LOffsetTo
<
ResourceMap
>
reserved1
;
/* Reserved for handle to next resource map */
HBUINT16
reserved2
;
/* Reserved for file reference number */
HBUINT16
attr
;
/* Resource fork attribute */
OffsetTo
<
UnsizedArrayOf
<
ResourceTypeItem
>
>
typeList
;
/* Offset from beginning of map to
HBUINT8
reserved0
[
16
];
/* Reserved for copy of resource header */
HBUINT32
reserved1
;
/* Reserved for handle to next resource map */
HBUINT16
resreved2
;
/* Reserved for file reference number */
HBUINT16
attrs
;
/* Resource fork attribute */
OffsetTo
<
UnsizedArrayOf
<
ResourceTypeRecord
>
>
typeListZ
;
/* Offset from beginning of map to
* resource type list */
Offset16
nameList
;
/* Offset from beginning of map to
* resource name list */
HBUINT16
nTypes
;
/* Number of types in the map minus 1 */
HBUINT16
typeCountM1
;
/* Number of types in the map minus 1 */
public:
DEFINE_SIZE_STATIC
(
30
);
};
...
...
@@ -403,19 +395,18 @@ struct ResourceForkHeader
const
ResourceMap
&
resource_map
=
this
+
map
;
for
(
unsigned
int
i
=
0
;
i
<
resource_map
.
get_types_count
();
++
i
)
{
const
ResourceType
Item
&
type
=
resource_map
.
get_type
(
i
);
const
ResourceType
Record
&
type
=
resource_map
.
get_type_record
(
i
);
if
(
type
.
is_sfnt
())
return
type
.
get_resource_count
();
}
return
0
;
}
inline
const
LArrayOf
<
HBUINT8
>&
get_data
(
const
ResourceType
Item
&
type
,
inline
const
LArrayOf
<
HBUINT8
>&
get_data
(
const
ResourceType
Record
&
type
,
unsigned
int
idx
)
const
{
const
ResourceMap
&
resource_map
=
this
+
map
;
unsigned
int
offset
=
dataOffset
;
offset
+=
resource_map
.
get_ref_item
(
type
,
idx
).
dataOffset
;
unsigned
int
offset
=
dataOffset
+
resource_map
.
get_resource_record
(
type
,
idx
).
dataOffset
;
return
StructAtOffset
<
LArrayOf
<
HBUINT8
>
>
(
this
,
offset
);
}
...
...
@@ -424,7 +415,7 @@ struct ResourceForkHeader
const
ResourceMap
&
resource_map
=
this
+
map
;
for
(
unsigned
int
i
=
0
;
i
<
resource_map
.
get_types_count
();
++
i
)
{
const
ResourceType
Item
&
type
=
resource_map
.
get_type
(
i
);
const
ResourceType
Record
&
type
=
resource_map
.
get_type_record
(
i
);
if
(
type
.
is_sfnt
()
&&
idx
<
type
.
get_resource_count
())
{
const
OpenTypeFontFace
&
face
=
(
OpenTypeFontFace
&
)
get_data
(
type
,
idx
).
arrayZ
;
...
...
@@ -448,7 +439,7 @@ struct ResourceForkHeader
for
(
unsigned
int
i
=
0
;
i
<
resource_map
.
get_types_count
();
++
i
)
{
const
ResourceType
Item
&
type
=
resource_map
.
get_type
(
i
);
const
ResourceType
Record
&
type
=
resource_map
.
get_type_record
(
i
);
for
(
unsigned
int
j
=
0
;
j
<
type
.
get_resource_count
();
++
j
)
{
const
LArrayOf
<
HBUINT8
>&
data
=
get_data
(
type
,
j
);
...
...
@@ -465,7 +456,7 @@ struct ResourceForkHeader
}
protected:
HBUINT
32
dataOffset
;
/* Offset from beginning of resource fork
Offset
32
dataOffset
;
/* Offset from beginning of resource fork
* to resource data */
LOffsetTo
<
ResourceMap
>
map
;
/* Offset from beginning of resource fork
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录