[cairo] scale with text
dev at ceglarek.eu
Wed Feb 28 09:16:10 PST 2007
On Fri, 2007-02-23 at 20:53 +0000, Damon Chaplin wrote:
> On Fri, 2007-02-23 at 19:14 +0100, Tobias Ceglarek wrote:
> > > > 1. Turn off the hinting
> > > >
> > > > You can do this with cairo_font_options_set_hint_style and
> > > > cairo_font_options_set_hint_metrics. See the example I attached
> > > > below for details. (And note that I also explicitly set
> > > > ANTIALIAS_GRAY since you really don't want ANTIALIAS_SUBPIXEL
> > > > without hinting).
> > > >
> > > > This is the right answer if you want to be able to scale without
> > > > any change in shape, (for example, if you're animating a zoom with
> > > > text, the changes in shape and position can be very
> > > > undesirable). But, without hinting, text can also be much less
> > > > legible, so it's not necessarily always the right thing.
> > >
> > > For me this is the best/quickest solution. Thank you very very much for
> > > your help!!!
> > :-(
> > I have detect a difficulty. Yet I have testet my scenario with pygtk: a
> > drawingarea in a window.
> > Now I have inserted the drawingarea in a viewport, the viewport in a
> > scrolledwindow, the scrolledwindow in a vbox an the vbox in the window.
> > suddenly the settings
> > ...
> > set_hint_style (cairo.HINT_STYLE_NONE)
> > set_hint_metrics (cairo.HINT_METRICS_OFF)
> > fopt.set_antialias (cairo.ANTIALIAS_GRAY)
> > ...
> > seem to be overwritten. My problem is present again.
> Are you using Pango? If you are, you need to set the font options on the
> pango context rather than the cairo context (this one took me ages to
> figure out):
> font_options = cairo_font_options_create ();
> cairo_font_options_set_hint_metrics (font_options,
> cairo_font_options_set_hint_style (font_options,
> context = pango_layout_get_context (layout);
> pango_cairo_context_set_font_options (context, font_options);
> cairo_font_options_destroy (font_options);
I have figured out it now. You are right. I have done it too
Now I use a textbuffer with a textview. Pygtk then uses cairo
Now I am working on a printing tool with the ability to print exactly
what I see in the textview.
I have not discovered the optimal way to do this .. but I am on the way.
Can I change the surface of
textview.get_window(gtk.TEXT_WINDOW_TEXT).cairo_create() (this is the
context of the textbuffer)?
Or have I create a new context?
More information about the cairo