Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > TrueType Fonts

Reply
Thread Tools

TrueType Fonts

 
 
Esteban
Guest
Posts: n/a
 
      11-28-2003
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.
 
Reply With Quote
 
 
 
 
bOOyah
Guest
Posts: n/a
 
      11-29-2003
In article <(E-Mail Removed)> ,
http://www.velocityreviews.com/forums/(E-Mail Removed)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
 
Reply With Quote
 
 
 
 
Esteban
Guest
Posts: n/a
 
      11-29-2003
Oh ok, thank you for your answer !

 
Reply With Quote
 
bOOyah
Guest
Posts: n/a
 
      11-29-2003
In article <(E-Mail Removed)> ,
(E-Mail Removed)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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Use TrueType Fonts for PDF Generation & Adding Buffered Images to PDF sherazam Java 0 06-22-2012 10:53 AM
Re: Extracting hte font name from a TrueType font file Steve Holden Python 2 09-19-2008 07:25 AM
Extracting hte font name from a TrueType font file Steve Holden Python 0 09-18-2008 04:58 PM
Fonts suddenly unreadable in IE 6.0 - All other system fonts appear normal Emily Computer Support 3 06-09-2005 04:52 AM
GD TrueType empty output Stefano dS Perl Misc 5 01-07-2004 10:00 PM



Advertisments