Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Harfbuzz
提交
bdeea605
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看板
提交
bdeea605
编写于
7月 21, 2013
作者:
B
Behdad Esfahbod
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[uniscribe] Move name generation into separate function
上级
73f947e2
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
22 addition
and
12 deletion
+22
-12
src/hb-uniscribe.cc
src/hb-uniscribe.cc
+22
-12
未找到文件。
src/hb-uniscribe.cc
浏览文件 @
bdeea605
...
...
@@ -272,20 +272,18 @@ struct hb_uniscribe_shaper_face_data_t {
wchar_t
face_name
[
LF_FACESIZE
];
};
/*
Destroys blob
. */
static
hb_blob_t
*
_hb_
rename_font
(
hb_blob_t
*
blob
,
wchar_t
*
new_name
)
/*
face_name should point to a wchar_t[LF_FACESIZE] object
. */
static
void
_hb_
generate_unique_face_name
(
wchar_t
*
face_name
,
unsigned
int
*
plen
)
{
unsigned
int
length
,
new_length
=
0
;
const
char
*
orig_sfnt_data
=
hb_blob_get_data
(
blob
,
&
length
);
/* We'll create a private name for the font from a UUID using a simple,
* somewhat base64-like encoding scheme */
const
char
*
enc
=
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-"
;
UUID
id
;
UuidCreate
((
UUID
*
)
&
id
);
unsigned
int
name_str_len
=
0
;
new
_name
[
name_str_len
++
]
=
'F'
;
new
_name
[
name_str_len
++
]
=
'_'
;
face
_name
[
name_str_len
++
]
=
'F'
;
face
_name
[
name_str_len
++
]
=
'_'
;
unsigned
char
*
p
=
(
unsigned
char
*
)
&
id
;
for
(
unsigned
int
i
=
0
;
i
<
16
;
i
+=
2
)
{
...
...
@@ -294,11 +292,23 @@ _hb_rename_font (hb_blob_t *blob, wchar_t *new_name)
* This will generate 24 characters; with the 'F_' prefix we already provided,
* the name will be 26 chars (plus the NUL terminator), so will always fit within
* face_name (LF_FACESIZE = 32). */
new
_name
[
name_str_len
++
]
=
enc
[
p
[
i
]
>>
3
];
new
_name
[
name_str_len
++
]
=
enc
[((
p
[
i
]
<<
2
)
|
(
p
[
i
+
1
]
>>
6
))
&
0x1f
];
new
_name
[
name_str_len
++
]
=
enc
[
p
[
i
+
1
]
&
0x3f
];
face
_name
[
name_str_len
++
]
=
enc
[
p
[
i
]
>>
3
];
face
_name
[
name_str_len
++
]
=
enc
[((
p
[
i
]
<<
2
)
|
(
p
[
i
+
1
]
>>
6
))
&
0x1f
];
face
_name
[
name_str_len
++
]
=
enc
[
p
[
i
+
1
]
&
0x3f
];
}
new_name
[
name_str_len
]
=
0
;
face_name
[
name_str_len
]
=
0
;
if
(
plen
)
*
plen
=
name_str_len
;
}
/* Destroys blob. */
static
hb_blob_t
*
_hb_rename_font
(
hb_blob_t
*
blob
,
wchar_t
*
new_name
)
{
unsigned
int
length
,
new_length
,
name_str_len
;
const
char
*
orig_sfnt_data
=
hb_blob_get_data
(
blob
,
&
length
);
_hb_generate_unique_face_name
(
new_name
,
&
name_str_len
);
/* Create a copy of the font data, with the 'name' table replaced by a table
* that names the font with our private F_* name created above.
...
...
@@ -328,7 +338,7 @@ _hb_rename_font (hb_blob_t *blob, wchar_t *new_name)
unsigned
char
*
name_table_data
=
(
unsigned
char
*
)
(
new_sfnt_data
+
name_table_offset
);
p
=
name_table_data
;
unsigned
char
*
p
=
name_table_data
;
*
p
++
=
0x00
;
*
p
++
=
0x00
;
/* format = 0 */
*
p
++
=
0x00
;
*
p
++
=
name_count
;
/* number of name records */
*
p
++
=
0x00
;
*
p
++
=
name_header_size
+
name_count
*
name_record_size
;
/* offset to string data */
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录