thanks for the replies, moving the cursor is very handy :)<br><br>anyway my problem was caused by fontconfig not being configured for the target platform <br>(i'm cross compiling for a set top box and fontconfig was pointing to the font-cache on my development pc)<br>
fixing this and adding the adjustments with size and position solved everything<br><br><div class="gmail_quote">On Wed, Mar 19, 2008 at 11:51 PM, Carl Worth <<a href="mailto:cworth@cworth.org">cworth@cworth.org</a>> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div class="Ih2E3d">On Wed, 19 Mar 2008 14:09:02 +0100, "Mehmet Kovacioglu" wrote:<br>
> thanks for the quick reply,<br>
> here's the code:<br>
<br>
</div>Hi Mehmet,<br>
<br>
Thanks for the code sample. This makes it much easier to spot the<br>
problem.<br>
<div class="Ih2E3d"><br>
> cairo_stroke(cr);<br>
><br>
> ------------------<br>
> up till here everything works fine<br>
> ------------------<br>
><br>
> cairo_set_source_rgb (cr, 1.0, 0.0, 0.0);<br>
> cairo_select_font_face (cr, "sansserif",<br>
> CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD);<br>
> cairo_set_font_size (cr, 22);<br>
> cairo_text_extents (cr, "ABC", &te);<br>
> cairo_show_text (cr, "ABC");<br>
><br>
> --------------------<br>
> the part above isnt shown in the resulting png file<br>
> --------------------<br>
<br>
</div>So the problem here is that you're never providing a position for<br>
where you'd like the cairo_show_text text to be placed.<br>
<br>
It's arguably an API error on our part that we didn't make you pass an<br>
(x,y) coordinate to that function---in which case it would have been<br>
obvious to you how to position the text.<br>
<br>
Instead, we took a cue from the PostScript specification and used the<br>
current path point as the position for cairo_show_text[*]. Since the<br>
last path-based operation you did was cairo_stroke and since it<br>
destroys the current path, then cairo assumes a current point of (0,0)<br>
for your text origin. And since the origin is to the lower-left of the<br>
glyphs for your font, none of your text is appearing on your image.<br>
<br>
If you had examined the contents of the te structure then you perhaps<br>
would have noticed that they describe a rectangle with negative Y<br>
coordinates.<br>
<br>
To fix this, insert something like the following just before the<br>
cairo_show_text call:<br>
<br>
cairo_move_to (cr, 25, 25);<br>
<br>
and you should be all set. I do hope you have fun with cairo!<br>
<br>
-Carl<br>
<br>
[*] The advantage that it does have is that subsequent calls to<br>
cairo_show_text do continue the natural left-to-right layout that<br>
cairo_show_text uses:<br>
<br>
cairo_move_to (cr, x, y);<br>
cairo_show_text (cr, "One ");<br>
cairo_show_text (cr, "word ");<br>
cairo_show_text (cr, "at ");<br>
cairo_show_text (cr, "a ");<br>
cairo_show_text (cr, "time.");<br>
<br>
But that's still obviously extremely limited text layout. For anything<br>
more sophisticated in terms of layout, we highly recommend using pango<br>
and it's cairo integration instead, (it will do line-breaking,<br>
right-to-left layout, properly support Arabic, etc. etc.).<br>
</blockquote></div><br>