summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorBehdad Esfahbod <behdad@gnome.org>2006-08-15 20:46:10 +0000
committerBehdad Esfahbod <behdad@src.gnome.org>2006-08-15 20:46:10 +0000
commit4adf7dea1e8ecedb3bf9325be46c19c0167e0009 (patch)
tree1024154a4f997dbcf23f59a50199c79b2fe63643 /examples
parent5ad6cd2803ba45fbdffe5226ace285ca4a696a60 (diff)
downloadpango-4adf7dea1e8ecedb3bf9325be46c19c0167e0009.tar.gz
Remove excess LRM.
2006-08-15 Behdad Esfahbod <behdad@gnome.org> * examples/HELLO.utf8: Remove excess LRM. * examples/viewer-pangocairo.c (render_callback): Draw baselines in border-drawing mode. * pango/pango-layout.c (pango_layout_line_get_extents): Make sure we set logical_rect.y on empty lines. Previously empty lines had wrong baseline. The code apparently was written like that intentionally, but I cannot find out why.
Diffstat (limited to 'examples')
-rw-r--r--examples/HELLO.utf83
-rw-r--r--examples/viewer-pangocairo.c27
2 files changed, 24 insertions, 6 deletions
diff --git a/examples/HELLO.utf8 b/examples/HELLO.utf8
index f7bb4974..5941461e 100644
--- a/examples/HELLO.utf8
+++ b/examples/HELLO.utf8
@@ -46,9 +46,8 @@ Chinese (中文,普通话,汉语) 你好
Cantonese (粵語,廣東話) 早晨, 你好
Korean (한글) 안녕하세요, 안녕하십니까
-Difference among chinese characters in GB, JIS, KSC, BIG5:‎
+Difference among chinese characters in GB, JIS, KSC, BIG5:
GB -- 元气 开发
JIS -- 元気 開発
KSC -- 元氣 開發
BIG5 -- 元氣 開發
-
diff --git a/examples/viewer-pangocairo.c b/examples/viewer-pangocairo.c
index 5638ffc9..53ee38ce 100644
--- a/examples/viewer-pangocairo.c
+++ b/examples/viewer-pangocairo.c
@@ -149,11 +149,11 @@ render_callback (PangoLayout *layout,
{
PangoRectangle ink, logical;
double lw = cairo_get_line_width (cr);
+ PangoLayoutIter* iter;
pango_layout_get_extents (layout, &ink, &logical);
- cairo_set_source_rgba (cr, 1.0, 0.0, 0.0, 0.75);
-
+ cairo_set_source_rgba (cr, 1.0, 0.0, 0.0, 0.5);
cairo_rectangle (cr,
(double)logical.x / PANGO_SCALE - lw / 2,
(double)logical.y / PANGO_SCALE - lw / 2,
@@ -161,14 +161,33 @@ render_callback (PangoLayout *layout,
(double)logical.height / PANGO_SCALE + lw);
cairo_stroke (cr);
- cairo_set_source_rgba (cr, 0.0, 1.0, 0.0, 0.75);
-
+ cairo_save (cr);
+ cairo_set_line_width (cr, lw / 2);
+ cairo_set_source_rgba (cr, 0.0, 0.0, 1.0, 0.5);
+ iter = pango_layout_get_iter (layout);
+ do
+ {
+ y = pango_layout_iter_get_baseline (iter);
+ cairo_move_to (cr,
+ (double)logical.x / PANGO_SCALE,
+ (double)y / PANGO_SCALE + lw / 4);
+ cairo_rel_line_to (cr,
+ (double)logical.width / PANGO_SCALE,
+ 0);
+ cairo_stroke (cr);
+ }
+ while (pango_layout_iter_next_line (iter));
+ pango_layout_iter_free (iter);
+ cairo_restore (cr);
+
+ cairo_set_source_rgba (cr, 0.0, 1.0, 0.0, 0.5);
cairo_rectangle (cr,
(double)ink.x / PANGO_SCALE - lw / 2,
(double)ink.y / PANGO_SCALE - lw / 2,
(double)ink.width / PANGO_SCALE + lw,
(double)ink.height / PANGO_SCALE + lw);
cairo_stroke (cr);
+
}
cairo_restore (cr);
}