Re: Using Pango and TrueType Fonts
Behdad Esfahbod <[email protected]>
| Newsgroups | gmane.comp.lib.cairo |
|---|---|
| Message-ID | <[email protected]> |
On 15-02-20 09:25 AM, Michael Gerbracht wrote: > Hello, > > I would like to use Pango with Cairo to display data in graphs. As data > points I would like to use characters since there are a lot of symbols fonts > available which allow great flexibility. However I have three problem to > implement it correctly and I hope you can help me. (I could not find a > dedicated pango mailing list so if you thing there is a better list for this > question please tell me so). > > I am using a pangocairo library for lua running on windows to generate the > graphics - this works in general. However, I still have theese problems: > > First I noiced that I can display OpenType fonts but TrueType fonts are not > displayed (just a crossed out rectangle is shown instead). I am using the > pango_font_description_from_string method to set the font. Do I have to > convert TrueType fonts first? What do you mean by TrueType fonts/ Give us an example. > Secondly I noticed that it is difficult to center the characters. As they > should represent a data point I would like to center the symbol at this > specific point. Currently I create a layout, set text and font description > and then use the get_size methode to read out the size. While this is not > completely wrong I often notice that it is not perfectly centered. Is there a > better way to get the dimension of a single character? An example would help. Try get_extents(), which returns two different boxes, try both, see which one suits your need better. > Finally I would like to be able to rotate the symbol. I can do this by > rotating the surface, drawing the character, and rotate back. But is this the > best way to do it or would you prefer another solution? cairo_rotate before calling into Pango should work. > Sorry, I am quite new to Cairo und Pango but could not find the answers by > searching the web. > > thanks a lot, > Michael > -- behdad http://behdad.org/ -- cairo mailing list [email protected] http://lists.cairographics.org/mailman/listinfo/cairo