Hello Maarten<br><br>I am working with MS Visual Studio 2008 on 64 bit windows with cairo and pango.<br><br>This is the following code.<br><i style="color: rgb(255, 0, 0);"><br>draw_text (cairo_t *cr)<br>{<br>#define RADIUS 150<br>
#define N_WORDS 10<br>#define FONT "Monotype Corsiva,27"<br> PangoLayout *layout;<br> PangoFontDescription *desc;<br> int i;<br> /* Center coordinates on the middle of the region we are drawing<br> */<br> /* Create a PangoLayout, set the font and text */<br>
layout = pango_cairo_create_layout (cr);<br> pango_layout_set_text (layout, "Text", -1);<br> desc = pango_font_description_from_string (FONT);<br> pango_layout_set_font_description (layout, desc);<br> pango_font_description_free (desc);<br>
/* Draw the layout N_WORDS times in a circle */<br> int width, height;<br> double red;<br> cairo_save (cr);<br> /* Gradient from red at angle == 60 to blue at angle == 240 */<br> cairo_set_source_rgb (cr, 1, 0, 0);<br>
/* Inform Pango to re-layout the text with the new transformation */<br> pango_cairo_update_layout (cr, layout);<br> pango_layout_get_size (layout, &width, &height);<br> cairo_move_to (cr, - ((double)width / PANGO_SCALE) / 2, - RADIUS);<br>
pango_cairo_show_layout (cr, layout);<br> cairo_restore (cr);<br> /* free the layout object */<br> g_object_unref (layout);<br>}<br>int main (int argc, char **argv)<br>{<br> cairo_t *cr;<br> char *filename;<br>
cairo_status_t status;<br> cairo_surface_t *surface;<br> filename = "montotype1.png";<br> surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32,<br> 2 * RADIUS, 2 * RADIUS);<br>
cr = cairo_create (surface);<br> cairo_set_source_rgb (cr, 1.0, 1.0, 1.0);<br> cairo_paint (cr);<br> draw_text (cr);<br> cairo_destroy (cr);<br> status = cairo_surface_write_to_png (surface, filename);<br> cairo_surface_destroy (surface);<br>
if (status != CAIRO_STATUS_SUCCESS)<br> {<br> g_printerr ("Could not save png to '%s'\n", filename);<br> return 1;<br> }<br> cin.get();<br> return 0;<br>}</i><br><br>Working with Times Roman, I used ",;" and it worked but when I try Monotype Corsiva, it throws the same warning as<br>
<br>PANGO Warning: Couldn't load font " Monotype Corsiva -not Rotated 27", falling back to "Sans Not -Rotated 27" , expect ugly output.<br><br>Thanks,<br>Deepak <br><br><br><br><br><div class="gmail_quote">
On Mon, Aug 29, 2011 at 2:47 PM, Maarten Bosmans <span dir="ltr"><<a href="mailto:mkbosmans@gmail.com">mkbosmans@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="im">2011/8/29 Deepak Kumar JAIN <<a href="mailto:deepak19dec@gmail.com">deepak19dec@gmail.com</a>>:<br>
</div><div class="im">> Thanks Maarten;<br>
><br>
> But still some of the fonst dont work and I get the same warning<br>
><br>
> fonts like Monotype Corsiva. What Should I do for those fonts?<br>
<br>
</div>So it was fixed for Times New Roman, but not for Monotype Corsiva?<br>
Weird. What did you do to make times work?<br>
Did you use pango_font_description_set_family?<br>
<br>
Please provide some more background info of the code that fails, error<br>
messages and info on the platform you are on.<br>
<font color="#888888"><br>
Maarten<br>
</font><div><div></div><div class="h5"><br>
> On Mon, Aug 29, 2011 at 11:11 AM, Maarten Bosmans <<a href="mailto:mkbosmans@gmail.com">mkbosmans@gmail.com</a>><br>
> wrote:<br>
>><br>
>><br>
>> <a href="http://blogs.operationaldynamics.com/andrew/software/java-gnome/use-comma-in-font-description" target="_blank">http://blogs.operationaldynamics.com/andrew/software/java-gnome/use-comma-in-font-description</a><br>
>><br>
>> 2011/8/29 Deepak Kumar JAIN <<a href="mailto:deepak19dec@gmail.com">deepak19dec@gmail.com</a>>:<br>
>> ><br>
>> > Hello All,<br>
>> ><br>
>> > I am new to Cairo Graphics. I heard about cairoGraphics from a developer<br>
>> > at<br>
>> > SHARP labs.<br>
>> ><br>
>> > I am developing a text manipulation plugin which do several things like<br>
>> > underline, strikeout text, etc.<br>
>> ><br>
>> > But I want to write the text in different fints like Times new Roman,<br>
>> > Arial<br>
>> > , Courier, etc depending on what user prefers. These fonts will be input<br>
>> > by<br>
>> > the user and then on the basis of input by user, I have to write a text<br>
>> > on<br>
>> > the image. But I am not able to write the text with Times New Roman.<br>
>> > I am using pango_font_description_from_string(FONT) where FONT is<br>
>> > defined as<br>
>> > #define FONT "Arial 27". It works for Arial but when I try to use Times<br>
>> > New<br>
>> > Roman, it says<br>
>> > " Pango Warning" couldn't load font Times ", falling back to "Sans not<br>
>> > Rotaed 27" , expect ugly output.<br>
>> ><br>
>> > Please help me in this regard by suggesting how should I proceed?<br>
>> ><br>
>> > Thanks,<br>
>> ><br>
>> > Deepak JAIN<br>
>> ><br>
>> > --<br>
>> ><br>
>> > Thanks & Regards,<br>
>> > Deepak Kumar JAIN<br>
>> > Internship student,<br>
>> > Orange Labs,France Telecom,<br>
>> > Rennes, France<br>
>> > Contact: <a href="tel:%2B33%280%296%2031%2015%2044%2066" value="+33631154466">+33(0)6 31 15 44 66</a><br>
>> > <a href="http://www.deepakkumarjain.co.cc" target="_blank">www.deepakkumarjain.co.cc</a><br>
>> ><br>
>> > "I err therefore I am "- Saint Augustine<br>
>> ><br>
>> ><br>
>> ><br>
>> ><br>
>> > --<br>
>> ><br>
>> > Thanks & Regards,<br>
>> > Deepak Kumar JAIN<br>
>> > Internship student,<br>
>> > Orange Labs,France Telecom,<br>
>> > Rennes, France<br>
>> > Contact: <a href="tel:%2B33%280%296%2031%2015%2044%2066" value="+33631154466">+33(0)6 31 15 44 66</a><br>
>> > <a href="http://www.deepakkumarjain.co.cc" target="_blank">www.deepakkumarjain.co.cc</a><br>
>> ><br>
>> > "I err therefore I am "- Saint Augustine<br>
>> ><br>
>> ><br>
>> > --<br>
>> > cairo mailing list<br>
>> > <a href="mailto:cairo@cairographics.org">cairo@cairographics.org</a><br>
>> > <a href="http://lists.cairographics.org/mailman/listinfo/cairo" target="_blank">http://lists.cairographics.org/mailman/listinfo/cairo</a><br>
>> ><br>
><br>
><br>
><br>
> --<br>
><br>
> Thanks & Regards,<br>
> Deepak Kumar JAIN<br>
> Internship student,<br>
> Orange Labs,France Telecom,<br>
> Rennes, France<br>
> Contact: <a href="tel:%2B33%280%296%2031%2015%2044%2066" value="+33631154466">+33(0)6 31 15 44 66</a><br>
> <a href="http://www.deepakkumarjain.co.cc" target="_blank">www.deepakkumarjain.co.cc</a><br>
><br>
> "I err therefore I am "- Saint Augustine<br>
><br>
><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>
<div><br>Thanks & Regards,<br>Deepak Kumar JAIN<br>Internship student, <br>Orange Labs,France Telecom,<br>Rennes, France<br>Contact: +33(0)6 31 15 44 66<br><a href="http://www.deepakkumarjain.co.cc" target="_blank">www.deepakkumarjain.co.cc</a><br>
</div>
<div><br><font face="Verdana, Arial, Helvetica, sans-serif" color="#000099">"<i style="color:rgb(0, 0, 0)">I err therefore I am </i>"- Saint Augustine</font><br> </div>
<div></div>
<div></div>
<div></div><div style="padding:0px;margin-left:0px;margin-top:0px;overflow:hidden;word-wrap:break-word;color:black;font-size:10px;text-align:left;line-height:130%"></div><div style="padding:0px;margin-left:0px;margin-top:0px;overflow:hidden;word-wrap:break-word;color:black;font-size:10px;text-align:left;line-height:130%">
</div><div style="padding:0px;margin-left:0px;margin-top:0px;overflow:hidden;word-wrap:break-word;color:black;font-size:10px;text-align:left;line-height:130%"></div><div style="padding:0px;margin-left:0px;margin-top:0px;overflow:hidden;word-wrap:break-word;color:black;font-size:10px;text-align:left;line-height:130%">
</div><div style="padding:0px;margin-left:0px;margin-top:0px;overflow:hidden;word-wrap:break-word;color:black;font-size:10px;text-align:left;line-height:130%"></div><br>