TrueType Fonts

Discussion in 'Java' started by Esteban, Nov 28, 2003.

  1. Esteban

    Esteban Guest

    Hello,

    I'm trying to have my Linux Java use the truetype fonts I've imported from
    Windows. These are ok, because I can use them with OpenOffice but when I
    do component.setFont(new Font("Comic Sans MS", Font.BOLD, 12)) nothing
    happens in Linux as in Windows... it works !

    What can I do ?

    Thank you.
    Esteban, Nov 28, 2003
    #1
    1. Advertising

  2. Esteban

    bOOyah Guest

    In article <>,
    ospam says...
    > I'm trying to have my Linux Java use the truetype fonts I've imported from
    > Windows. These are ok, because I can use them with OpenOffice but when I
    > do component.setFont(new Font("Comic Sans MS", Font.BOLD, 12)) nothing
    > happens in Linux as in Windows... it works !
    >
    > What can I do ?


    On Linux, the fonts used by the JRE aren't the same as the fonts used
    by the XFree system. Just because you have made your Windows TTFs
    available to Linux users doesn't mean you have simultaneously made
    them available to your Java apps.

    You need to put all the TrueType fonts you want to use into your "jre
    \lib\fonts" directory.

    Alternatively you could move the existing JRE fonts directory out of
    the way and symlink to your XFree TrueType directory. That way any
    new TTFs you add to Linux will also be available to your Java apps.

    prompt# cd <JRE_HOME>/jre/lib
    prompt# cp ./fonts/* /usr/X11R6/lib/X11/fonts/truetype
    prompt# mv fonts fonts.orig
    prompt# ln -s /usr/X11R6/lib/X11/fonts/truetype fonts

    (My TTFs are stored in /usr/X11R6/lib/X11/fonts/truetype).

    Remember, you will have to repeat this step when you install a new
    JRE.

    Hope this helps.
    --
    bOOyah
    bOOyah, Nov 29, 2003
    #2
    1. Advertising

  3. Esteban

    Esteban Guest

    Oh ok, thank you for your answer !
    Esteban, Nov 29, 2003
    #3
  4. Esteban

    bOOyah Guest

    In article <>,
    ospam says...
    > Oh ok, thank you for your answer !


    No problems!

    One more thing to be aware of:
    I don't know what Linux distro you are using. If it is a very recent
    one it probably uses the fontconfig package to manage fonts in XFree;
    (Mandrake 9.1 and Redhat 9 (8 too?)) for example. If your distro has
    a directory called /etc/fonts then you are probably in this camp.

    However, earlier Linuxes didn't use fontconfig, so you might have to
    recreate the fonts.scale and fonts.dir files in your X11 truetype
    fonts directory after you have copied the JRE TTFs into it.
    Otherwise they won't be "detected" by XFree.

    prompt# cd /usr/X11R6/lib/X11/fonts/truetype
    prompt# ttmkfdir > fonts.dir
    prompt# cp fonts.dir fonts.scale

    That should do it (I'm working from memory here).

    Hope this helps again!
    --
    bOOyah
    bOOyah, Nov 29, 2003
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Michael Tanner

    Different fonts in multiline text box...

    Michael Tanner, Jul 25, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    597
    Steve C. Orr, MCSD
    Jul 25, 2003
  2. Steve Holden
    Replies:
    2
    Views:
    366
    Steve Holden
    Sep 19, 2008
  3. sam
    Replies:
    0
    Views:
    401
  4. Stefano dS

    GD TrueType empty output

    Stefano dS, Jan 5, 2004, in forum: Perl Misc
    Replies:
    5
    Views:
    109
    Martien Verbruggen
    Jan 7, 2004
Loading...

Share This Page