Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Harfbuzz
提交
23f36442
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看板
提交
23f36442
编写于
1月 18, 2019
作者:
G
Garret Rieger
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[subset] Fix hdmx subsetting when retain gids is enabled.
上级
2da1654a
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
36 addition
and
9 deletion
+36
-9
src/hb-ot-hdmx-table.hh
src/hb-ot-hdmx-table.hh
+11
-8
src/hb-subset-plan.cc
src/hb-subset-plan.cc
+10
-0
src/hb-subset-plan.hh
src/hb-subset-plan.hh
+15
-1
未找到文件。
src/hb-ot-hdmx-table.hh
浏览文件 @
23f36442
...
...
@@ -57,16 +57,19 @@ struct DeviceRecord
}
unsigned
int
len
()
const
{
return
this
->
subset_plan
->
glyphs
.
length
;
}
{
return
this
->
subset_plan
->
num_glyphs
;
}
const
HBUINT8
*
operator
[]
(
unsigned
int
i
)
const
const
HBUINT8
*
operator
[]
(
unsigned
int
new_gid
)
const
{
if
(
unlikely
(
i
>=
len
()))
return
nullptr
;
hb_codepoint_t
gid
=
this
->
subset_plan
->
glyphs
[
i
];
if
(
unlikely
(
new_gid
>=
len
()))
return
nullptr
;
if
(
gid
>=
sizeDeviceRecord
-
DeviceRecord
::
min_size
)
hb_codepoint_t
old_gid
;
if
(
!
this
->
subset_plan
->
old_gid_for_new_gid
(
new_gid
,
&
old_gid
))
return
&
Null
(
HBUINT8
);
if
(
old_gid
>=
sizeDeviceRecord
-
DeviceRecord
::
min_size
)
return
nullptr
;
return
&
(
this
->
source_device_record
->
widthsZ
[
gid
]);
return
&
(
this
->
source_device_record
->
widthsZ
[
old_
gid
]);
}
};
...
...
@@ -140,7 +143,7 @@ struct hdmx
this
->
version
.
set
(
source_hdmx
->
version
);
this
->
numRecords
.
set
(
source_hdmx
->
numRecords
);
this
->
sizeDeviceRecord
.
set
(
DeviceRecord
::
get_size
(
plan
->
glyphs
.
length
));
this
->
sizeDeviceRecord
.
set
(
DeviceRecord
::
get_size
(
plan
->
num_glyphs
));
for
(
unsigned
int
i
=
0
;
i
<
source_hdmx
->
numRecords
;
i
++
)
{
...
...
@@ -156,7 +159,7 @@ struct hdmx
static
size_t
get_subsetted_size
(
const
hdmx
*
source_hdmx
,
hb_subset_plan_t
*
plan
)
{
return
min_size
+
source_hdmx
->
numRecords
*
DeviceRecord
::
get_size
(
plan
->
glyphs
.
length
);
return
min_size
+
source_hdmx
->
numRecords
*
DeviceRecord
::
get_size
(
plan
->
num_glyphs
);
}
bool
subset
(
hb_subset_plan_t
*
plan
)
const
...
...
src/hb-subset-plan.cc
浏览文件 @
23f36442
...
...
@@ -159,13 +159,20 @@ static void
_create_old_gid_to_new_gid_map
(
bool
retain_gids
,
const
hb_vector_t
<
hb_codepoint_t
>
&
glyphs
,
hb_map_t
*
glyph_map
,
/* OUT */
hb_map_t
*
reverse_glyph_map
,
/* OUT */
unsigned
int
*
num_glyphs
/* OUT */
)
{
for
(
unsigned
int
i
=
0
;
i
<
glyphs
.
length
;
i
++
)
{
if
(
!
retain_gids
)
{
glyph_map
->
set
(
glyphs
[
i
],
i
);
reverse_glyph_map
->
set
(
i
,
glyphs
[
i
]);
}
else
{
glyph_map
->
set
(
glyphs
[
i
],
glyphs
[
i
]);
reverse_glyph_map
->
set
(
glyphs
[
i
],
glyphs
[
i
]);
}
}
if
(
!
retain_gids
||
glyphs
.
length
==
0
)
{
...
...
@@ -202,6 +209,7 @@ hb_subset_plan_create (hb_face_t *face,
plan
->
dest
=
hb_face_builder_create
();
plan
->
codepoint_to_glyph
=
hb_map_create
();
plan
->
glyph_map
=
hb_map_create
();
plan
->
reverse_glyph_map
=
hb_map_create
();
plan
->
glyphset
=
_populate_gids_to_retain
(
face
,
input
->
unicodes
,
!
plan
->
drop_layout
,
...
...
@@ -212,6 +220,7 @@ hb_subset_plan_create (hb_face_t *face,
_create_old_gid_to_new_gid_map
(
input
->
retain_gids
,
plan
->
glyphs
,
plan
->
glyph_map
,
plan
->
reverse_glyph_map
,
&
plan
->
num_glyphs
);
return
plan
;
...
...
@@ -233,6 +242,7 @@ hb_subset_plan_destroy (hb_subset_plan_t *plan)
hb_face_destroy
(
plan
->
dest
);
hb_map_destroy
(
plan
->
codepoint_to_glyph
);
hb_map_destroy
(
plan
->
glyph_map
);
hb_map_destroy
(
plan
->
reverse_glyph_map
);
hb_set_destroy
(
plan
->
glyphset
);
free
(
plan
);
...
...
src/hb-subset-plan.hh
浏览文件 @
23f36442
...
...
@@ -45,11 +45,14 @@ struct hb_subset_plan_t
// For each cp that we'd like to retain maps to the corresponding gid.
hb_set_t
*
unicodes
;
// The glyph subset
hb_vector_t
<
hb_codepoint_t
>
glyphs
;
hb_set_t
*
glyphset
;
hb_map_t
*
codepoint_to_glyph
;
// Old -> New glyph id mapping
hb_map_t
*
glyph_map
;
hb_map_t
*
reverse_glyph_map
;
unsigned
int
num_glyphs
;
// Plan is only good for a specific source/dest so keep them with it
...
...
@@ -77,6 +80,17 @@ struct hb_subset_plan_t
return
true
;
}
bool
old_gid_for_new_gid
(
hb_codepoint_t
new_gid
,
hb_codepoint_t
*
old_gid
)
const
{
hb_codepoint_t
gid
=
reverse_glyph_map
->
get
(
new_gid
);
if
(
gid
==
HB_MAP_VALUE_INVALID
)
return
false
;
*
old_gid
=
gid
;
return
true
;
}
bool
add_table
(
hb_tag_t
tag
,
hb_blob_t
*
contents
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录