Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Harfbuzz
提交
6745a600
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看板
提交
6745a600
编写于
4月 16, 2019
作者:
D
David Corbett
提交者:
Behdad Esfahbod
4月 17, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Comment out ot_languages where fallback suffices
上级
5daeff3e
变更
4
展开全部
隐藏空白更改
内联
并排
Showing
4 changed file
with
255 addition
and
227 deletion
+255
-227
src/gen-tag-table.py
src/gen-tag-table.py
+12
-3
src/hb-ot-tag-table.hh
src/hb-ot-tag-table.hh
+223
-220
src/hb-ot-tag.cc
src/hb-ot-tag.cc
+16
-3
test/api/test-ot-tag.c
test/api/test-ot-tag.c
+4
-1
未找到文件。
src/gen-tag-table.py
浏览文件 @
6745a600
...
...
@@ -895,11 +895,18 @@ 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
))))
def
same_tag
(
bcp_47_tag
,
ot_tags
):
return
len
(
bcp_47_tag
)
==
3
and
len
(
ot_tags
)
==
1
and
bcp_47_tag
==
ot_tags
[
0
].
lower
()
for
language
,
tags
in
sorted
(
ot
.
from_bcp_47
.
items
()):
if
language
==
''
or
'-'
in
language
:
continue
commented_out
=
same_tag
(
language
,
tags
)
for
i
,
tag
in
enumerate
(
tags
,
start
=
1
):
print
(
' {
\"
%s
\"
,
\t
%s},
\t
/* '
%
(
language
,
hb_tag
(
tag
)),
end
=
''
)
print
(
'%s{
\"
%s
\"
,
\t
%s},'
%
(
'/*'
if
commented_out
else
' '
,
language
,
hb_tag
(
tag
)),
end
=
''
)
if
commented_out
:
print
(
'*/'
,
end
=
''
)
print
(
'
\t
/* '
,
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
])
...
...
@@ -1040,7 +1047,8 @@ print (' * @tag: A language tag.')
print
(
' *'
)
print
(
' * Converts @tag to a BCP 47 language tag if it is ambiguous (it corresponds to'
)
print
(
' * many language tags) and the best tag is not the alphabetically first, or if'
)
print
(
' * the best tag consists of multiple subtags.'
)
print
(
' * the best tag consists of multiple subtags, or if the best tag does not appear'
)
print
(
' * in #ot_languages.'
)
print
(
' *'
)
print
(
' * Return value: The #hb_language_t corresponding to the BCP 47 language tag,'
)
print
(
' * or #HB_LANGUAGE_INVALID if @tag is not ambiguous.'
)
...
...
@@ -1091,7 +1099,8 @@ def verify_disambiguation_dict ():
'%s is not a valid disambiguation for %s'
%
(
disambiguation
[
ot_tag
],
ot_tag
))
elif
ot_tag
not
in
disambiguation
:
disambiguation
[
ot_tag
]
=
macrolanguages
[
0
]
if
disambiguation
[
ot_tag
]
==
sorted
(
primary_tags
)[
0
]
and
'-'
not
in
disambiguation
[
ot_tag
]:
different_primary_tags
=
sorted
(
t
for
t
in
primary_tags
if
not
same_tag
(
t
,
ot
.
from_bcp_47
.
get
(
t
)))
if
different_primary_tags
and
disambiguation
[
ot_tag
]
==
different_primary_tags
[
0
]
and
'-'
not
in
disambiguation
[
ot_tag
]:
del
disambiguation
[
ot_tag
]
for
ot_tag
in
disambiguation
.
keys
():
expect
(
ot_tag
in
ot
.
to_bcp_47
,
'unknown OT tag: %s'
%
ot_tag
)
...
...
src/hb-ot-tag-table.hh
浏览文件 @
6745a600
此差异已折叠。
点击以展开。
src/hb-ot-tag.cc
浏览文件 @
6745a600
...
...
@@ -426,17 +426,30 @@ hb_ot_tag_to_language (hb_tag_t 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" */
/* If it's three letters long, assume it's ISO 639-3 and lower-case and use it
* (if it's not a registered tag, calling hb_ot_tag_from_language on the
* result might not return the same tag as the original tag).
* Else return a custom language in the form of "x-hbotABCD". */
{
unsigned
char
buf
[
11
]
=
"x-hbot"
;
char
buf
[
11
]
=
"x-hbot"
;
char
*
str
=
buf
;
buf
[
6
]
=
tag
>>
24
;
buf
[
7
]
=
(
tag
>>
16
)
&
0xFF
;
buf
[
8
]
=
(
tag
>>
8
)
&
0xFF
;
buf
[
9
]
=
tag
&
0xFF
;
if
(
buf
[
9
]
==
0x20
)
{
buf
[
9
]
=
'\0'
;
if
(
ISALPHA
(
buf
[
6
])
&&
ISALPHA
(
buf
[
7
])
&&
ISALPHA
(
buf
[
8
]))
{
buf
[
6
]
=
TOLOWER
(
buf
[
6
]);
buf
[
7
]
=
TOLOWER
(
buf
[
7
]);
buf
[
8
]
=
TOLOWER
(
buf
[
8
]);
str
+=
6
;
}
}
buf
[
10
]
=
'\0'
;
return
hb_language_from_string
(
(
char
*
)
buf
,
-
1
);
return
hb_language_from_string
(
str
,
-
1
);
}
}
...
...
test/api/test-ot-tag.c
浏览文件 @
6745a600
...
...
@@ -281,6 +281,8 @@ test_ot_tag_language (void)
g_assert_cmphex
(
HB_TAG_CHAR4
(
"dflt"
),
==
,
HB_OT_TAG_DEFAULT_LANGUAGE
);
test_language_two_way
(
"dflt"
,
NULL
);
test_language_two_way
(
"ALT"
,
"alt"
);
test_language_two_way
(
"ARA"
,
"ar"
);
test_language_two_way
(
"AZE"
,
"az"
);
...
...
@@ -353,7 +355,8 @@ test_ot_tag_language (void)
test_tag_from_language
(
"ZHS"
,
"zh"
);
/* Chinese */
test_tag_from_language
(
"ZHS"
,
"zh-xx"
);
test_language_two_way
(
"ABC"
,
"x-hbotabc"
);
test_language_two_way
(
"ABC"
,
"abc"
);
test_language_two_way
(
"ABCD"
,
"x-hbotabcd"
);
test_tag_from_language
(
"ABC"
,
"asdf-asdf-wer-x-hbotabc-zxc"
);
test_tag_from_language
(
"ABC"
,
"asdf-asdf-wer-x-hbotabc"
);
test_tag_from_language
(
"ABCD"
,
"asdf-asdf-wer-x-hbotabcd"
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录