Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Harfbuzz
提交
bc4b07b0
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看板
提交
bc4b07b0
编写于
9月 08, 2011
作者:
B
Behdad Esfahbod
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
More reshuffling
上级
516857eb
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
43 addition
and
38 deletion
+43
-38
util/hb-view.cc
util/hb-view.cc
+2
-2
util/options.cc
util/options.cc
+34
-30
util/options.hh
util/options.hh
+7
-6
未找到文件。
util/hb-view.cc
浏览文件 @
bc4b07b0
...
...
@@ -149,7 +149,7 @@ draw (void)
cairo_glyph_t
*
glyphs
=
NULL
;
unsigned
int
num_glyphs
=
0
;
const
char
*
end
,
*
p
=
shape_opts
->
text
;
const
char
*
end
,
*
p
=
text
;
double
x
,
y
;
cr
=
create_context
();
...
...
@@ -170,7 +170,7 @@ draw (void)
if
(
!
end
)
end
=
p
+
strlen
(
p
);
if
(
p
!=
shape_opts
->
text
)
if
(
p
!=
text
)
y
+=
view_opts
->
line_space
;
if
(
p
!=
end
)
{
...
...
util/options.cc
浏览文件 @
bc4b07b0
...
...
@@ -31,6 +31,7 @@ view_options_t view_opts[1];
shape_options_t
shape_opts
[
1
];
font_options_t
font_opts
[
1
];
const
char
*
text
;
const
char
*
out_file
=
"/dev/stdout"
;
hb_bool_t
debug
=
FALSE
;
...
...
@@ -38,9 +39,10 @@ hb_bool_t debug = FALSE;
static
gboolean
parse_margin
(
const
char
*
name
G_GNUC_UNUSED
,
const
char
*
arg
,
gpointer
data
G_GNUC_UNUSED
,
gpointer
data
,
GError
**
error
G_GNUC_UNUSED
)
{
view_options_t
*
view_opts
=
(
view_options_t
*
)
data
;
view_options_t
::
margin_t
&
m
=
view_opts
->
margin
;
switch
(
sscanf
(
arg
,
"%lf %lf %lf %lf"
,
&
m
.
t
,
&
m
.
r
,
&
m
.
b
,
&
m
.
l
))
{
case
1
:
m
.
r
=
m
.
t
;
...
...
@@ -59,9 +61,10 @@ parse_margin (const char *name G_GNUC_UNUSED,
static
gboolean
parse_shapers
(
const
char
*
name
G_GNUC_UNUSED
,
const
char
*
arg
,
gpointer
data
G_GNUC_UNUSED
,
gpointer
data
,
GError
**
error
G_GNUC_UNUSED
)
{
shape_options_t
*
shape_opts
=
(
shape_options_t
*
)
data
;
shape_opts
->
shapers
=
g_strsplit
(
arg
,
","
,
0
);
return
TRUE
;
}
...
...
@@ -191,9 +194,10 @@ skip_one_feature (char **pp)
static
gboolean
parse_features
(
const
char
*
name
G_GNUC_UNUSED
,
const
char
*
arg
,
gpointer
data
G_GNUC_UNUSED
,
gpointer
data
,
GError
**
error
G_GNUC_UNUSED
)
{
shape_options_t
*
shape_opts
=
(
shape_options_t
*
)
data
;
char
*
s
=
(
char
*
)
arg
;
char
*
p
;
...
...
@@ -266,66 +270,66 @@ option_context_add_entries (GOptionContext *context,
GOptionEntry
*
entries
,
const
gchar
*
name
,
const
gchar
*
description
,
const
gchar
*
help_description
)
const
gchar
*
help_description
,
gpointer
user_data
)
{
if
(
0
)
{
GOptionGroup
*
group
=
g_option_group_new
(
name
,
description
,
help_description
,
NULL
,
NULL
);
g_option_group_add_entries
(
group
,
entries
);
g_option_context_add_group
(
context
,
group
);
}
else
{
g_option_context_add_main_entries
(
context
,
entries
,
NULL
);
}
GOptionGroup
*
group
=
g_option_group_new
(
name
,
description
,
help_description
,
user_data
,
NULL
);
g_option_group_add_entries
(
group
,
entries
);
g_option_context_add_group
(
context
,
group
);
}
void
option_context_add_view_opt
s
(
GOptionContext
*
context
)
view_options_t
::
add_option
s
(
GOptionContext
*
context
)
{
GOptionEntry
entries
[]
=
{
{
"annotate"
,
0
,
0
,
G_OPTION_ARG_NONE
,
&
view_opt
s
->
annotate
,
"Annotate output rendering"
,
NULL
},
{
"background"
,
0
,
0
,
G_OPTION_ARG_STRING
,
&
view_opts
->
back
,
"Set background color (default: "
DEFAULT_BACK
")"
,
"red/#rrggbb/#rrggbbaa"
},
{
"foreground"
,
0
,
0
,
G_OPTION_ARG_STRING
,
&
view_opts
->
fore
,
"Set foreground color (default: "
DEFAULT_FORE
")"
,
"red/#rrggbb/#rrggbbaa"
},
{
"line-space"
,
0
,
0
,
G_OPTION_ARG_DOUBLE
,
&
view_opt
s
->
line_space
,
"Set space between lines (default: 0)"
,
"units"
},
{
"annotate"
,
0
,
0
,
G_OPTION_ARG_NONE
,
&
thi
s
->
annotate
,
"Annotate output rendering"
,
NULL
},
{
"background"
,
0
,
0
,
G_OPTION_ARG_STRING
,
&
this
->
back
,
"Set background color (default: "
DEFAULT_BACK
")"
,
"red/#rrggbb/#rrggbbaa"
},
{
"foreground"
,
0
,
0
,
G_OPTION_ARG_STRING
,
&
this
->
fore
,
"Set foreground color (default: "
DEFAULT_FORE
")"
,
"red/#rrggbb/#rrggbbaa"
},
{
"line-space"
,
0
,
0
,
G_OPTION_ARG_DOUBLE
,
&
thi
s
->
line_space
,
"Set space between lines (default: 0)"
,
"units"
},
{
"margin"
,
0
,
0
,
G_OPTION_ARG_CALLBACK
,
(
gpointer
)
&
parse_margin
,
"Margin around output (default: "
G_STRINGIFY
(
DEFAULT_MARGIN
)
")"
,
"one to four numbers"
},
{
NULL
}
};
option_context_add_entries
(
context
,
entries
,
"view"
,
"View options:"
,
"Options controlling the output rendering"
);
"Options controlling the output rendering"
,
this
);
}
void
option_context_add_shape_opt
s
(
GOptionContext
*
context
)
shape_options_t
::
add_option
s
(
GOptionContext
*
context
)
{
GOptionEntry
entries
[]
=
{
{
"shapers"
,
0
,
0
,
G_OPTION_ARG_CALLBACK
,
(
gpointer
)
&
parse_shapers
,
"Comma-separated list of shapers"
,
"list"
},
{
"direction"
,
0
,
0
,
G_OPTION_ARG_STRING
,
&
shape_opt
s
->
direction
,
"Set text direction (default: auto)"
,
"ltr/rtl/ttb/btt"
},
{
"language"
,
0
,
0
,
G_OPTION_ARG_STRING
,
&
shape_opt
s
->
language
,
"Set text language (default: $LANG)"
,
"langstr"
},
{
"script"
,
0
,
0
,
G_OPTION_ARG_STRING
,
&
shape_opts
->
script
,
"Set text script (default: auto)"
,
"ISO-15924 tag"
},
{
"direction"
,
0
,
0
,
G_OPTION_ARG_STRING
,
&
thi
s
->
direction
,
"Set text direction (default: auto)"
,
"ltr/rtl/ttb/btt"
},
{
"language"
,
0
,
0
,
G_OPTION_ARG_STRING
,
&
thi
s
->
language
,
"Set text language (default: $LANG)"
,
"langstr"
},
{
"script"
,
0
,
0
,
G_OPTION_ARG_STRING
,
&
this
->
script
,
"Set text script (default: auto)"
,
"ISO-15924 tag"
},
{
"features"
,
0
,
0
,
G_OPTION_ARG_CALLBACK
,
(
gpointer
)
&
parse_features
,
"Font features to apply to text"
,
"TODO"
},
{
NULL
}
};
option_context_add_entries
(
context
,
entries
,
"shape"
,
"Shape options:"
,
"Options controlling the shaping process"
);
"Options controlling the shaping process"
,
this
);
}
void
option_context_add_font_opt
s
(
GOptionContext
*
context
)
font_options_t
::
add_option
s
(
GOptionContext
*
context
)
{
GOptionEntry
entries
[]
=
{
{
"face-index"
,
0
,
0
,
G_OPTION_ARG_INT
,
&
font_opt
s
->
face_index
,
"Face index (default: 0)"
,
"index"
},
{
"font-size"
,
0
,
0
,
G_OPTION_ARG_DOUBLE
,
&
font_opt
s
->
font_size
,
"Font size (default: "
G_STRINGIFY
(
DEFAULT_FONT_SIZE
)
")"
,
"size"
},
{
"face-index"
,
0
,
0
,
G_OPTION_ARG_INT
,
&
thi
s
->
face_index
,
"Face index (default: 0)"
,
"index"
},
{
"font-size"
,
0
,
0
,
G_OPTION_ARG_DOUBLE
,
&
thi
s
->
font_size
,
"Font size (default: "
G_STRINGIFY
(
DEFAULT_FONT_SIZE
)
")"
,
"size"
},
{
NULL
}
};
option_context_add_entries
(
context
,
entries
,
"font"
,
"Font options:"
,
"Options controlling the font"
);
"Options controlling the font"
,
NULL
);
}
void
...
...
@@ -345,9 +349,9 @@ parse_options (int argc, char *argv[])
context
=
g_option_context_new
(
"- FONT-FILE TEXT"
);
g_option_context_add_main_entries
(
context
,
entries
,
NULL
);
option_context_add_view_opt
s
(
context
);
option_context_add_shape_opt
s
(
context
);
option_context_add_font_opt
s
(
context
);
view_opts
->
add_option
s
(
context
);
shape_opts
->
add_option
s
(
context
);
font_opts
->
add_option
s
(
context
);
if
(
!
g_option_context_parse
(
context
,
&
argc
,
&
argv
,
&
parse_error
))
{
...
...
@@ -365,5 +369,5 @@ parse_options (int argc, char *argv[])
}
font_opts
->
font_file
=
argv
[
1
];
shape_opts
->
text
=
argv
[
2
];
text
=
argv
[
2
];
}
util/options.hh
浏览文件 @
bc4b07b0
...
...
@@ -43,6 +43,8 @@ extern struct view_options_t
margin
.
t
=
margin
.
r
=
margin
.
b
=
margin
.
l
=
DEFAULT_MARGIN
;
}
void
add_options
(
GOptionContext
*
context
);
hb_bool_t
annotate
;
const
char
*
fore
;
const
char
*
back
;
...
...
@@ -63,6 +65,8 @@ extern struct shape_options_t
g_free
(
shapers
);
}
void
add_options
(
GOptionContext
*
context
);
void
setup_buffer
(
hb_buffer_t
*
buffer
)
{
hb_buffer_set_direction
(
buffer
,
hb_direction_from_string
(
direction
,
-
1
));
hb_buffer_set_script
(
buffer
,
hb_script_from_string
(
script
,
-
1
));
...
...
@@ -74,7 +78,6 @@ extern struct shape_options_t
return
hb_shape_full
(
font
,
buffer
,
features
,
num_features
,
NULL
,
shapers
);
}
const
char
*
text
;
const
char
*
direction
;
const
char
*
language
;
const
char
*
script
;
...
...
@@ -93,20 +96,18 @@ extern struct font_options_t
font_size
=
DEFAULT_FONT_SIZE
;
}
void
add_options
(
GOptionContext
*
context
);
const
char
*
font_file
;
int
face_index
;
double
font_size
;
}
font_opts
[
1
];
extern
const
char
*
text
;
extern
const
char
*
out_file
;
extern
hb_bool_t
debug
;
void
option_context_add_view_opts
(
GOptionContext
*
context
);
void
option_context_add_shape_opts
(
GOptionContext
*
context
);
void
option_context_add_font_opts
(
GOptionContext
*
context
);
void
parse_options
(
int
argc
,
char
*
argv
[]);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录