Article View: borland.public.jbuilder.java.language
Article #553How to set which fonts to use when the default is missing
From: Katerina K.
Date: Fri, 04 Mar 2005 10:24
Date: Fri, 04 Mar 2005 10:24
30 lines
2017 bytes
2017 bytes
Hello!
In an application that I am working on, I want to use a specific font that
my company uses (not a True Type font unfortunately). It seems that I can
only create true type fonts through java. So my alternative (as I see it) is
to make sure to install the font that I want to use along with my
application. If the PC that the application is installed does not have this
specific font, then java automatically uses the default font "Dialog". How
can I create an exception when this happens, in order to set myself the font
that I want to use (one of the default ones), instead of the program doing
it automatically?
I tried the following:
try
{
this.setFont(new java.awt.Font("MyOwnFont", 1, 18));
}
catch (Exception ex)
{
this.setFont(new java.awt.Font("TheSansSemiBold-Plain", 1, 20));
}
but this does not work, since java does not throw an exception when it does
not find "MyOwnFont", but it automatically uses the "Dialog" font instead.
Any ideas?
Thanks a lot
Katerina
Technical Details
Message-ID:
<42283751$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news.glorb.com!border1.nntp.dca.giganews.com!nntp.giganews.com!pd7cy2so!shaw.ca!news-out.newsgroups.com!propagator2-sterling.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Thread: f74b3,2987ed43b256ce67,start X-Google-Attributes: gidf74b3,public X-Google-Language: ENGLISH,ASCII-7-bit From: "Katerina K." <scorpio_gemini@hotmail.com> Newsgroups: borland.public.jbuilder.java.language Subject: How to set which fonts to use when the default is missing Date: Fri, 4 Mar 2005 11:24:17 +0100 Lines: 32 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.2527 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2527 X-RFC2646: Format=Flowed; Original NNTP-Posting-Host: 129.132.68.93 Message-ID: <42283751$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1109931857 129.132.68.93 (4 Mar 2005 02:24:17 -0800) Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news.glorb.com!border1.nntp.dca.giganews.com!nntp.giganews.com!pd7cy2so!shaw.ca!news-out.newsgroups.com!propagator2-sterling.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail