Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Harfbuzz
提交
5cde2f55
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看板
提交
5cde2f55
编写于
8月 17, 2018
作者:
M
Michiharu Ariza
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
drop hints from CFF & CFF2 Private
上级
cef75ea4
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
123 addition
and
9 deletion
+123
-9
src/hb-cff-interp-dict-common-private.hh
src/hb-cff-interp-dict-common-private.hh
+24
-0
src/hb-subset-cff1.cc
src/hb-subset-cff1.cc
+49
-4
src/hb-subset-cff2.cc
src/hb-subset-cff2.cc
+50
-5
未找到文件。
src/hb-cff-interp-dict-common-private.hh
浏览文件 @
5cde2f55
...
...
@@ -135,6 +135,30 @@ struct DictOpSet : OpSet
return
true
;
}
static
inline
bool
is_hint_op
(
OpCode
op
)
{
switch
(
op
)
{
case
OpCode_BlueValues
:
case
OpCode_OtherBlues
:
case
OpCode_FamilyBlues
:
case
OpCode_FamilyOtherBlues
:
case
OpCode_StemSnapH
:
case
OpCode_StemSnapV
:
case
OpCode_StdHW
:
case
OpCode_StdVW
:
case
OpCode_BlueScale
:
case
OpCode_BlueShift
:
case
OpCode_BlueFuzz
:
case
OpCode_ForceBold
:
case
OpCode_LanguageGroup
:
case
OpCode_ExpansionFactor
:
return
true
;
default:
return
false
;
}
}
};
struct
TopDictOpSet
:
DictOpSet
...
...
src/hb-subset-cff1.cc
浏览文件 @
5cde2f55
...
...
@@ -188,6 +188,27 @@ struct CFF1PrivateDict_OpSerializer : OpSerializer
}
};
struct
CFF1PrivateDict_OpSerializer_DropHints
:
CFF1PrivateDict_OpSerializer
{
inline
bool
serialize
(
hb_serialize_context_t
*
c
,
const
OpStr
&
opstr
,
const
unsigned
int
subrsOffset
)
const
{
if
(
DictOpSet
::
is_hint_op
(
opstr
.
op
))
return
true
;
else
return
CFF1PrivateDict_OpSerializer
::
serialize
(
c
,
opstr
,
subrsOffset
);
}
inline
unsigned
int
calculate_serialized_size
(
const
OpStr
&
opstr
)
const
{
if
(
DictOpSet
::
is_hint_op
(
opstr
.
op
))
return
0
;
else
return
CFF1PrivateDict_OpSerializer
::
calculate_serialized_size
(
opstr
);
}
};
struct
CFF1CSOpSet_SubrSubset
:
CFF1CSOpSet
<
SubrRefMapPair
>
{
static
inline
bool
process_op
(
OpCode
op
,
CFF1CSInterpEnv
&
env
,
SubrRefMapPair
&
refMapPair
)
...
...
@@ -244,6 +265,7 @@ struct cff_subset_plan {
{
final_size
=
0
;
orig_fdcount
=
acc
.
fdCount
;
drop_hints
=
plan
->
drop_hints
;
/* CFF header */
final_size
+=
OT
::
cff1
::
static_size
;
...
...
@@ -338,8 +360,18 @@ struct cff_subset_plan {
{
if
(
!
fdmap
.
excludes
(
i
))
{
CFF1PrivateDict_OpSerializer
privSzr
;
TableInfo
privInfo
=
{
final_size
,
PrivateDict
::
calculate_serialized_size
(
acc
.
privateDicts
[
i
],
privSzr
),
0
};
unsigned
int
priv_size
;
if
(
plan
->
drop_hints
)
{
CFF1PrivateDict_OpSerializer_DropHints
privSzr_drop
;
priv_size
=
PrivateDict
::
calculate_serialized_size
(
acc
.
privateDicts
[
i
],
privSzr_drop
);
}
else
{
CFF1PrivateDict_OpSerializer
privSzr
;
priv_size
=
PrivateDict
::
calculate_serialized_size
(
acc
.
privateDicts
[
i
],
privSzr
);
}
TableInfo
privInfo
=
{
final_size
,
priv_size
,
0
};
privateDictInfos
.
push
(
privInfo
);
final_size
+=
privInfo
.
size
+
offsets
.
localSubrsInfos
[
i
].
size
;
}
...
...
@@ -371,6 +403,8 @@ struct cff_subset_plan {
hb_vector_t
<
TableInfo
>
privateDictInfos
;
SubrRefMaps
subrRefMaps
;
bool
drop_hints
;
};
static
inline
bool
_write_cff1
(
const
cff_subset_plan
&
plan
,
...
...
@@ -531,9 +565,20 @@ static inline bool _write_cff1 (const cff_subset_plan &plan,
{
PrivateDict
*
pd
=
c
.
start_embed
<
PrivateDict
>
();
if
(
unlikely
(
pd
==
nullptr
))
return
false
;
CFF1PrivateDict_OpSerializer
privSzr
;
unsigned
int
priv_size
=
plan
.
privateDictInfos
[
plan
.
fdmap
[
i
]].
size
;
bool
result
;
/* N.B. local subrs immediately follows its corresponding private dict. i.e., subr offset == private dict size */
if
(
unlikely
(
!
pd
->
serialize
(
&
c
,
acc
.
privateDicts
[
i
],
privSzr
,
plan
.
privateDictInfos
[
plan
.
fdmap
[
i
]].
size
)))
if
(
plan
.
drop_hints
)
{
CFF1PrivateDict_OpSerializer_DropHints
privSzr_drop
;
result
=
pd
->
serialize
(
&
c
,
acc
.
privateDicts
[
i
],
privSzr_drop
,
priv_size
);
}
else
{
CFF1PrivateDict_OpSerializer
privSzr
;
result
=
pd
->
serialize
(
&
c
,
acc
.
privateDicts
[
i
],
privSzr
,
priv_size
);
}
if
(
unlikely
(
!
result
))
{
DEBUG_MSG
(
SUBSET
,
nullptr
,
"failed to serialize CFF Private Dict[%d]"
,
i
);
return
false
;
...
...
src/hb-subset-cff2.cc
浏览文件 @
5cde2f55
...
...
@@ -166,6 +166,27 @@ struct CFF2PrivateDict_OpSerializer : OpSerializer
}
};
struct
CFF2PrivateDict_OpSerializer_DropHints
:
CFF2PrivateDict_OpSerializer
{
inline
bool
serialize
(
hb_serialize_context_t
*
c
,
const
OpStr
&
opstr
,
const
unsigned
int
subrsOffset
)
const
{
if
(
DictOpSet
::
is_hint_op
(
opstr
.
op
))
return
true
;
else
return
CFF2PrivateDict_OpSerializer
::
serialize
(
c
,
opstr
,
subrsOffset
);
}
inline
unsigned
int
calculate_serialized_size
(
const
OpStr
&
opstr
)
const
{
if
(
DictOpSet
::
is_hint_op
(
opstr
.
op
))
return
0
;
else
return
CFF2PrivateDict_OpSerializer
::
calculate_serialized_size
(
opstr
);
}
};
struct
CFF2CSOpSet_SubrSubset
:
CFF2CSOpSet
<
SubrRefMapPair
>
{
static
inline
bool
process_op
(
OpCode
op
,
CFF2CSInterpEnv
&
env
,
SubrRefMapPair
&
refMapPair
)
...
...
@@ -219,6 +240,8 @@ struct cff2_subset_plan {
final_size
=
0
;
orig_fdcount
=
acc
.
fdArray
->
count
;
drop_hints
=
plan
->
drop_hints
;
/* CFF2 header */
final_size
+=
OT
::
cff2
::
static_size
;
...
...
@@ -299,8 +322,18 @@ struct cff2_subset_plan {
{
if
(
!
fdmap
.
excludes
(
i
))
{
CFF2PrivateDict_OpSerializer
privSzr
;
TableInfo
privInfo
=
{
final_size
,
PrivateDict
::
calculate_serialized_size
(
acc
.
privateDicts
[
i
],
privSzr
),
0
};
unsigned
int
priv_size
;
if
(
plan
->
drop_hints
)
{
CFF2PrivateDict_OpSerializer_DropHints
privSzr_drop
;
priv_size
=
PrivateDict
::
calculate_serialized_size
(
acc
.
privateDicts
[
i
],
privSzr_drop
);
}
else
{
CFF2PrivateDict_OpSerializer
privSzr
;
priv_size
=
PrivateDict
::
calculate_serialized_size
(
acc
.
privateDicts
[
i
],
privSzr
);
}
TableInfo
privInfo
=
{
final_size
,
priv_size
,
0
};
privateDictInfos
.
push
(
privInfo
);
final_size
+=
privInfo
.
size
+
offsets
.
localSubrsInfos
[
i
].
size
;
}
...
...
@@ -326,6 +359,8 @@ struct cff2_subset_plan {
hb_vector_t
<
TableInfo
>
privateDictInfos
;
SubrRefMaps
subrRefMaps
;
bool
drop_hints
;
};
static
inline
bool
_write_cff2
(
const
cff2_subset_plan
&
plan
,
...
...
@@ -444,9 +479,19 @@ static inline bool _write_cff2 (const cff2_subset_plan &plan,
{
PrivateDict
*
pd
=
c
.
start_embed
<
PrivateDict
>
();
if
(
unlikely
(
pd
==
nullptr
))
return
false
;
CFF2PrivateDict_OpSerializer
privSzr
;
/* N.B. local subrs immediately follows its corresponding private dict. i.e., subr offset == private dict size */
if
(
unlikely
(
!
pd
->
serialize
(
&
c
,
acc
.
privateDicts
[
i
],
privSzr
,
plan
.
privateDictInfos
[
plan
.
fdmap
[
i
]].
size
)))
unsigned
int
priv_size
=
plan
.
privateDictInfos
[
plan
.
fdmap
[
i
]].
size
;
bool
result
;
if
(
plan
.
drop_hints
)
{
CFF2PrivateDict_OpSerializer_DropHints
privSzr_drop
;
result
=
pd
->
serialize
(
&
c
,
acc
.
privateDicts
[
i
],
privSzr_drop
,
priv_size
);
}
else
{
CFF2PrivateDict_OpSerializer
privSzr
;
result
=
pd
->
serialize
(
&
c
,
acc
.
privateDicts
[
i
],
privSzr
,
priv_size
);
}
if
(
unlikely
(
!
result
))
{
DEBUG_MSG
(
SUBSET
,
nullptr
,
"failed to serialize CFF2 Private Dict[%d]"
,
i
);
return
false
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录