Re: [pygtk] scaling fonts
> "James" == James Henstridge <[EMAIL PROTECTED]> writes: James> Are you using the core X font backend or the Xft backend? James> What sort of font sizes are causing problems? (an James> approximate figure would be useful). I have been using the XFT backend. On your suggestion, I tried to reproduce the problem in a simplified and was not successful. I now believe the problem was in a related part of my library that was affected by the font scaling, but not in the scaling itself. In any case, all is well. Thanks, John Hunter ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
Re: [pygtk] scaling fonts
On Mon, Sep 15, 2003 at 05:08:52PM -0500, John Hunter wrote: > When I increase the DPI for hardcopy (rendering to a pixmap and then > saving as PNG) I want the fonts to scale with the rest of the lines, > rectangles, arcs, etc > > I tried experimenting with the set_size parameter of the > FontDescription and the various pango scales, but there is not a wide > enough range of scales to go from screen displays to, say, hardcopy > resolutions of 600 dpi. [...] > Any ideas on how to scale fonts? Is this possible with pango? I think asking on the pango mailing list ([EMAIL PROTECTED]) is probably your best bet for this problem. I asked James about this today and we both agreed that the problem seems to be *rendering* the fonts, rather than scaling them. James also pointed out that the XFT backend will be better at rendering large fonts, since scaled bitmap fonts needed to be completely loaded into memory before being rendered. To turn on XFT fonts in GTK+ 2.0, use export GDK_USE_XFT=1 -- it's on by default for 2.2 onwards. > Alternatively, is there any true type font support that can be used > with pygtk? Yes. Both the core font engine and XFT handle TTF fonts correctly (though you need the freetype module loaded for the former, AFAIK). However, what you probably want is to *render* fonts using the XFT backend, which is the hint James provided above. Take care, -- Christian Reis | http://async.com.br/~kiko/ | [+55 16] 261 2331 ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
Re: [pygtk] scaling fonts
On 16/09/03 06:08, John Hunter wrote: I am trying to scale my pango fonts with a DPI parameter for my plotting library. I have two parameters, figsize (tuple in inches) and DPI (int) and my figure size is a tuple in pixels given by the product of these, ie, (figsize[0]*dpi, figsize[1]*dpi) When I increase the DPI for hardcopy (rendering to a pixmap and then saving as PNG) I want the fonts to scale with the rest of the lines, rectangles, arcs, etc I tried experimenting with the set_size parameter of the FontDescription and the various pango scales, but there is not a wide enough range of scales to go from screen displays to, say, hardcopy resolutions of 600 dpi. I create the font description as # fontsize in points font = pango.FontDescription('%s %d' % (fontname, fontsize)) and would like to be able to scale the fontsize by an arbitrary scale, something like scale = outputDPI/screenDPI font.set_size(int(scale*fontsize*pango.SCALE)) But this will cause X crashes for large values of scale. If I use the pango SCALE constants for scale aboce, as in font.set_size(int(pango.SCALE_XX_LARGE*fontsize*pango.SCALE)) I don't get the crashes but I can't get my fonts large enough -- SCALE_XX_LARGE is only 1.2. Any ideas on how to scale fonts? Is this possible with pango? Alternatively, is there any true type font support that can be used with pygtk? Thanks for any help, John Hunter X crash with an arbitrary, large, scale factor: The program 'histogram_demo.py' received an X Window System error. This probably reflects a bug in the program. The error was 'BadMatch (invalid parameter attributes)'. (Details: serial 381 error_code 8 request_code 73 minor_code 0) (Note to programmers: normally, X errors are reported asynchronously; that is, you will receive the error a while after causing it. To debug your program, run it with the --sync command line option to change this behavior. You can then get a meaningful backtrace from your debugger if you break on the gdk_x_error() function.) Are you using the core X font backend or the Xft backend? What sort of font sizes are causing problems? (an approximate figure would be useful). James. -- Email: [EMAIL PROTECTED] WWW: http://www.daa.com.au/~james/ ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
[pygtk] scaling fonts
I am trying to scale my pango fonts with a DPI parameter for my plotting library. I have two parameters, figsize (tuple in inches) and DPI (int) and my figure size is a tuple in pixels given by the product of these, ie, (figsize[0]*dpi, figsize[1]*dpi) When I increase the DPI for hardcopy (rendering to a pixmap and then saving as PNG) I want the fonts to scale with the rest of the lines, rectangles, arcs, etc I tried experimenting with the set_size parameter of the FontDescription and the various pango scales, but there is not a wide enough range of scales to go from screen displays to, say, hardcopy resolutions of 600 dpi. I create the font description as # fontsize in points font = pango.FontDescription('%s %d' % (fontname, fontsize)) and would like to be able to scale the fontsize by an arbitrary scale, something like scale = outputDPI/screenDPI font.set_size(int(scale*fontsize*pango.SCALE)) But this will cause X crashes for large values of scale. If I use the pango SCALE constants for scale aboce, as in font.set_size(int(pango.SCALE_XX_LARGE*fontsize*pango.SCALE)) I don't get the crashes but I can't get my fonts large enough -- SCALE_XX_LARGE is only 1.2. Any ideas on how to scale fonts? Is this possible with pango? Alternatively, is there any true type font support that can be used with pygtk? Thanks for any help, John Hunter X crash with an arbitrary, large, scale factor: The program 'histogram_demo.py' received an X Window System error. This probably reflects a bug in the program. The error was 'BadMatch (invalid parameter attributes)'. (Details: serial 381 error_code 8 request_code 73 minor_code 0) (Note to programmers: normally, X errors are reported asynchronously; that is, you will receive the error a while after causing it. To debug your program, run it with the --sync command line option to change this behavior. You can then get a meaningful backtrace from your debugger if you break on the gdk_x_error() function.) ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/