Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Harfbuzz
提交
df6d7803
T
Third Party Harfbuzz
项目概览
OpenHarmony
/
Third Party Harfbuzz
12 个月 前同步成功
通知
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,发现更多精彩内容 >>
提交
df6d7803
编写于
2月 12, 2018
作者:
G
Garret Rieger
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[subset] Extract maxp subsetting into hb-ot-maxp-table.
上级
865b6971
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
23 addition
and
29 deletion
+23
-29
src/hb-ot-maxp-table.hh
src/hb-ot-maxp-table.hh
+18
-1
src/hb-subset.cc
src/hb-subset.cc
+2
-26
test/api/test-subset-glyf.c
test/api/test-subset-glyf.c
+3
-2
未找到文件。
src/hb-ot-maxp-table.hh
浏览文件 @
df6d7803
...
...
@@ -28,7 +28,7 @@
#define HB_OT_MAXP_TABLE_HH
#include "hb-open-type-private.hh"
#include "hb-subset-plan.hh"
namespace
OT
{
...
...
@@ -61,6 +61,23 @@ struct maxp
(
version
.
major
==
0
&&
version
.
minor
==
0x5000u
)));
}
inline
hb_blob_t
*
subset
(
hb_subset_plan_t
*
plan
,
hb_face_t
*
source
)
const
{
hb_blob_t
*
maxp_blob
=
OT
::
Sanitizer
<
OT
::
maxp
>
().
sanitize
(
hb_face_reference_table
(
source
,
HB_OT_TAG_maxp
));
hb_blob_t
*
maxp_prime_blob
=
hb_blob_create_sub_blob
(
maxp_blob
,
0
,
-
1
);
hb_blob_destroy
(
maxp_blob
);
OT
::
maxp
*
maxp_prime
=
(
OT
::
maxp
*
)
hb_blob_get_data_writable
(
maxp_prime_blob
,
nullptr
);
if
(
unlikely
(
!
maxp_prime
))
{
hb_blob_destroy
(
maxp_prime_blob
);
return
nullptr
;
}
maxp_prime
->
set_num_glyphs
(
plan
->
gids_to_retain_sorted
.
len
);
return
maxp_prime_blob
;
}
/* We only implement version 0.5 as none of the extra fields in version 1.0 are useful. */
protected:
FixedVersion
<>
version
;
/* Version of the maxp table (0.5 or 1.0),
...
...
src/hb-subset.cc
浏览文件 @
df6d7803
...
...
@@ -279,31 +279,6 @@ _add_head_and_set_loca_version (hb_face_t *source, bool use_short_loca, hb_face_
return
has_head
;
}
static
bool
_add_maxp_and_set_glyph_count
(
hb_subset_plan_t
*
plan
,
hb_face_t
*
source
,
hb_face_t
*
dest
)
{
hb_blob_t
*
maxp_blob
=
OT
::
Sanitizer
<
OT
::
maxp
>
().
sanitize
(
hb_face_reference_table
(
source
,
HB_OT_TAG_maxp
));
const
OT
::
maxp
*
maxp
=
OT
::
Sanitizer
<
OT
::
maxp
>::
lock_instance
(
maxp_blob
);
bool
has_maxp
=
(
maxp
!=
nullptr
);
if
(
has_maxp
)
{
unsigned
int
length
=
hb_blob_get_length
(
maxp_blob
);
OT
::
maxp
*
maxp_prime
=
(
OT
::
maxp
*
)
calloc
(
length
,
1
);
memcpy
(
maxp_prime
,
maxp
,
length
);
maxp_prime
->
set_num_glyphs
(
plan
->
gids_to_retain_sorted
.
len
);
hb_blob_t
*
maxp_prime_blob
=
hb_blob_create
((
const
char
*
)
maxp_prime
,
length
,
HB_MEMORY_MODE_READONLY
,
maxp_prime
,
free
);
has_maxp
=
hb_subset_face_add_table
(
dest
,
HB_OT_TAG_maxp
,
maxp_prime_blob
);
hb_blob_destroy
(
maxp_prime_blob
);
}
hb_blob_destroy
(
maxp_blob
);
return
has_maxp
;
}
static
bool
_subset_glyf
(
hb_subset_plan_t
*
plan
,
hb_face_t
*
source
,
hb_face_t
*
dest
)
{
...
...
@@ -343,7 +318,8 @@ _subset_table (hb_subset_plan_t *plan,
// SKIP head, it's handled by glyf
return
true
;
case
HB_OT_TAG_maxp
:
return
_add_maxp_and_set_glyph_count
(
plan
,
source
,
dest
);
dest_blob
=
_subset
<
const
OT
::
maxp
>
(
plan
,
source
);
break
;
case
HB_OT_TAG_loca
:
// SKIP loca, it's handle by glyf
return
true
;
...
...
test/api/test-subset-glyf.c
浏览文件 @
df6d7803
...
...
@@ -34,8 +34,8 @@
static
void
test_subset_glyf
(
void
)
{
hb_face_t
*
face_abc
=
hb_subset_test_open_font
(
"fonts/Roboto-Regular.abc.ttf"
);
hb_face_t
*
face_ac
=
hb_subset_test_open_font
(
"fonts/Roboto-Regular.ac.ttf"
);
hb_face_t
*
face_abc
=
hb_subset_test_open_font
(
"fonts/Roboto-Regular.abc.ttf"
);
hb_face_t
*
face_ac
=
hb_subset_test_open_font
(
"fonts/Roboto-Regular.ac.ttf"
);
hb_set_t
*
codepoints
=
hb_set_create
();
hb_set_add
(
codepoints
,
97
);
...
...
@@ -45,6 +45,7 @@ test_subset_glyf (void)
hb_subset_test_check
(
face_ac
,
face_abc_subset
,
HB_TAG
(
'g'
,
'l'
,
'y'
,
'f'
));
hb_subset_test_check
(
face_ac
,
face_abc_subset
,
HB_TAG
(
'l'
,
'o'
,
'c'
,
'a'
));
hb_subset_test_check
(
face_ac
,
face_abc_subset
,
HB_TAG
(
'm'
,
'a'
,
'x'
,
'p'
));
hb_face_destroy
(
face_abc_subset
);
hb_face_destroy
(
face_abc
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录