Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Harfbuzz
提交
ddc4f2b9
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看板
提交
ddc4f2b9
编写于
2月 26, 2018
作者:
G
Garret Rieger
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[subset] Add python util that was used to generated hb-ot-os2-unicode-ranges.hh
上级
f757757e
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
50 addition
and
0 deletion
+50
-0
util/generate-unicode-ranges.py
util/generate-unicode-ranges.py
+50
-0
未找到文件。
util/generate-unicode-ranges.py
0 → 100644
浏览文件 @
ddc4f2b9
# -*- coding: utf-8 -*-
# Generates the code for a sorted unicode range array as used in hb-ot-os2-unicode-ranges.hh
# Input is a tab seperated list of unicode ranges from the otspec.
import
io
import
re
import
sys
reload
(
sys
)
sys
.
setdefaultencoding
(
'utf-8'
)
print
(
u
"""static Range os2UnicodeRangesSorted[] = {"""
)
args
=
sys
.
argv
[
1
:]
input_file
=
args
[
0
]
with
io
.
open
(
input_file
,
mode
=
"r"
,
encoding
=
"utf-8"
)
as
f
:
all_ranges
=
[];
current_bit
=
0
while
True
:
line
=
f
.
readline
().
strip
()
if
not
line
:
break
fields
=
re
.
split
(
r
'\t+'
,
line
)
if
len
(
fields
)
==
3
:
current_bit
=
fields
[
0
]
fields
=
fields
[
1
:]
elif
len
(
fields
)
>
3
:
raise
Error
(
"bad input :(."
)
name
=
fields
[
0
]
ranges
=
re
.
split
(
"-"
,
fields
[
1
])
if
len
(
ranges
)
!=
2
:
raise
Error
(
"bad input :(."
)
v
=
tuple
((
int
(
ranges
[
0
],
16
),
int
(
ranges
[
1
],
16
),
int
(
current_bit
),
name
))
all_ranges
.
append
(
v
)
all_ranges
=
sorted
(
all_ranges
,
key
=
lambda
t
:
t
[
0
])
for
ranges
in
all_ranges
:
start
=
(
"0x%X"
%
ranges
[
0
]).
rjust
(
8
)
end
=
(
"0x%X"
%
ranges
[
1
]).
rjust
(
8
)
bit
=
(
"%s"
%
ranges
[
2
]).
rjust
(
3
)
print
" {%s, %s, %s}, // %s"
%
(
start
,
end
,
bit
,
ranges
[
3
])
print
(
u
"""};"""
);
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录