Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Harfbuzz
提交
3da79dd5
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看板
未验证
提交
3da79dd5
编写于
2月 15, 2019
作者:
B
Behdad Esfahbod
提交者:
GitHub
2月 15, 2019
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #1557 from harfbuzz/cff-more-arrayof-fixes
CFF more arrayof fixes
上级
50005501
d8a68728
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
24 addition
and
27 deletion
+24
-27
src/hb-ot-cff1-table.hh
src/hb-ot-cff1-table.hh
+24
-27
未找到文件。
src/hb-ot-cff1-table.hh
浏览文件 @
3da79dd5
...
...
@@ -59,14 +59,14 @@ struct Encoding0 {
bool
sanitize
(
hb_sanitize_context_t
*
c
)
const
{
TRACE_SANITIZE
(
this
);
return_trace
(
c
->
check_struct
(
this
)
&&
codes
[
nCodes
-
1
]
.
sanitize
(
c
));
return_trace
(
c
odes
.
sanitize
(
c
));
}
hb_codepoint_t
get_code
(
hb_codepoint_t
glyph
)
const
{
assert
(
glyph
>
0
);
glyph
--
;
if
(
glyph
<
nCodes
)
if
(
glyph
<
nCodes
()
)
{
return
(
hb_codepoint_t
)
codes
[
glyph
];
}
...
...
@@ -74,13 +74,12 @@ struct Encoding0 {
return
CFF_UNDEF_CODE
;
}
unsigned
int
get_size
()
const
{
return
HBUINT8
::
static_size
*
(
nCodes
+
1
)
;
}
HBUINT8
&
nCodes
()
{
return
codes
.
len
;
}
HBUINT8
nCodes
()
const
{
return
codes
.
len
;
}
HBUINT8
nCodes
;
HBUINT8
codes
[
VAR
];
ArrayOf
<
HBUINT8
,
HBUINT8
>
codes
;
DEFINE_SIZE_ARRAY
(
1
,
codes
);
DEFINE_SIZE_ARRAY
_SIZED
(
1
,
codes
);
};
struct
Encoding1_Range
{
...
...
@@ -97,20 +96,17 @@ struct Encoding1_Range {
};
struct
Encoding1
{
unsigned
int
get_size
()
const
{
return
HBUINT8
::
static_size
+
Encoding1_Range
::
static_size
*
nRanges
;
}
bool
sanitize
(
hb_sanitize_context_t
*
c
)
const
{
TRACE_SANITIZE
(
this
);
return_trace
(
c
->
check_struct
(
this
)
&&
((
nRanges
==
0
)
||
(
ranges
[
nRanges
-
1
]).
sanitize
(
c
)
));
return_trace
(
ranges
.
sanitize
(
c
));
}
hb_codepoint_t
get_code
(
hb_codepoint_t
glyph
)
const
{
assert
(
glyph
>
0
);
glyph
--
;
for
(
unsigned
int
i
=
0
;
i
<
nRanges
;
i
++
)
for
(
unsigned
int
i
=
0
;
i
<
nRanges
()
;
i
++
)
{
if
(
glyph
<=
ranges
[
i
].
nLeft
)
{
...
...
@@ -121,10 +117,12 @@ struct Encoding1 {
return
CFF_UNDEF_CODE
;
}
HBUINT8
nRanges
;
Encoding1_Range
ranges
[
VAR
];
HBUINT8
&
nRanges
()
{
return
ranges
.
len
;
}
HBUINT8
nRanges
()
const
{
return
ranges
.
len
;
}
DEFINE_SIZE_ARRAY
(
1
,
ranges
);
ArrayOf
<
Encoding1_Range
,
HBUINT8
>
ranges
;
DEFINE_SIZE_ARRAY_SIZED
(
1
,
ranges
);
};
struct
SuppEncoding
{
...
...
@@ -144,23 +142,22 @@ struct CFF1SuppEncData {
bool
sanitize
(
hb_sanitize_context_t
*
c
)
const
{
TRACE_SANITIZE
(
this
);
return_trace
(
c
->
check_struct
(
this
)
&&
((
nSups
==
0
)
||
(
supps
[
nSups
-
1
]).
sanitize
(
c
)
));
return_trace
(
supps
.
sanitize
(
c
));
}
void
get_codes
(
hb_codepoint_t
sid
,
hb_vector_t
<
hb_codepoint_t
>
&
codes
)
const
{
for
(
unsigned
int
i
=
0
;
i
<
nSups
;
i
++
)
for
(
unsigned
int
i
=
0
;
i
<
nSups
()
;
i
++
)
if
(
sid
==
supps
[
i
].
glyph
)
codes
.
push
(
supps
[
i
].
code
);
}
unsigned
int
get_size
()
const
{
return
HBUINT8
::
static_size
+
SuppEncoding
::
static_size
*
nSups
;
}
HBUINT8
&
nSups
()
{
return
supps
.
len
;
}
HBUINT8
nSups
()
const
{
return
supps
.
len
;
}
HBUINT8
nSups
;
SuppEncoding
supps
[
VAR
];
ArrayOf
<
SuppEncoding
,
HBUINT8
>
supps
;
DEFINE_SIZE_ARRAY
(
1
,
supps
);
DEFINE_SIZE_ARRAY
_SIZED
(
1
,
supps
);
};
struct
Encoding
{
...
...
@@ -204,7 +201,7 @@ struct Encoding {
{
Encoding0
*
fmt0
=
c
->
allocate_size
<
Encoding0
>
(
Encoding0
::
min_size
+
HBUINT8
::
static_size
*
enc_count
);
if
(
unlikely
(
fmt0
==
nullptr
))
return_trace
(
false
);
fmt0
->
nCodes
.
set
(
enc_count
);
fmt0
->
nCodes
()
.
set
(
enc_count
);
unsigned
int
glyph
=
0
;
for
(
unsigned
int
i
=
0
;
i
<
code_ranges
.
length
;
i
++
)
{
...
...
@@ -219,7 +216,7 @@ struct Encoding {
{
Encoding1
*
fmt1
=
c
->
allocate_size
<
Encoding1
>
(
Encoding1
::
min_size
+
Encoding1_Range
::
static_size
*
code_ranges
.
length
);
if
(
unlikely
(
fmt1
==
nullptr
))
return_trace
(
false
);
fmt1
->
nRanges
.
set
(
code_ranges
.
length
);
fmt1
->
nRanges
()
.
set
(
code_ranges
.
length
);
for
(
unsigned
int
i
=
0
;
i
<
code_ranges
.
length
;
i
++
)
{
if
(
unlikely
(
!
((
code_ranges
[
i
].
code
<=
0xFF
)
&&
(
code_ranges
[
i
].
glyph
<=
0xFF
))))
...
...
@@ -232,7 +229,7 @@ struct Encoding {
{
CFF1SuppEncData
*
suppData
=
c
->
allocate_size
<
CFF1SuppEncData
>
(
CFF1SuppEncData
::
min_size
+
SuppEncoding
::
static_size
*
supp_codes
.
length
);
if
(
unlikely
(
suppData
==
nullptr
))
return_trace
(
false
);
suppData
->
nSups
.
set
(
supp_codes
.
length
);
suppData
->
nSups
()
.
set
(
supp_codes
.
length
);
for
(
unsigned
int
i
=
0
;
i
<
supp_codes
.
length
;
i
++
)
{
suppData
->
supps
[
i
].
code
.
set
(
supp_codes
[
i
].
code
);
...
...
@@ -291,9 +288,9 @@ struct Encoding {
const
CFF1SuppEncData
&
suppEncData
()
const
{
if
((
format
&
0x7F
)
==
0
)
return
StructAfter
<
CFF1SuppEncData
>
(
u
.
format0
.
codes
[
u
.
format0
.
nCodes
-
1
]);
return
StructAfter
<
CFF1SuppEncData
>
(
u
.
format0
.
codes
[
u
.
format0
.
nCodes
()
-
1
]);
else
return
StructAfter
<
CFF1SuppEncData
>
(
u
.
format1
.
ranges
[
u
.
format1
.
nRanges
-
1
]);
return
StructAfter
<
CFF1SuppEncData
>
(
u
.
format1
.
ranges
[
u
.
format1
.
nRanges
()
-
1
]);
}
public:
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录