Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Harfbuzz
提交
0f8b5aa1
T
Third Party Harfbuzz
项目概览
OpenHarmony
/
Third Party Harfbuzz
11 个月 前同步成功
通知
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
0f8b5aa1
编写于
10月 30, 2017
作者:
B
Behdad Esfahbod
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[post] Minor; towards implementing get_glyph_from_name()
上级
977679f2
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
31 addition
and
25 deletion
+31
-25
src/hb-ot-post-table.hh
src/hb-ot-post-table.hh
+31
-25
未找到文件。
src/hb-ot-post-table.hh
浏览文件 @
0f8b5aa1
...
...
@@ -110,50 +110,56 @@ struct post
index_to_offset
.
finish
();
}
inline
bool
get_glyph_name
(
hb_codepoint_t
glyph
,
char
*
buf
,
unsigned
int
buf_len
)
const
struct
str_t
{
inline
str_t
(
void
)
:
bytes
(
nullptr
),
len
(
0
)
{}
inline
str_t
(
const
char
*
bytes_
,
unsigned
int
len_
)
:
bytes
(
bytes_
),
len
(
len_
)
{}
const
char
*
bytes
;
unsigned
int
len
;
};
inline
str_t
_find_glyph_name
(
hb_codepoint_t
glyph
)
const
{
if
(
version
==
0x00010000
)
{
if
(
glyph
>=
NUM_FORMAT1_NAMES
)
return
false
;
return
str_t
()
;
if
(
!
buf_len
)
return
true
;
strncpy
(
buf
,
format1_names
(
glyph
),
buf_len
);
buf
[
buf_len
-
1
]
=
'\0'
;
return
true
;
return
str_t
(
format1_names
(
glyph
),
strlen
(
format1_names
(
glyph
)));
}
if
(
version
!=
0x00020000
)
return
false
;
if
(
glyph
>=
glyphNameIndex
->
len
)
return
false
;
if
(
version
!=
0x00020000
||
glyph
>=
glyphNameIndex
->
len
)
return
str_t
();
unsigned
int
index
=
glyphNameIndex
->
array
[
glyph
];
if
(
index
<
NUM_FORMAT1_NAMES
)
{
if
(
!
buf_len
)
return
true
;
strncpy
(
buf
,
format1_names
(
index
),
buf_len
);
buf
[
buf_len
-
1
]
=
'\0'
;
return
true
;
}
return
str_t
(
format1_names
(
index
),
strlen
(
format1_names
(
index
)));
index
-=
NUM_FORMAT1_NAMES
;
if
(
index
>=
index_to_offset
.
len
)
return
false
;
return
str_t
()
;
unsigned
int
offset
=
index_to_offset
.
array
[
index
];
const
uint8_t
*
data
=
pool
+
offset
;
unsigned
int
name_length
=
*
data
;
data
++
;
if
(
unlikely
(
!
name_length
||
buf_len
<=
name_length
))
return
false
;
memcpy
(
buf
,
data
,
name_length
);
buf
[
name_length
]
=
'\0'
;
return
str_t
((
const
char
*
)
data
,
name_length
);
}
inline
bool
get_glyph_name
(
hb_codepoint_t
glyph
,
char
*
buf
,
unsigned
int
buf_len
)
const
{
str_t
s
=
_find_glyph_name
(
glyph
);
if
(
!
s
.
len
)
return
false
;
if
(
!
buf_len
)
return
true
;
if
(
buf_len
<=
s
.
len
)
/* What to do with truncation? Returning false for now. */
return
false
;
strncpy
(
buf
,
s
.
bytes
,
s
.
len
);
buf
[
s
.
len
]
=
'\0'
;
return
true
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录