Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Harfbuzz
提交
295d67ea
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,发现更多精彩内容 >>
提交
295d67ea
编写于
5月 02, 2018
作者:
G
Garret Rieger
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[subset] WIP cmap format 4 subsetting.
上级
0053d132
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
88 addition
and
16 deletion
+88
-16
src/hb-ot-cmap-table.hh
src/hb-ot-cmap-table.hh
+88
-16
未找到文件。
src/hb-ot-cmap-table.hh
浏览文件 @
295d67ea
...
@@ -69,6 +69,48 @@ struct CmapSubtableFormat0
...
@@ -69,6 +69,48 @@ struct CmapSubtableFormat0
struct
CmapSubtableFormat4
struct
CmapSubtableFormat4
{
{
struct
segment_plan
{
HBUINT16
start_code
;
HBUINT16
end_code
;
bool
use_delta
;
};
bool
serialize
(
hb_serialize_context_t
*
c
,
const
hb_subset_plan_t
*
plan
,
const
hb_vector_t
<
segment_plan
>
&
segments
)
{
// TODO
}
static
inline
size_t
get_sub_table_size
(
const
hb_vector_t
<
segment_plan
>
&
segments
)
{
size_t
segment_size
=
0
;
for
(
unsigned
int
i
=
0
;
i
<
segments
.
len
;
i
++
)
{
// Parallel array entries
segment_size
+=
2
// end count
+
2
// start count
+
2
// delta
+
2
;
// range offset
if
(
!
segments
[
i
].
use_delta
)
// Add bytes for the glyph index array entries for this segment.
segment_size
+=
(
segments
[
i
].
end_code
-
segments
[
i
].
start_code
+
1
)
*
2
;
}
return
min_size
+
2
// Padding
+
segment_size
;
}
static
inline
bool
create_sub_table_plan
(
const
hb_subset_plan_t
*
plan
,
hb_vector_t
<
segment_plan
>
*
segments
)
{
// TODO
}
struct
accelerator_t
struct
accelerator_t
{
{
inline
void
init
(
const
CmapSubtableFormat4
*
subtable
)
inline
void
init
(
const
CmapSubtableFormat4
*
subtable
)
...
@@ -175,6 +217,8 @@ struct CmapSubtableFormat4
...
@@ -175,6 +217,8 @@ struct CmapSubtableFormat4
return_trace
(
16
+
4
*
(
unsigned
int
)
segCountX2
<=
length
);
return_trace
(
16
+
4
*
(
unsigned
int
)
segCountX2
<=
length
);
}
}
protected:
protected:
HBUINT16
format
;
/* Format number is set to 4. */
HBUINT16
format
;
/* Format number is set to 4. */
HBUINT16
length
;
/* This is the length in bytes of the
HBUINT16
length
;
/* This is the length in bytes of the
...
@@ -597,24 +641,29 @@ struct cmap
...
@@ -597,24 +641,29 @@ struct cmap
struct
subset_plan
{
struct
subset_plan
{
subset_plan
(
void
)
subset_plan
(
void
)
{
{
groups
.
init
();
format4_segments
.
init
();
format12_groups
.
init
();
}
}
~
subset_plan
(
void
)
~
subset_plan
(
void
)
{
{
groups
.
fini
();
format4_segments
.
fini
();
format12_groups
.
fini
();
}
}
inline
size_t
final_size
()
const
inline
size_t
final_size
()
const
{
{
return
return
4
// header
4
// header
+
8
// 1 EncodingRecord
+
8
*
2
// 2 EncodingRecord
+
CmapSubtableFormat12
::
get_sub_table_size
(
this
->
groups
);
+
CmapSubtableFormat4
::
get_sub_table_size
(
this
->
format4_segments
);
+
CmapSubtableFormat12
::
get_sub_table_size
(
this
->
format12_groups
);
}
}
// Format 4
hb_vector_t
<
CmapSubtableFormat4
::
segment_plan
>
format4_segments
;
// Format 12
// Format 12
hb_vector_t
<
CmapSubtableLongGroup
>
groups
;
hb_vector_t
<
CmapSubtableLongGroup
>
format12_
groups
;
};
};
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
)
const
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
)
const
...
@@ -628,10 +677,14 @@ struct cmap
...
@@ -628,10 +677,14 @@ struct cmap
inline
bool
_create_plan
(
const
hb_subset_plan_t
*
plan
,
inline
bool
_create_plan
(
const
hb_subset_plan_t
*
plan
,
subset_plan
*
cmap_plan
)
const
subset_plan
*
cmap_plan
)
const
{
{
return
CmapSubtableFormat12
::
create_sub_table_plan
(
plan
,
&
cmap_plan
->
groups
);
if
(
unlikely
(
!
CmapSubtableFormat4
::
create_sub_table_plan
(
plan
,
&
cmap_plan
->
format4_segments
)))
return
false
;
return
CmapSubtableFormat12
::
create_sub_table_plan
(
plan
,
&
cmap_plan
->
format12_groups
);
}
}
inline
bool
_subset
(
const
subset_plan
&
cmap_subset_plan
,
inline
bool
_subset
(
const
hb_subset_plan_t
*
plan
,
const
subset_plan
&
cmap_subset_plan
,
size_t
dest_sz
,
size_t
dest_sz
,
void
*
dest
)
const
void
*
dest
)
const
{
{
...
@@ -645,18 +698,37 @@ struct cmap
...
@@ -645,18 +698,37 @@ struct cmap
cmap
->
version
.
set
(
0
);
cmap
->
version
.
set
(
0
);
if
(
unlikely
(
!
cmap
->
encodingRecord
.
serialize
(
&
c
,
/* numTables */
1
)))
return
false
;
if
(
unlikely
(
!
cmap
->
encodingRecord
.
serialize
(
&
c
,
/* numTables */
2
)))
return
false
;
// TODO(grieger): Convert the below to a for loop
EncodingRecord
&
rec
=
cmap
->
encodingRecord
[
0
];
// Format 4 Encoding Record
rec
.
platformID
.
set
(
3
);
// Windows
EncodingRecord
&
format4_rec
=
cmap
->
encodingRecord
[
0
];
rec
.
encodingID
.
set
(
10
);
// Unicode UCS-4
format4_rec
.
platformID
.
set
(
3
);
// Windows
format4_rec
.
encodingID
.
set
(
1
);
// Unicode BMP
// Format 12 Encoding Record
EncodingRecord
&
format12_rec
=
cmap
->
encodingRecord
[
1
];
format12_rec
.
platformID
.
set
(
3
);
// Windows
format12_rec
.
encodingID
.
set
(
10
);
// Unicode UCS-4
// Write out format 4 sub table.
{
CmapSubtable
&
subtable
=
format4_rec
.
subtable
.
serialize
(
&
c
,
cmap
);
subtable
.
u
.
format
.
set
(
4
);
CmapSubtableFormat4
&
format4
=
subtable
.
u
.
format4
;
if
(
unlikely
(
!
format4
.
serialize
(
&
c
,
plan
,
cmap_subset_plan
.
format4_segments
)))
return
false
;
}
// Write out format 12 sub table.
// Write out format 12 sub table.
CmapSubtable
&
subtable
=
rec
.
subtable
.
serialize
(
&
c
,
cmap
);
{
subtable
.
u
.
format
.
set
(
12
);
CmapSubtable
&
subtable
=
format12_rec
.
subtable
.
serialize
(
&
c
,
cmap
);
subtable
.
u
.
format
.
set
(
12
);
CmapSubtableFormat12
&
format12
=
subtable
.
u
.
format12
;
CmapSubtableFormat12
&
format12
=
subtable
.
u
.
format12
;
if
(
unlikely
(
!
format12
.
serialize
(
&
c
,
cmap_subset_plan
.
groups
)))
return
false
;
if
(
unlikely
(
!
format12
.
serialize
(
&
c
,
cmap_subset_plan
.
format12_groups
)))
return
false
;
}
c
.
end_serialize
();
c
.
end_serialize
();
...
@@ -681,7 +753,7 @@ struct cmap
...
@@ -681,7 +753,7 @@ struct cmap
return
false
;
return
false
;
}
}
if
(
unlikely
(
!
_subset
(
cmap_subset_plan
,
dest_sz
,
dest
)))
if
(
unlikely
(
!
_subset
(
plan
,
cmap_subset_plan
,
dest_sz
,
dest
)))
{
{
DEBUG_MSG
(
SUBSET
,
nullptr
,
"Failed to perform subsetting of cmap."
);
DEBUG_MSG
(
SUBSET
,
nullptr
,
"Failed to perform subsetting of cmap."
);
free
(
dest
);
free
(
dest
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录