Re: [cairo] Pango font thickness



Hi,

Although I've never played with cairomm/pangomm, but
your report sounds interesting. I think the handling
of weight info in Pango is backend specific; please
find pangoatsui-fontmap.c, pangofc-fontmap.c, pangowin32-fontmap.c,
and pangox-fontmap.c have their own details. So, which
platform you're working with? If you test your progam
on different platform, the tendency selecting too heavy
font is same?

Regards,
mpsuzuki


On Sat, 6 Feb 2010 14:20:38 +0100
Edder <edder tkwsping nl> wrote:

>Hi all,
>
>I am trying to make a simple plotting library using cairomm and
>pangomm. Currently I have problems with the fonts though. Using
>pangomm I always get very thick fonts, while I want thin fonts. I
>tried playing around with font weight etc, but this only has minimal
>effect. I also played around with different fonts, but they all have
>the same problem. Anyone any tips?
>
>Cheers, Edwin
>
>Example code:
>#include <string>
>#include <cairomm/context.h>
>#include <cairomm/surface.h>
>
>#include <pangomm/init.h>
>#include <pangomm/context.h>
>#include <pangomm/layout.h>
>
>int main()
>{
>	Cairo::RefPtr<Cairo::ImageSurface> surface =
>		Cairo::ImageSurface::create(Cairo::FORMAT_ARGB32, 600, 400);
>
>	Cairo::RefPtr<Cairo::Context> cr = Cairo::Context::create(surface);
>	cr->set_source_rgb(0.86, 0.85, 0.47);
>	cr->paint();    // fill image with the color
>
>	Pango::init();
>	Glib::RefPtr<Pango::Layout> pangoLayout = Pango::Layout::create (cr);
>	Pango::FontDescription pango_font = Pango::FontDescription("verdana 10");
>	pango_font.set_weight( Pango::WEIGHT_ULTRALIGHT );
>	pangoLayout->set_font_description( pango_font );
>
>	cr->move_to(300,200);
>	cr->set_source_rgb(0, 0, 0);
>	pangoLayout->set_text("text");
>	//pangoLayout->update_from_cairo_context(cr);  //gets cairo cursor position
>	pangoLayout->add_to_cairo_context(cr);       //adds text to cairos
>stack of stuff to be drawn
>	cr->stroke();
>
>	std::string filename = "image.png";
>	surface->write_to_png(filename);
>}
>_______________________________________________
>gtk-i18n-list mailing list
>gtk-i18n-list gnome org
>http://mail.gnome.org/mailman/listinfo/gtk-i18n-list


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]