Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Harfbuzz
提交
9ef55a4c
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看板
提交
9ef55a4c
编写于
5月 02, 2018
作者:
G
Garret Rieger
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[subset] A few bug fixes for cmap format 4 subsetting.
上级
81ea75f5
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
33 addition
and
24 deletion
+33
-24
src/hb-ot-cmap-table.hh
src/hb-ot-cmap-table.hh
+33
-24
未找到文件。
src/hb-ot-cmap-table.hh
浏览文件 @
9ef55a4c
...
...
@@ -92,7 +92,7 @@ struct CmapSubtableFormat4
// 2 * (2**floor(log2(segCount)))
this
->
searchRangeZ
.
set
(
2
*
(
1
<<
(
int
)
(
log
(
segments
.
len
)
/
log
(
2.0
))));
// log2(searchRange/2)
this
->
entrySelectorZ
.
set
(
log
((
double
)
this
->
searchRangeZ
)
/
log
(
2.0
));
this
->
entrySelectorZ
.
set
(
log
((
double
)
this
->
searchRangeZ
/
2.0
)
/
log
(
2.0
));
// 2 x segCount - searchRange
this
->
rangeShiftZ
.
set
(
2
*
segments
.
len
-
this
->
searchRangeZ
);
...
...
@@ -102,20 +102,26 @@ struct CmapSubtableFormat4
HBINT16
*
id_delta
=
c
->
allocate_size
<
HBINT16
>
(
HBUINT16
::
static_size
*
segments
.
len
);
HBUINT16
*
id_range_offset
=
c
->
allocate_size
<
HBUINT16
>
(
HBUINT16
::
static_size
*
segments
.
len
);
if
(
id_range_offset
==
nullptr
)
return_trace
(
false
);
for
(
unsigned
int
i
=
0
;
i
<
segments
.
len
;
i
++
)
{
end_count
[
i
].
set
(
segments
[
i
].
end_code
);
start_count
[
i
].
set
(
segments
[
i
].
start_code
);
if
(
segments
[
i
].
use_delta
)
{
hb_codepoint_t
start_gid
;
if
(
unlikely
(
!
hb_subset_plan_new_gid_for_codepoint
(
plan
,
segments
[
i
].
start_code
,
&
start_gid
)))
return
false
;
hb_codepoint_t
cp
=
segments
[
i
].
start_code
;
hb_codepoint_t
start_gid
=
0
;
if
(
unlikely
(
!
hb_subset_plan_new_gid_for_codepoint
(
plan
,
cp
,
&
start_gid
)
&&
cp
!=
0xFFFF
))
return_trace
(
false
);
id_delta
[
i
].
set
(
start_gid
-
segments
[
i
].
start_code
);
}
else
{
id_delta
[
i
].
set
(
0
);
unsigned
int
num_codepoints
=
segments
[
i
].
end_code
-
segments
[
i
].
start_code
+
1
;
HBUINT16
*
glyph_id_array
=
c
->
allocate_size
<
HBUINT16
>
(
HBUINT16
::
static_size
*
num_codepoints
);
if
(
glyph_id_array
==
nullptr
)
return_trace
(
false
);
// From the cmap spec:
//
// id_range_offset[i]/2
...
...
@@ -134,15 +140,15 @@ struct CmapSubtableFormat4
for
(
unsigned
int
j
=
0
;
j
<
num_codepoints
;
j
++
)
{
hb_codepoint_t
cp
=
segments
[
i
].
start_code
+
j
;
hb_codepoint_t
new_gid
=
0
;
// Default to not def for 0xFFFF
if
(
unlikely
(
!
hb_subset_plan_new_gid_for_codepoint
(
plan
,
cp
,
&
new_gid
)
&&
cp
!=
0xFFFF
))
return
false
;
hb_codepoint_t
new_gid
;
if
(
unlikely
(
!
hb_subset_plan_new_gid_for_codepoint
(
plan
,
cp
,
&
new_gid
)))
return
_trace
(
false
)
;
glyph_id_array
[
j
].
set
(
new_gid
);
}
}
}
return
true
;
return
_trace
(
true
)
;
}
static
inline
size_t
get_sub_table_size
(
const
hb_vector_t
<
segment_plan
>
&
segments
)
...
...
@@ -201,16 +207,17 @@ struct CmapSubtableFormat4
segment
->
use_delta
=
false
;
}
// There must be a final entry with end_code == 0xFFFF. Check if we need to add one.
if
(
segment
==
nullptr
||
segment
->
end_code
!=
0xFFFF
)
{
segment
=
segments
->
push
();
segment
->
start_code
.
set
(
0xFFFF
);
segment
->
end_code
.
set
(
0xFFFF
);
segment
->
use_delta
=
false
;
}
last_gid
=
new_gid
;
}
// There must be a final entry with end_code == 0xFFFF. Check if we need to add one.
if
(
segment
==
nullptr
||
segment
->
end_code
!=
0xFFFF
)
{
segment
=
segments
->
push
();
segment
->
start_code
.
set
(
0xFFFF
);
segment
->
end_code
.
set
(
0xFFFF
);
segment
->
use_delta
=
true
;
}
return
true
;
}
...
...
@@ -756,11 +763,10 @@ struct cmap
inline
size_t
final_size
()
const
{
return
4
// header
+
8
*
2
// 2 EncodingRecord
+
CmapSubtableFormat4
::
get_sub_table_size
(
this
->
format4_segments
);
+
CmapSubtableFormat12
::
get_sub_table_size
(
this
->
format12_groups
);
return
4
// header
+
8
*
2
// 2 EncodingRecord
+
CmapSubtableFormat4
::
get_sub_table_size
(
this
->
format4_segments
)
+
CmapSubtableFormat12
::
get_sub_table_size
(
this
->
format12_groups
);
}
// Format 4
...
...
@@ -801,7 +807,8 @@ struct cmap
cmap
->
version
.
set
(
0
);
if
(
unlikely
(
!
cmap
->
encodingRecord
.
serialize
(
&
c
,
/* numTables */
2
)))
return
false
;
if
(
unlikely
(
!
cmap
->
encodingRecord
.
serialize
(
&
c
,
/* numTables */
2
)))
return
false
;
// TODO(grieger): Convert the below to a for loop
...
...
@@ -821,7 +828,8 @@ struct cmap
subtable
.
u
.
format
.
set
(
4
);
CmapSubtableFormat4
&
format4
=
subtable
.
u
.
format4
;
if
(
unlikely
(
!
format4
.
serialize
(
&
c
,
plan
,
cmap_subset_plan
.
format4_segments
)))
return
false
;
if
(
unlikely
(
!
format4
.
serialize
(
&
c
,
plan
,
cmap_subset_plan
.
format4_segments
)))
return
false
;
}
// Write out format 12 sub table.
...
...
@@ -830,7 +838,8 @@ struct cmap
subtable
.
u
.
format
.
set
(
12
);
CmapSubtableFormat12
&
format12
=
subtable
.
u
.
format12
;
if
(
unlikely
(
!
format12
.
serialize
(
&
c
,
cmap_subset_plan
.
format12_groups
)))
return
false
;
if
(
unlikely
(
!
format12
.
serialize
(
&
c
,
cmap_subset_plan
.
format12_groups
)))
return
false
;
}
c
.
end_serialize
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录