Re: PangoFont -> GnomeFont

Jean Bréfort <[email protected]>
Newsgroups gmane.comp.gnome.print
Message-ID <1075204595.379.10.camel@Newton>
Le mar 27/01/2004 à 12:25, Jatin Nansi a écrit :
> Hi all
> 
> I am trying to print some devanagari text.
> How do I pass the font that pango uses for display to libgnomeprint?
> Currently i do a strncmp on the font family names and try doing this on
> a best guess basis.
> i.e. is there an easy way to convert from a PangoFont instance to a
> GnomeFont instance?

Hi,

Here is the code I use in GChemPaint (libgcpcanvas/gnome-print-pango.c)
where pango_font is a PangoFont*:

GnomeFont *font;
PangoFontDescription *desc;
desc = pango_font_describe (pango_font);
face = gnome_font_face_find_closest_from_weight_slant (
	pango_font_description_get_family (desc),
	(GnomeFontWeight) pango_font_description_get_weight (desc),
	(pango_font_description_get_style (desc) != 			PANGO_STYLE_NORMAL));
font =	gnome_font_face_get_font (face,
	  pango_font_description_get_size(desc) / PANGO_SCALE, 72, 72);

The whole file can be accessed at:
http://savannah.nongnu.org/cgi-bin/viewcvs/gchempaint/gchempaint/libgcpcanvas/gnome-print-pango.c

Best regards,

Jean Brefort
signature.asc (application/pgp-signature, 189 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (GNU/Linux)

iD8DBQBAFlHzUkVLHK5zOkcRAoODAKDk1Bj3BywVGx3e6VpVMQL3DPcwbQCfcA8M
K7NevKszKSN+QUvfF/5ffP0=
=7TZx
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.