Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Harfbuzz
提交
cc4d9810
T
Third Party Harfbuzz
项目概览
OpenHarmony
/
Third Party Harfbuzz
接近 2 年 前同步成功
通知
1
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看板
提交
cc4d9810
编写于
1月 19, 2012
作者:
B
Behdad Esfahbod
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[hb-shape] Add --show-text and --show-unicode options
上级
27c36af4
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
50 addition
and
7 deletion
+50
-7
util/hb-shape.cc
util/hb-shape.cc
+18
-1
util/options.cc
util/options.cc
+23
-3
util/options.hh
util/options.hh
+9
-3
未找到文件。
util/hb-shape.cc
浏览文件 @
cc4d9810
...
...
@@ -42,6 +42,7 @@ struct output_buffer_t : output_options_t, format_options_t
protected:
GString
*
gs
;
hb_font_t
*
font
;
hb_buffer_t
*
scratch
;
};
void
...
...
@@ -50,6 +51,7 @@ output_buffer_t::init (const font_options_t *font_opts)
get_file_handle
();
font
=
hb_font_reference
(
font_opts
->
get_font
());
gs
=
g_string_new
(
NULL
);
scratch
=
hb_buffer_create
();
}
void
...
...
@@ -58,13 +60,28 @@ output_buffer_t::consume_line (hb_buffer_t *buffer,
unsigned
int
text_len
)
{
g_string_set_size
(
gs
,
0
);
serialize
(
buffer
,
font
,
gs
);
if
(
show_text
)
{
g_string_append_len
(
gs
,
text
,
text_len
);
g_string_append_c
(
gs
,
'\n'
);
}
if
(
show_unicode
)
{
hb_buffer_reset
(
scratch
);
hb_buffer_add_utf8
(
scratch
,
text
,
text_len
,
0
,
-
1
);
serialize_unicode
(
buffer
,
gs
);
g_string_append_c
(
gs
,
'\n'
);
}
serialize_glyphs
(
buffer
,
font
,
gs
);
fprintf
(
fp
,
"%s
\n
"
,
gs
->
str
);
}
void
output_buffer_t
::
finish
(
const
font_options_t
*
font_opts
)
{
hb_buffer_destroy
(
scratch
);
scratch
=
NULL
;
g_string_free
(
gs
,
TRUE
);
gs
=
NULL
;
hb_font_destroy
(
font
);
...
...
util/options.cc
浏览文件 @
cc4d9810
...
...
@@ -676,6 +676,8 @@ format_options_t::add_options (option_parser_t *parser)
{
"no-glyph-names"
,
0
,
G_OPTION_FLAG_REVERSE
,
G_OPTION_ARG_NONE
,
&
this
->
show_glyph_names
,
"Use glyph indices instead of names"
,
NULL
},
{
"no-positions"
,
0
,
G_OPTION_FLAG_REVERSE
,
G_OPTION_ARG_NONE
,
&
this
->
show_positions
,
"Do not show glyph positions"
,
NULL
},
{
"no-clusters"
,
0
,
G_OPTION_FLAG_REVERSE
,
G_OPTION_ARG_NONE
,
&
this
->
show_clusters
,
"Do not show cluster mapping"
,
NULL
},
{
"show-text"
,
0
,
0
,
G_OPTION_ARG_NONE
,
&
this
->
show_text
,
"Show input text"
,
NULL
},
{
"show-unicode"
,
0
,
0
,
G_OPTION_ARG_NONE
,
&
this
->
show_unicode
,
"Show input Unicode codepoints"
,
NULL
},
{
NULL
}
};
parser
->
add_group
(
entries
,
...
...
@@ -686,9 +688,27 @@ format_options_t::add_options (option_parser_t *parser)
}
void
format_options_t
::
serialize
(
hb_buffer_t
*
buffer
,
hb_font_t
*
font
,
GString
*
gs
)
format_options_t
::
serialize_unicode
(
hb_buffer_t
*
buffer
,
GString
*
gs
)
{
unsigned
int
num_glyphs
=
hb_buffer_get_length
(
buffer
);
hb_glyph_info_t
*
info
=
hb_buffer_get_glyph_infos
(
buffer
,
NULL
);
g_string_append_c
(
gs
,
'<'
);
for
(
unsigned
int
i
=
0
;
i
<
num_glyphs
;
i
++
)
{
if
(
i
)
g_string_append_c
(
gs
,
','
);
g_string_append_printf
(
gs
,
"U+%04X"
,
info
->
codepoint
);
info
++
;
}
g_string_append_c
(
gs
,
'>'
);
}
void
format_options_t
::
serialize_glyphs
(
hb_buffer_t
*
buffer
,
hb_font_t
*
font
,
GString
*
gs
)
{
FT_Face
ft_face
=
show_glyph_names
?
hb_ft_font_get_face
(
font
)
:
NULL
;
...
...
util/options.hh
浏览文件 @
cc4d9810
...
...
@@ -283,6 +283,8 @@ struct format_options_t : option_group_t
show_glyph_names
=
true
;
show_positions
=
true
;
show_clusters
=
true
;
show_text
=
false
;
show_unicode
=
false
;
add_options
(
parser
);
}
...
...
@@ -291,14 +293,18 @@ struct format_options_t : option_group_t
void
add_options
(
option_parser_t
*
parser
);
void
serialize
(
hb_buffer_t
*
buffer
,
hb_font_t
*
font
,
GString
*
gs
);
void
serialize_unicode
(
hb_buffer_t
*
buffer
,
GString
*
gs
);
void
serialize_glyphs
(
hb_buffer_t
*
buffer
,
hb_font_t
*
font
,
GString
*
gs
);
protected:
hb_bool_t
show_glyph_names
;
hb_bool_t
show_positions
;
hb_bool_t
show_clusters
;
hb_bool_t
show_text
;
hb_bool_t
show_unicode
;
};
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录