Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Antialiased Fonts

by batkins (Chaplain)
on Sep 11, 2003 at 01:51 UTC ( [id://290576]=perlquestion: print w/replies, xml ) Need Help??

batkins has asked for the wisdom of the Perl Monks concerning the following question:

I have a Tk app that looks decent on Windows, but has always looked ugly on X because its fonts aren't antialiased. Is there any way to use antialiasing in a Tk app?
If I were a terrorist I'd mainly be afraid of polar bears. Because at the moment, I'm mainly afraid of polar bears, and I can't really see why that would change if I became a terrorist.

- slashdot

Replies are listed 'Best First'.
Re: Antialiased Fonts
by jonadab (Parson) on Sep 11, 2003 at 04:19 UTC

    Don't current versions of FreeType do antialiasing automatically? I'm thinking Tk shouldn't need to know or care about the details of font rendering. What OS, distro, and version are you running X on? What version of X?

    Update: FreeType does do it, but Tk does need to be involved after all; See hannibal's better explanation below.


    $;=sub{$/};@;=map{my($a,$b)=($_,$;);$;=sub{$a.$b->()}} split//,".rekcah lreP rehtona tsuJ";$\=$ ;->();print$/
      Linux 2.4.20, Gentoo, XFree 4.3.0. I do have Freetype installed, but it doesn't seem to affect Tk. Do I have to load it as an X module or something? I don't have access to any other Linux boxen to try this on.


      If I were a terrorist I'd mainly be afraid of polar bears. Because at the moment, I'm mainly afraid of polar bears, and I can't really see why that would change.
      - slashdot

        in my limited understanding of how X fonts work --- I belive that the app has to be re-written to take advantage of the font-config(Freetype, etc) package, rather than the standard X11 font system.

        Just having freetype and fontconfig setup doesn't automatically make apps antialiased automatically -- look at xfontsel.

        If someone has altered tk to use fontconfig, then you'd be all set ...

Re: Antialiased Fonts
by bobn (Chaplain) on Sep 11, 2003 at 02:21 UTC

    This may or may not get anti-aliasing, but playing with this lets you try different fonts:

    Perl/Tk doesn't look that bad

    --Bob Niederman, http://bob-n.com

    All code given here is UNTESTED unless otherwise stated.

      Hehe - that was actually me who posted that. :) But yeah I've tried that.
      If I were a terrorist I'd mainly be afraid of polar bears. Because at the moment, I'm mainly afraid of polar bears, and I can't really see why that would change.
      - slashdot

        OOOPS!!!

        Now that's funny.

        --Bob Niederman, http://bob-n.com

        All code given here is UNTESTED unless otherwise stated.

Re: Antialiased Fonts
by batkins (Chaplain) on Sep 13, 2003 at 01:25 UTC
    I got it! I asked Nick Ing-Simmons about this, and it turns out that antialiasing is included in the new Tk804 distribution, which just entered alpha and is supposed to hit CPAN shortly. At the moment, it's available here.

    Unpack the tarball and then run "perl Makefile.PL XFT=1". Then make the module as usual. Note that before you can do this, you need freetype, fontconfig, and Xft.

    Once this is done, the font "{open glyph look}" can be specified to use an antialiased font. This is all I know at the moment, but it definitely does work.


    If I were a terrorist I'd mainly be afraid of polar bears. Because at the moment, I'm mainly afraid of polar bears, and I can't really see why that would change.
    - slashdot

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://290576]
Approved by Enlil
Front-paged by IlyaM
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (7)
As of 2024-04-18 16:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found