Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Harfbuzz
提交
1ce11b44
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看板
提交
1ce11b44
编写于
4月 16, 2019
作者:
D
David Corbett
提交者:
Behdad Esfahbod
4月 16, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Reduce LangTag from 3 language system tags to 1
上级
155e92f2
变更
3
展开全部
隐藏空白更改
内联
并排
Showing
3 changed file
with
1053 addition
and
1060 deletion
+1053
-1060
src/gen-tag-table.py
src/gen-tag-table.py
+1
-12
src/hb-ot-tag-table.hh
src/hb-ot-tag-table.hh
+1038
-1040
src/hb-ot-tag.cc
src/hb-ot-tag.cc
+14
-8
未找到文件。
src/gen-tag-table.py
浏览文件 @
1ce11b44
...
...
@@ -895,20 +895,11 @@ def language_name_intersection (a, b):
def
get_matching_language_name
(
intersection
,
candidates
):
return
next
(
iter
(
c
for
c
in
candidates
if
not
intersection
.
isdisjoint
(
get_variant_set
(
c
))))
maximum_tags
=
0
for
language
,
tags
in
sorted
(
ot
.
from_bcp_47
.
items
()):
if
language
==
''
or
'-'
in
language
:
continue
print
(
' {
\"
%s
\"
,
\t
{'
%
language
,
end
=
''
)
maximum_tags
=
max
(
maximum_tags
,
len
(
tags
))
tag_count
=
len
(
tags
)
for
i
,
tag
in
enumerate
(
tags
,
start
=
1
):
if
i
>
1
:
print
(
'
\t\t
'
,
end
=
''
)
print
(
hb_tag
(
tag
),
end
=
''
)
if
i
==
tag_count
:
print
(
'}}'
,
end
=
''
)
print
(
',
\t
/* '
,
end
=
''
)
print
(
' {
\"
%s
\"
,
\t
%s},
\t
/* '
%
(
language
,
hb_tag
(
tag
)),
end
=
''
)
bcp_47_name
=
bcp_47
.
names
.
get
(
language
,
''
)
bcp_47_name_candidates
=
bcp_47_name
.
split
(
'
\n
'
)
intersection
=
language_name_intersection
(
bcp_47_name
,
ot
.
names
[
tag
])
...
...
@@ -923,8 +914,6 @@ for language, tags in sorted (ot.from_bcp_47.items ()):
print
(
'};'
)
print
()
print
(
'static_assert (HB_OT_MAX_TAGS_PER_LANGUAGE == %iu, "");'
%
maximum_tags
)
print
()
print
(
'/**'
)
print
(
' * hb_ot_tags_from_complex_language:'
)
...
...
src/hb-ot-tag-table.hh
浏览文件 @
1ce11b44
此差异已折叠。
点击以展开。
src/hb-ot-tag.cc
浏览文件 @
1ce11b44
...
...
@@ -198,7 +198,7 @@ lang_matches (const char *lang_str, const char *spec)
struct
LangTag
{
char
language
[
4
];
hb_tag_t
tag
s
[
HB_OT_MAX_TAGS_PER_LANGUAGE
]
;
hb_tag_t
tag
;
int
cmp
(
const
char
*
a
)
const
{
...
...
@@ -246,6 +246,7 @@ hb_ot_tags_from_language (const char *lang_str,
hb_tag_t
*
tags
)
{
const
char
*
s
;
unsigned
int
tag_idx
;
/* Check for matches of multiple subtags. */
if
(
hb_ot_tags_from_complex_language
(
lang_str
,
limit
,
count
,
tags
))
...
...
@@ -254,7 +255,6 @@ hb_ot_tags_from_language (const char *lang_str,
/* Find a language matching in the first component. */
s
=
strchr
(
lang_str
,
'-'
);
{
const
LangTag
*
lang_tag
;
if
(
s
&&
limit
-
lang_str
>=
6
)
{
const
char
*
extlang_end
=
strchr
(
s
+
1
,
'-'
);
...
...
@@ -263,12 +263,18 @@ hb_ot_tags_from_language (const char *lang_str,
ISALPHA
(
s
[
1
]))
lang_str
=
s
+
1
;
}
lang_tag
=
hb_sorted_array
(
ot_languages
).
bsearch
(
lang_str
);
if
(
lang_tag
)
if
(
hb_sorted_array
(
ot_languages
).
bfind
(
lang_str
,
&
tag_idx
))
{
unsigned
int
i
;
for
(
i
=
0
;
i
<
*
count
&&
lang_tag
->
tags
[
i
]
!=
HB_TAG_NONE
;
i
++
)
tags
[
i
]
=
lang_tag
->
tags
[
i
];
while
(
tag_idx
!=
0
&&
0
==
strcmp
(
ot_languages
[
tag_idx
].
language
,
ot_languages
[
tag_idx
-
1
].
language
))
tag_idx
--
;
for
(
i
=
0
;
i
<
*
count
&&
tag_idx
+
i
<
ARRAY_LENGTH
(
ot_languages
)
&&
0
==
strcmp
(
ot_languages
[
tag_idx
+
i
].
language
,
ot_languages
[
tag_idx
].
language
);
i
++
)
tags
[
i
]
=
ot_languages
[
tag_idx
+
i
].
tag
;
*
count
=
i
;
return
;
}
...
...
@@ -417,7 +423,7 @@ hb_ot_tag_to_language (hb_tag_t tag)
}
for
(
i
=
0
;
i
<
ARRAY_LENGTH
(
ot_languages
);
i
++
)
if
(
ot_languages
[
i
].
tag
s
[
0
]
==
tag
)
if
(
ot_languages
[
i
].
tag
==
tag
)
return
hb_language_from_string
(
ot_languages
[
i
].
language
,
-
1
);
/* Else return a custom language in the form of "x-hbotABCD" */
...
...
@@ -506,7 +512,7 @@ test_langs_sorted ()
for
(
unsigned
int
i
=
1
;
i
<
ARRAY_LENGTH
(
ot_languages
);
i
++
)
{
int
c
=
ot_languages
[
i
].
cmp
(
&
ot_languages
[
i
-
1
]);
if
(
c
>
=
0
)
if
(
c
>
0
)
{
fprintf
(
stderr
,
"ot_languages not sorted at index %d: %s %d %s
\n
"
,
i
,
ot_languages
[
i
-
1
].
language
,
c
,
ot_languages
[
i
].
language
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录