lilypond-devel
[Top][All Lists]
Advanced

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

[Owen Taylor] Re: Pango Font Scaling


From: Jan Nieuwenhuizen
Subject: [Owen Taylor] Re: Pango Font Scaling
Date: Tue, 17 Aug 2004 09:05:36 +0200
User-agent: Gnus/5.1003 (Gnus v5.10.3) Emacs/21.3.50 (gnu/linux)

for our information

--- Begin Message --- Subject: Re: Pango Font Scaling Date: Mon, 16 Aug 2004 11:58:21 -0400
On Sat, 2004-08-14 at 23:07, Haran Shivanan wrote:
> Hi,
> 
> I'm having problems understanding how font scaling works in Pango.
> I have a box into which I'm rendering a PangoLayout object.
> When I double the size of the box, I need the font to be scaled by both 
> height and width accordingly.
> 
> At first I naively tried just pango_font_description_set_size(...) with a 
> size twice as large but this doesn't work.

Doesn't work how? It should be "approximately" twice as large, with
a bit of fuzz from hinting to integer pixel sizes. Unless you
are using bitmap fonts.

> If I understand correctly, 
> (shape of a font at size X)*2 != (shape of font at size 2X)
> Is this correct?
> How can I get what I want?
> I essentially need to "zoom in" to the layout.

If you want linear scaling, you need to turn off hinting -- which
requires using a separate font map. Unfortunately, that does require
using the FT2 backend, since there is only one fontmap per screen
for Xft.

For FT2, turning off hinting looks like:

===

/* This function gets called to convert a matched pattern into what
 * we'll use to actually load the font. We turn off hinting since we
 * want metrics that are independent of scale.
 */
static void
substitute_func (FcPattern *pattern, gpointer   data)
{
        FcPatternDel (pattern, FC_HINTING);
        FcPatternAddBool (pattern, FC_HINTING, FALSE);
}

pango_ft2_font_map_set_default_substitute (ft2fontmap, 
                                           substitute_func,
                                           NULL, NULL);
===


Regards,
                                                Owen

Attachment: signature.asc
Description: This is a digitally signed message part

_______________________________________________
gtk-i18n-list mailing list
address@hidden
http://mail.gnome.org/mailman/listinfo/gtk-i18n-list

--- End Message ---
-- 
Jan Nieuwenhuizen <address@hidden> | GNU LilyPond - The music typesetter
http://www.xs4all.nl/~jantien       | http://www.lilypond.org

reply via email to

[Prev in Thread] Current Thread [Next in Thread]