Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Harfbuzz
提交
9a6c87c1
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看板
提交
9a6c87c1
编写于
10月 15, 2018
作者:
B
Behdad Esfahbod
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[name] Finish accelerator sorting
上级
2157e56b
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
53 addition
and
11 deletion
+53
-11
src/hb-ot-name-table.hh
src/hb-ot-name-table.hh
+51
-10
src/hb-ot-name.h
src/hb-ot-name.h
+2
-1
未找到文件。
src/hb-ot-name-table.hh
浏览文件 @
9a6c87c1
...
...
@@ -39,6 +39,7 @@ namespace OT {
*/
#define HB_OT_TAG_name HB_TAG('n','a','m','e')
#define UNSUPPORTED 42
struct
NameRecord
{
...
...
@@ -58,11 +59,30 @@ struct NameRecord
return
0
;
}
inline
bool
supported
(
void
)
const
inline
uint16_t
score
(
void
)
const
{
return
platformID
==
0
||
platformID
==
3
;
/* TODO Add Apple MacRoman (0:1). */
/* Same order as in cmap::find_best_subtable(). */
unsigned
int
p
=
platformID
;
unsigned
int
e
=
encodingID
;
/* 32-bit. */
if
(
p
==
3
&&
e
==
10
)
return
0
;
if
(
p
==
0
&&
e
==
6
)
return
1
;
if
(
p
==
0
&&
e
==
4
)
return
2
;
/* 16-bit. */
if
(
p
==
3
&&
e
==
1
)
return
3
;
if
(
p
==
0
&&
e
==
3
)
return
4
;
if
(
p
==
0
&&
e
==
2
)
return
5
;
if
(
p
==
0
&&
e
==
1
)
return
6
;
if
(
p
==
0
&&
e
==
0
)
return
7
;
/* Symbol. */
if
(
p
==
3
&&
e
==
0
)
return
8
;
/* TODO Apple MacRoman (0:1). */
return
UNSUPPORTED
;
}
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
,
const
void
*
base
)
const
...
...
@@ -87,10 +107,23 @@ _hb_ot_name_entry_cmp (const void *pa, const void *pb)
{
const
hb_ot_name_entry_t
*
a
=
(
const
hb_ot_name_entry_t
*
)
pa
;
const
hb_ot_name_entry_t
*
b
=
(
const
hb_ot_name_entry_t
*
)
pb
;
/* Sort by name_id, then language, then score, then index. */
if
(
a
->
name_id
!=
b
->
name_id
)
return
a
->
name_id
<
b
->
name_id
?
-
1
:
+
1
;
int
e
=
strcmp
(
hb_language_to_string
(
a
->
language
),
hb_language_to_string
(
b
->
language
));
if
(
e
)
return
e
;
if
(
a
->
score
!=
b
->
score
)
return
a
->
score
<
b
->
score
?
-
1
:
+
1
;
if
(
a
->
index
!=
b
->
index
)
return
a
->
index
<
b
->
index
?
-
1
:
+
1
;
return
0
;
}
...
...
@@ -151,23 +184,31 @@ struct name
this
->
names
.
init
();
for
(
u
nsigned
in
t
i
=
0
;
i
<
all_names
.
len
;
i
++
)
for
(
u
int16_
t
i
=
0
;
i
<
all_names
.
len
;
i
++
)
{
if
(
!
all_names
[
i
].
supported
())
continue
;
unsigned
int
name_id
=
all_names
[
i
].
nameID
;
uint16_t
score
=
all_names
[
i
].
score
();
hb_language_t
language
=
HB_LANGUAGE_INVALID
;
/* XXX */
hb_ot_name_entry_t
entry
=
{
name_id
,
i
,
language
};
hb_ot_name_entry_t
entry
=
{
name_id
,
score
,
i
,
language
};
this
->
names
.
push
(
entry
);
}
this
->
names
.
qsort
(
_hb_ot_name_entry_cmp
);
/* Walk and pick best... */
/* Walk and pick best only for each name_id,language pair... */
unsigned
int
j
=
0
;
for
(
unsigned
int
i
=
1
;
i
<
this
->
names
.
len
;
i
++
)
{
if
(
this
->
names
[
i
-
1
].
name_id
==
this
->
names
[
i
].
name_id
&&
this
->
names
[
i
-
1
].
language
==
this
->
names
[
i
].
language
)
continue
;
this
->
names
[
j
++
]
=
this
->
names
[
i
];
}
this
->
names
.
resize
(
j
);
}
inline
void
fini
(
void
)
{
this
->
names
.
fini
();
...
...
src/hb-ot-name.h
浏览文件 @
9a6c87c1
...
...
@@ -75,7 +75,8 @@ typedef struct hb_ot_name_entry_t
{
hb_name_id_t
name_id
;
/*< private >*/
unsigned
int
index
;
uint16_t
score
;
uint16_t
index
;
/*< public >*/
hb_language_t
language
;
}
hb_ot_name_entry_t
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录