Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Harfbuzz
提交
4f6f7c3b
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看板
未验证
提交
4f6f7c3b
编写于
2月 23, 2018
作者:
E
Ebrahim Byagowi
提交者:
GitHub
2月 23, 2018
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[util] Implement ppem/ptem on hb-{shape,view} (#811)
上级
a6bd6bce
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
34 addition
and
5 deletion
+34
-5
util/options.cc
util/options.cc
+28
-5
util/options.hh
util/options.hh
+6
-0
未找到文件。
util/options.cc
浏览文件 @
4f6f7c3b
...
@@ -481,6 +481,25 @@ parse_font_size (const char *name G_GNUC_UNUSED,
...
@@ -481,6 +481,25 @@ parse_font_size (const char *name G_GNUC_UNUSED,
return
false
;
return
false
;
}
}
}
}
static
gboolean
parse_font_ppem
(
const
char
*
name
G_GNUC_UNUSED
,
const
char
*
arg
,
gpointer
data
,
GError
**
error
G_GNUC_UNUSED
)
{
font_options_t
*
font_opts
=
(
font_options_t
*
)
data
;
switch
(
sscanf
(
arg
,
"%d%*[ ,]%d"
,
&
font_opts
->
x_ppem
,
&
font_opts
->
y_ppem
))
{
case
1
:
font_opts
->
y_ppem
=
font_opts
->
x_ppem
;
case
2
:
return
true
;
default:
g_set_error
(
error
,
G_OPTION_ERROR
,
G_OPTION_ERROR_BAD_VALUE
,
"%s argument should be one or two space-separated numbers"
,
name
);
return
false
;
}
}
void
void
font_options_t
::
add_options
(
option_parser_t
*
parser
)
font_options_t
::
add_options
(
option_parser_t
*
parser
)
{
{
...
@@ -513,12 +532,13 @@ font_options_t::add_options (option_parser_t *parser)
...
@@ -513,12 +532,13 @@ font_options_t::add_options (option_parser_t *parser)
GOptionEntry
entries
[]
=
GOptionEntry
entries
[]
=
{
{
{
"font-file"
,
0
,
0
,
G_OPTION_ARG_STRING
,
&
this
->
font_file
,
"Set font file-name"
,
"filename"
},
{
"font-file"
,
0
,
0
,
G_OPTION_ARG_STRING
,
&
this
->
font_file
,
"Set font file-name"
,
"filename"
},
{
"face-index"
,
0
,
0
,
G_OPTION_ARG_INT
,
&
this
->
face_index
,
"Set face index (default: 0)"
,
"index"
},
{
"face-index"
,
0
,
0
,
G_OPTION_ARG_INT
,
&
this
->
face_index
,
"Set face index (default: 0)"
,
"index"
},
{
"font-size"
,
0
,
default_font_size
?
0
:
G_OPTION_FLAG_HIDDEN
,
{
"font-size"
,
0
,
default_font_size
?
0
:
G_OPTION_FLAG_HIDDEN
,
G_OPTION_ARG_CALLBACK
,
(
gpointer
)
&
parse_font_size
,
font_size_text
,
"1/2 numbers or 'upem'"
},
G_OPTION_ARG_CALLBACK
,
(
gpointer
)
&
parse_font_size
,
font_size_text
,
"1/2 integers or 'upem'"
},
/* TODO Add font-ppem / font-ptem. */
{
"font-ppem"
,
0
,
0
,
G_OPTION_ARG_CALLBACK
,
(
gpointer
)
&
parse_font_ppem
,
"Set x,y pixels per EM (default: 0; disabled)"
,
"1/2 integers"
},
{
"font-funcs"
,
0
,
0
,
G_OPTION_ARG_STRING
,
&
this
->
font_funcs
,
text
,
"impl"
},
{
"font-ptem"
,
0
,
0
,
G_OPTION_ARG_DOUBLE
,
&
this
->
ptem
,
"Set font point-size (default: 0; disabled)"
,
"point-size"
},
{
"font-funcs"
,
0
,
0
,
G_OPTION_ARG_STRING
,
&
this
->
font_funcs
,
text
,
"impl"
},
{
nullptr
}
{
nullptr
}
};
};
parser
->
add_group
(
entries
,
parser
->
add_group
(
entries
,
...
@@ -691,6 +711,9 @@ font_options_t::get_font (void) const
...
@@ -691,6 +711,9 @@ font_options_t::get_font (void) const
if
(
font_size_y
==
FONT_SIZE_UPEM
)
if
(
font_size_y
==
FONT_SIZE_UPEM
)
font_size_y
=
hb_face_get_upem
(
face
);
font_size_y
=
hb_face_get_upem
(
face
);
hb_font_set_ppem
(
font
,
x_ppem
,
y_ppem
);
hb_font_set_ptem
(
font
,
ptem
);
int
scale_x
=
(
int
)
scalbnf
(
font_size_x
,
subpixel_bits
);
int
scale_x
=
(
int
)
scalbnf
(
font_size_x
,
subpixel_bits
);
int
scale_y
=
(
int
)
scalbnf
(
font_size_y
,
subpixel_bits
);
int
scale_y
=
(
int
)
scalbnf
(
font_size_y
,
subpixel_bits
);
hb_font_set_scale
(
font
,
scale_x
,
scale_y
);
hb_font_set_scale
(
font
,
scale_x
,
scale_y
);
...
...
util/options.hh
浏览文件 @
4f6f7c3b
...
@@ -452,6 +452,9 @@ struct font_options_t : option_group_t
...
@@ -452,6 +452,9 @@ struct font_options_t : option_group_t
variations
=
nullptr
;
variations
=
nullptr
;
num_variations
=
0
;
num_variations
=
0
;
default_font_size
=
default_font_size_
;
default_font_size
=
default_font_size_
;
x_ppem
=
0
;
y_ppem
=
0
;
ptem
=
.0
;
subpixel_bits
=
subpixel_bits_
;
subpixel_bits
=
subpixel_bits_
;
font_file
=
nullptr
;
font_file
=
nullptr
;
face_index
=
0
;
face_index
=
0
;
...
@@ -478,6 +481,9 @@ struct font_options_t : option_group_t
...
@@ -478,6 +481,9 @@ struct font_options_t : option_group_t
hb_variation_t
*
variations
;
hb_variation_t
*
variations
;
unsigned
int
num_variations
;
unsigned
int
num_variations
;
int
default_font_size
;
int
default_font_size
;
int
x_ppem
;
int
y_ppem
;
double
ptem
;
unsigned
int
subpixel_bits
;
unsigned
int
subpixel_bits
;
mutable
double
font_size_x
;
mutable
double
font_size_x
;
mutable
double
font_size_y
;
mutable
double
font_size_y
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录