Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Harfbuzz
提交
02e5e5d9
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看板
提交
02e5e5d9
编写于
5月 13, 2019
作者:
Q
Qunxin Liu
提交者:
Behdad Esfahbod
5月 14, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[subset] retian nameids from STAT and fvar tables
上级
ff799520
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
117 addition
and
6 deletion
+117
-6
src/hb-ot-stat-table.hh
src/hb-ot-stat-table.hh
+70
-6
src/hb-ot-var-fvar-table.hh
src/hb-ot-var-fvar-table.hh
+21
-0
src/hb-subset-plan.cc
src/hb-subset-plan.cc
+26
-0
未找到文件。
src/hb-ot-stat-table.hh
浏览文件 @
02e5e5d9
...
@@ -65,6 +65,8 @@ struct AxisValueFormat1
...
@@ -65,6 +65,8 @@ struct AxisValueFormat1
return_trace
(
likely
(
c
->
check_struct
(
this
)));
return_trace
(
likely
(
c
->
check_struct
(
this
)));
}
}
hb_ot_name_id_t
get_value_name_id
()
const
{
return
valueNameID
;
}
protected:
protected:
HBUINT16
format
;
/* Format identifier — set to 1. */
HBUINT16
format
;
/* Format identifier — set to 1. */
HBUINT16
axisIndex
;
/* Zero-base index into the axis record array
HBUINT16
axisIndex
;
/* Zero-base index into the axis record array
...
@@ -88,6 +90,8 @@ struct AxisValueFormat2
...
@@ -88,6 +90,8 @@ struct AxisValueFormat2
return_trace
(
likely
(
c
->
check_struct
(
this
)));
return_trace
(
likely
(
c
->
check_struct
(
this
)));
}
}
hb_ot_name_id_t
get_value_name_id
()
const
{
return
valueNameID
;
}
protected:
protected:
HBUINT16
format
;
/* Format identifier — set to 2. */
HBUINT16
format
;
/* Format identifier — set to 2. */
HBUINT16
axisIndex
;
/* Zero-base index into the axis record array
HBUINT16
axisIndex
;
/* Zero-base index into the axis record array
...
@@ -115,6 +119,8 @@ struct AxisValueFormat3
...
@@ -115,6 +119,8 @@ struct AxisValueFormat3
return_trace
(
likely
(
c
->
check_struct
(
this
)));
return_trace
(
likely
(
c
->
check_struct
(
this
)));
}
}
hb_ot_name_id_t
get_value_name_id
()
const
{
return
valueNameID
;
}
protected:
protected:
HBUINT16
format
;
/* Format identifier — set to 3. */
HBUINT16
format
;
/* Format identifier — set to 3. */
HBUINT16
axisIndex
;
/* Zero-base index into the axis record array
HBUINT16
axisIndex
;
/* Zero-base index into the axis record array
...
@@ -157,6 +163,8 @@ struct AxisValueFormat4
...
@@ -157,6 +163,8 @@ struct AxisValueFormat4
return_trace
(
likely
(
c
->
check_struct
(
this
)));
return_trace
(
likely
(
c
->
check_struct
(
this
)));
}
}
hb_ot_name_id_t
get_value_name_id
()
const
{
return
valueNameID
;
}
protected:
protected:
HBUINT16
format
;
/* Format identifier — set to 4. */
HBUINT16
format
;
/* Format identifier — set to 4. */
HBUINT16
axisCount
;
/* The total number of axes contributing to
HBUINT16
axisCount
;
/* The total number of axes contributing to
...
@@ -191,6 +199,18 @@ struct AxisValue
...
@@ -191,6 +199,18 @@ struct AxisValue
}
}
}
}
hb_ot_name_id_t
get_value_name_id
()
const
{
switch
(
u
.
format
)
{
case
1
:
return
u
.
format1
.
get_value_name_id
();
case
2
:
return
u
.
format2
.
get_value_name_id
();
case
3
:
return
u
.
format3
.
get_value_name_id
();
case
4
:
return
u
.
format4
.
get_value_name_id
();
default:
return
HB_OT_NAME_ID_INVALID
;
}
}
protected:
protected:
union
union
{
{
...
@@ -212,6 +232,8 @@ struct StatAxisRecord
...
@@ -212,6 +232,8 @@ struct StatAxisRecord
return_trace
(
likely
(
c
->
check_struct
(
this
)));
return_trace
(
likely
(
c
->
check_struct
(
this
)));
}
}
hb_ot_name_id_t
get_name_id
()
const
{
return
nameID
;
}
protected:
protected:
Tag
tag
;
/* A tag identifying the axis of design variation. */
Tag
tag
;
/* A tag identifying the axis of design variation. */
NameID
nameID
;
/* The name ID for entries in the 'name' table that
NameID
nameID
;
/* The name ID for entries in the 'name' table that
...
@@ -231,17 +253,59 @@ struct STAT
...
@@ -231,17 +253,59 @@ struct STAT
{
{
TRACE_SANITIZE
(
this
);
TRACE_SANITIZE
(
this
);
return_trace
(
likely
(
c
->
check_struct
(
this
)
&&
return_trace
(
likely
(
c
->
check_struct
(
this
)
&&
majorVersion
==
1
&&
version
.
major
==
1
&&
minorVersion
>
0
&&
version
.
minor
>
0
&&
designAxesOffset
.
sanitize
(
c
,
this
,
designAxisCount
)
&&
designAxesOffset
.
sanitize
(
c
,
this
,
designAxisCount
)
&&
offsetToAxisValueOffsets
.
sanitize
(
c
,
this
,
axisValueCount
,
&
(
this
+
offsetToAxisValueOffsets
))));
offsetToAxisValueOffsets
.
sanitize
(
c
,
this
,
axisValueCount
,
&
(
this
+
offsetToAxisValueOffsets
))));
}
}
bool
has_data
()
const
{
return
version
.
to_int
();
}
unsigned
get_design_axis_count
()
const
{
return
designAxisCount
;
}
hb_ot_name_id_t
get_axis_record_name_id
(
unsigned
axis_record_index
)
const
{
if
(
unlikely
(
axis_record_index
>=
designAxisCount
))
return
HB_OT_NAME_ID_INVALID
;
const
StatAxisRecord
&
axis_record
=
get_design_axes
()[
axis_record_index
];
return
axis_record
.
get_name_id
();
}
unsigned
get_axis_value_count
()
const
{
return
axisValueCount
;
}
hb_ot_name_id_t
get_axis_value_name_id
(
unsigned
axis_value_index
)
const
{
if
(
unlikely
(
axis_value_index
>=
axisValueCount
))
return
HB_OT_NAME_ID_INVALID
;
const
AxisValue
&
axis_value
=
(
this
+
get_axis_value_offsets
()[
axis_value_index
]);
return
axis_value
.
get_value_name_id
();
}
void
collect_name_ids
(
hb_set_t
*
nameids_to_retain
)
const
{
if
(
!
has_data
())
return
;
+
get_design_axes
()
|
hb_map
(
&
StatAxisRecord
::
get_name_id
)
|
hb_sink
(
nameids_to_retain
)
;
+
get_axis_value_offsets
()
|
hb_map
([
&
]
(
const
OffsetTo
<
AxisValue
>&
_
)
->
const
AxisValue
*
{
return
hb_addressof
(
this
+
_
);
})
|
hb_map
(
&
AxisValue
::
get_value_name_id
)
|
hb_sink
(
nameids_to_retain
)
;
}
protected:
hb_array_t
<
const
StatAxisRecord
>
const
get_design_axes
()
const
{
return
(
this
+
designAxesOffset
).
as_array
(
designAxisCount
);
}
hb_array_t
<
const
OffsetTo
<
AxisValue
>>
const
get_axis_value_offsets
()
const
{
return
(
this
+
offsetToAxisValueOffsets
).
as_array
(
axisValueCount
);
}
protected:
protected:
HBUINT16
majorVersion
;
/* Major version number of the style attributes
FixedVersion
<>
version
;
/* Version of the stat table
* table — set to 1. */
* initially set to 0x00010002u */
HBUINT16
minorVersion
;
/* Minor version number of the style attributes
* table — set to 2. */
HBUINT16
designAxisSize
;
/* The size in bytes of each axis record. */
HBUINT16
designAxisSize
;
/* The size in bytes of each axis record. */
HBUINT16
designAxisCount
;
/* The number of design axis records. In a
HBUINT16
designAxisCount
;
/* The number of design axis records. In a
* font with an 'fvar' table, this value must be
* font with an 'fvar' table, this value must be
...
...
src/hb-ot-var-fvar-table.hh
浏览文件 @
02e5e5d9
...
@@ -280,6 +280,27 @@ struct fvar
...
@@ -280,6 +280,27 @@ struct fvar
return
axisCount
;
return
axisCount
;
}
}
void
collect_name_ids
(
hb_set_t
*
nameids
)
const
{
if
(
!
has_data
())
return
;
+
get_axes
()
|
hb_map
(
&
AxisRecord
::
axisNameID
)
|
hb_sink
(
nameids
)
;
+
hb_range
((
unsigned
)
instanceCount
)
|
hb_map
([
&
]
(
const
unsigned
_
)
->
unsigned
{
return
get_instance_subfamily_name_id
(
_
);
})
|
hb_sink
(
nameids
)
;
+
hb_range
((
unsigned
)
instanceCount
)
|
hb_map
([
&
]
(
const
unsigned
_
)
->
unsigned
{
return
get_instance_postscript_name_id
(
_
);
})
|
hb_sink
(
nameids
)
;
}
protected:
protected:
hb_array_t
<
const
AxisRecord
>
get_axes
()
const
hb_array_t
<
const
AxisRecord
>
get_axes
()
const
{
return
hb_array
(
&
(
this
+
firstAxis
),
axisCount
);
}
{
return
hb_array
(
&
(
this
+
firstAxis
),
axisCount
);
}
...
...
src/hb-subset-plan.cc
浏览文件 @
02e5e5d9
...
@@ -31,6 +31,8 @@
...
@@ -31,6 +31,8 @@
#include "hb-ot-cmap-table.hh"
#include "hb-ot-cmap-table.hh"
#include "hb-ot-glyf-table.hh"
#include "hb-ot-glyf-table.hh"
#include "hb-ot-cff1-table.hh"
#include "hb-ot-cff1-table.hh"
#include "hb-ot-var-fvar-table.hh"
#include "hb-ot-stat-table.hh"
static
inline
void
static
inline
void
_add_gid_and_children
(
const
OT
::
glyf
::
accelerator_t
&
glyf
,
_add_gid_and_children
(
const
OT
::
glyf
::
accelerator_t
&
glyf
,
...
@@ -192,6 +194,29 @@ _create_old_gid_to_new_gid_map (const hb_face_t *face,
...
@@ -192,6 +194,29 @@ _create_old_gid_to_new_gid_map (const hb_face_t *face,
;
;
}
}
static
void
_nameid_closure
(
hb_face_t
*
face
,
hb_set_t
*
nameids
)
{
hb_tag_t
table_tags
[
32
];
unsigned
count
=
ARRAY_LENGTH
(
table_tags
);
hb_face_get_table_tags
(
face
,
0
,
&
count
,
table_tags
);
for
(
unsigned
int
i
=
0
;
i
<
count
;
i
++
)
{
hb_tag_t
tag
=
table_tags
[
i
];
switch
(
tag
)
{
case
HB_OT_TAG_STAT
:
face
->
table
.
STAT
->
collect_name_ids
(
nameids
);
break
;
case
HB_OT_TAG_fvar
:
face
->
table
.
fvar
->
collect_name_ids
(
nameids
);
break
;
default:
break
;
}
}
}
/**
/**
* hb_subset_plan_create:
* hb_subset_plan_create:
* Computes a plan for subsetting the supplied face according
* Computes a plan for subsetting the supplied face according
...
@@ -217,6 +242,7 @@ hb_subset_plan_create (hb_face_t *face,
...
@@ -217,6 +242,7 @@ hb_subset_plan_create (hb_face_t *face,
/* TODO Clean this up... */
/* TODO Clean this up... */
if
(
hb_set_is_empty
(
plan
->
name_ids
))
if
(
hb_set_is_empty
(
plan
->
name_ids
))
hb_set_add_range
(
plan
->
name_ids
,
0
,
0x7FFF
);
hb_set_add_range
(
plan
->
name_ids
,
0
,
0x7FFF
);
_nameid_closure
(
face
,
plan
->
name_ids
);
plan
->
source
=
hb_face_reference
(
face
);
plan
->
source
=
hb_face_reference
(
face
);
plan
->
dest
=
hb_face_builder_create
();
plan
->
dest
=
hb_face_builder_create
();
plan
->
codepoint_to_glyph
=
hb_map_create
();
plan
->
codepoint_to_glyph
=
hb_map_create
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录