Variable Text Size - Xwindows

This is a discussion on Variable Text Size - Xwindows ; My application needs to vary the text size. The SuSE 9.3 distribution comes with a Fnlib that should do this, only I can't find any documentation for Fnlib. Any suggestions on where to find Fnlib documentation, or is there another ...

+ Reply to Thread
Results 1 to 5 of 5

Thread: Variable Text Size

  1. Variable Text Size

    My application needs to vary the text size. The SuSE 9.3 distribution
    comes with a Fnlib that should do this, only I can't find any
    documentation for Fnlib.

    Any suggestions on where to find Fnlib documentation, or is there
    another package I could use with X Windows to provide variable text size.

    Thanks
    Paul

  2. Re: Variable Text Size

    Paul Thompson wrote:
    > My application needs to vary the text size. The SuSE 9.3 distribution
    > comes with a Fnlib that should do this, only I can't find any
    > documentation for Fnlib.
    >
    > Any suggestions on where to find Fnlib documentation, or is there
    > another package I could use with X Windows to provide variable text size.


    If you need scaleable fonts, not antialiased ones
    you do not need to access any other library directly,
    just learn how to properly specify your font using xlfd when you
    are opening the font for your drawing GC
    http://www.linuxdocs.org/HOWTOs/XWin...r-HOWTO-7.html
    X window will make the font in the specified size for you.
    If you want to check which fonts are scaleable, and which
    are bitamp, type
    xlsfonts |grep 0-0-0-0
    and this will give you a list of scaleable fonts on your X server.

    If you need antialiased fonts, then check this
    http://keithp.com/~keithp/render/Xft.tutorial

    Getting a copy of Xlib Programming Manual by Adrian Nye
    http://www.ac3.edu.au/SGI_Developer/...tml/index.html
    or just reading the section on fonts, will also help.
    http://www.ac3.edu.au/SGI_Developer/...ml#S1-1002-6-2

    Best regards,

    Dušan Peterc
    http://www.arahne.si

  3. Re: Variable Text Size

    arahne wrote:
    > Paul Thompson wrote:
    >> My application needs to vary the text size. The SuSE 9.3 distribution
    >> comes with a Fnlib that should do this, only I can't find any
    >> documentation for Fnlib.
    >>
    >> Any suggestions on where to find Fnlib documentation, or is there
    >> another package I could use with X Windows to provide variable text size.

    >
    > If you need scaleable fonts, not antialiased ones
    > you do not need to access any other library directly,
    > just learn how to properly specify your font using xlfd when you
    > are opening the font for your drawing GC
    > http://www.linuxdocs.org/HOWTOs/XWin...r-HOWTO-7.html
    > X window will make the font in the specified size for you.
    > If you want to check which fonts are scaleable, and which
    > are bitamp, type
    > xlsfonts |grep 0-0-0-0
    > and this will give you a list of scaleable fonts on your X server.
    >
    > If you need antialiased fonts, then check this
    > http://keithp.com/~keithp/render/Xft.tutorial
    >
    > Getting a copy of Xlib Programming Manual by Adrian Nye
    > http://www.ac3.edu.au/SGI_Developer/...tml/index.html
    > or just reading the section on fonts, will also help.
    > http://www.ac3.edu.au/SGI_Developer/...ml#S1-1002-6-2
    >
    > Best regards,
    >
    > Dušan Peterc
    > http://www.arahne.si


    Thanks for the good information. I wish I had known about the Xlib
    Programming Manual when I started this project.

    I can find the scaleable fonts, e.g.

    -adobe-utopia-bold-r-normal--0-0-0-0-p-0-iso8859-1

    But how do I use and scale this font. My best guess was to try and
    substitute for the variable parts, e.g.

    fonts[0] = XLoadFont(display,
    "-adobe-utopia-bold-r-normal--30-240-100-100-p-100-iso8859-1");

    But the load fails

    BadName (named color or font does not exist)

    Perhaps I need to build and add the font offline using some font utility?

    Thanks
    Paul

  4. Re: Variable Text Size

    Paul Thompson wrote:

    > Thanks for the good information. I wish I had known about the Xlib
    > Programming Manual when I started this project.
    >
    > I can find the scaleable fonts, e.g.
    >
    > -adobe-utopia-bold-r-normal--0-0-0-0-p-0-iso8859-1
    >
    > But how do I use and scale this font. My best guess was to try and
    > substitute for the variable parts, e.g.
    >
    > fonts[0] = XLoadFont(display,
    > "-adobe-utopia-bold-r-normal--30-240-100-100-p-100-iso8859-1");
    >
    > But the load fails
    >
    > BadName (named color or font does not exist)
    >
    > Perhaps I need to build and add the font offline using some font utility?


    No, the font is rendered by the X server (or its font server)
    on the fly.
    Actually, it is one of several conceptual flaws of X,
    since you can freeze the whole server for a long time
    if you request a font with huge size, since
    all characters are rendered. A lot of work for Chinese fonts.
    Since any X client can do this, it is a small DOS attack.
    But most people will argue that a computer with X access open
    to anyone is completely vulnerable, anyway ;-)

    Your mistake in font specification is, that you specify
    everything. You should specify as little as possible,
    and replace the rest with *
    Specifying both size in points (30) and in pixels (240)
    is wrong. Do one of them, but not both.
    Maybe I should also point you to this chapter
    http://www.ac3.edu.au/SGI_Developer/..._html/apa.html
    And you can also play with
    xfd -fn FONT_WITH_XLFD_NAME
    so you see what is available on your server.
    It is not a bad practice to have a fall back font,
    in case your desired font is not available, for
    example 8x13. So the application will look
    ugly instead of crash.

    Hope this helps,

    Dušan Peterc
    http://www.arahne.si

  5. Re: Variable Text Size

    Dušan Peterc

    Works great, thanks

    Paul

    arahne wrote:
    > Paul Thompson wrote:
    >
    >> Thanks for the good information. I wish I had known about the Xlib
    >> Programming Manual when I started this project.
    >>
    >> I can find the scaleable fonts, e.g.
    >>
    >> -adobe-utopia-bold-r-normal--0-0-0-0-p-0-iso8859-1
    >>
    >> But how do I use and scale this font. My best guess was to try and
    >> substitute for the variable parts, e.g.
    >>
    >> fonts[0] = XLoadFont(display,
    >> "-adobe-utopia-bold-r-normal--30-240-100-100-p-100-iso8859-1");
    >>
    >> But the load fails
    >>
    >> BadName (named color or font does not exist)
    >>
    >> Perhaps I need to build and add the font offline using some font utility?

    >
    > No, the font is rendered by the X server (or its font server)
    > on the fly.
    > Actually, it is one of several conceptual flaws of X,
    > since you can freeze the whole server for a long time
    > if you request a font with huge size, since
    > all characters are rendered. A lot of work for Chinese fonts.
    > Since any X client can do this, it is a small DOS attack.
    > But most people will argue that a computer with X access open
    > to anyone is completely vulnerable, anyway ;-)
    >
    > Your mistake in font specification is, that you specify
    > everything. You should specify as little as possible,
    > and replace the rest with *
    > Specifying both size in points (30) and in pixels (240)
    > is wrong. Do one of them, but not both.
    > Maybe I should also point you to this chapter
    > http://www.ac3.edu.au/SGI_Developer/..._html/apa.html
    > And you can also play with
    > xfd -fn FONT_WITH_XLFD_NAME
    > so you see what is available on your server.
    > It is not a bad practice to have a fall back font,
    > in case your desired font is not available, for
    > example 8x13. So the application will look
    > ugly instead of crash.
    >
    > Hope this helps,
    >
    > Dušan Peterc
    > http://www.arahne.si


+ Reply to Thread