Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Harfbuzz
提交
da4a2a14
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看板
提交
da4a2a14
编写于
9月 16, 2011
作者:
B
Behdad Esfahbod
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Cosmetic
上级
4274ed7a
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
23 addition
and
8 deletion
+23
-8
util/view-cairo.cc
util/view-cairo.cc
+23
-8
未找到文件。
util/view-cairo.cc
浏览文件 @
da4a2a14
...
...
@@ -187,7 +187,9 @@ view_cairo_t::get_surface_size (cairo_scaled_font_t *scaled_font,
cairo_scaled_font_extents
(
scaled_font
,
&
font_extents
);
*
h
=
font_extents
.
ascent
+
font_extents
.
descent
+
((
int
)
lines
->
len
-
1
)
*
font_extents
.
height
;
*
h
=
font_extents
.
ascent
+
font_extents
.
descent
+
((
int
)
lines
->
len
-
1
)
*
font_extents
.
height
;
*
w
=
0
;
for
(
unsigned
int
i
=
0
;
i
<
lines
->
len
;
i
++
)
*
w
=
MAX
(
*
w
,
line_width
(
i
));
...
...
@@ -205,25 +207,34 @@ view_cairo_t::create_scaled_font (const font_options_t *font_opts)
FT_Face
ft_face
=
hb_ft_font_get_face
(
font
);
if
(
!
ft_face
)
/* This allows us to get some boxes at least... */
cairo_face
=
cairo_toy_font_face_create
(
"sans"
,
CAIRO_FONT_SLANT_NORMAL
,
CAIRO_FONT_WEIGHT_NORMAL
);
cairo_face
=
cairo_toy_font_face_create
(
"sans"
,
CAIRO_FONT_SLANT_NORMAL
,
CAIRO_FONT_WEIGHT_NORMAL
);
else
cairo_face
=
cairo_ft_font_face_create_for_ft_face
(
ft_face
,
0
);
cairo_matrix_t
ctm
,
font_matrix
;
cairo_font_options_t
*
font_options
;
cairo_matrix_init_identity
(
&
ctm
);
cairo_matrix_init_scale
(
&
font_matrix
,
font_opts
->
font_size
,
font_opts
->
font_size
);
cairo_matrix_init_scale
(
&
font_matrix
,
font_opts
->
font_size
,
font_opts
->
font_size
);
font_options
=
cairo_font_options_create
();
cairo_font_options_set_hint_style
(
font_options
,
CAIRO_HINT_STYLE_NONE
);
cairo_font_options_set_hint_metrics
(
font_options
,
CAIRO_HINT_METRICS_OFF
);
cairo_scaled_font_t
*
scaled_font
=
cairo_scaled_font_create
(
cairo_face
,
&
font_matrix
,
&
ctm
,
font_options
);
cairo_scaled_font_t
*
scaled_font
=
cairo_scaled_font_create
(
cairo_face
,
&
font_matrix
,
&
ctm
,
font_options
);
cairo_font_options_destroy
(
font_options
);
cairo_font_face_destroy
(
cairo_face
);
static
cairo_user_data_key_t
key
;
if
(
cairo_scaled_font_set_user_data
(
scaled_font
,
&
key
,
(
void
*
)
font
,
(
cairo_destroy_func_t
)
hb_font_destroy
))
if
(
cairo_scaled_font_set_user_data
(
scaled_font
,
&
key
,
(
void
*
)
font
,
(
cairo_destroy_func_t
)
hb_font_destroy
))
hb_font_destroy
(
font
);
return
scaled_font
;
...
...
@@ -285,7 +296,10 @@ _cairo_png_surface_create_for_stream (cairo_write_func_t write_func,
png_closure
->
write_func
=
write_func
;
png_closure
->
closure
=
closure
;
if
(
cairo_surface_set_user_data
(
surface
,
&
finalize_closure_key
,
(
void
*
)
png_closure
,
(
cairo_destroy_func_t
)
g_free
))
if
(
cairo_surface_set_user_data
(
surface
,
&
finalize_closure_key
,
(
void
*
)
png_closure
,
(
cairo_destroy_func_t
)
g_free
))
g_free
((
void
*
)
closure
);
return
surface
;
...
...
@@ -407,7 +421,8 @@ view_cairo_t::create_context (double w, double h)
cairo_set_operator
(
cr
,
CAIRO_OPERATOR_SOURCE
);
cairo_set_source_rgba
(
cr
,
1.
,
1.
,
1.
,
br
/
255.
);
cairo_paint
(
cr
);
cairo_set_source_rgba
(
cr
,
1.
,
1.
,
1.
,
(
fr
/
255.
)
*
(
fa
/
255.
)
+
(
br
/
255
)
*
(
1
-
(
fa
/
255.
)));
cairo_set_source_rgba
(
cr
,
1.
,
1.
,
1.
,
(
fr
/
255.
)
*
(
fa
/
255.
)
+
(
br
/
255
)
*
(
1
-
(
fa
/
255.
)));
break
;
default:
case
CAIRO_CONTENT_COLOR
:
...
...
@@ -458,7 +473,7 @@ view_cairo_t::draw (cairo_t *cr)
}
if
(
cairo_surface_get_type
(
cairo_get_target
(
cr
))
==
CAIRO_SURFACE_TYPE_IMAGE
)
{
/* cairo_show_glyphs() doesn't support subpixel positio
i
ning */
/* cairo_show_glyphs() doesn't support subpixel positioning */
cairo_glyph_path
(
cr
,
l
.
glyphs
,
l
.
num_glyphs
);
cairo_fill
(
cr
);
}
else
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录