Re: Pango and consistent scaling of fonts

On Mon, Jun 17, 2002 at 08:59:23PM -0500, Lars Clausen wrote:
> We're working on porting Dia[2] to GTK+ 2.0, and we have great success so
> far[1].  However, one of the things I was hoping to get with Pango was
> consistent font scaling.  This doesn't seem to happen -- I'm hoping we've
> but missed some option or API part.  If not, it will be a serious problem.
> The background:  In Dia, we can have boxes containing text.  The box
> resizes dependning on the size of the text.  To avoid text running over the
> end of the box or being ridiculously short, we need the text to scale
> consistently.  That is, a text string rendered at size 10 should be exactly
> half the size of the same string rendered at size 20.  This doesn't seem to
> be the case in GDK 1.2 rendering, with Freetype 2.1 rendering and with
> Pango rendering.  See example PNGs:

  As far as i understand the whole pango/ft/gdk-medley: The size of a face
  corresponds mainly to font height, not to font width. So one cannot create
  linearly in length increasing strings by increasing the size of the fontface.
  This is a problem inherently in giving font sizes as a single number usually
  in point sizes. The freetype library has some API functions which allow
  scaling of the font faces (FT_Set_Pixel_Sizes, FT_Set_Transform) that seem
  not to be used by pango. The pango function pango_attr_scale_new
  scales the size of the font not the font-face itself which is not the same.
  The documentation of pango points this not really clearly out and i found
  no other pango function for scaling fonts.

  In case of dia a further problem arises; The resulting fonts / diagrams are
  not only shown on screen but also to be printed out in postscript
  (at least by me) and that should be the reference for font scalings -
  Main concern should be correspondence to postscript output. Once I tried
  some options out and had the experience that best output could be get
  by using gnome-print with gdk-pixbuf-output (for screen) and
  postscript-output (for paper). I dont know what gnome-print exactly does
  but it might be worth looking into it.

  btw: dia-cvs-rc3 allowed the use of gnome-print with close screen/paper
  results while current dia-cvs (without gnome-print) only has far too
  small screen fonts with far too big paper fonts but this is for another
  mailing list...

  Greetings - Rasmus

> <URL:>
> <URL:>
> <URL:>
> These strings are rendered with linearly increasing font size, but they end
> up with non-linear sizes.  Is there some way to force Pango to do consistent
> scaling?  The legibility of fonts at small sizes are of secondary
> importance next to having the proper size.
> If Pango can't do this, we will end up having to render the fonts in large
> format and then shrink them by bitmap scaling, a most unsatisfactory
> solution.  I hope somebody can point me at a better way to do it.
> Thanks,
> -Lars
> [1] Only major bug was in gtk_color_selection_[sg]et_color, the new
> versions work fine.
> [2]
> -- 
> Lars Clausen (| Hårdgrim of Numenor
> "I do not agree with a word that you say, but I   |----------------------------
> will defend to the death your right to say it."   | Where are we going, and
>     --Evelyn Beatrice Hall paraphrasing Voltaire  | what's with the handbasket?
> _______________________________________________
> gtk-list mailing list
> gtk-list gnome org

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