setFont() on solaris  
Author Message
emailismylife





PostPosted: 2004-4-3 6:15:00 Top

java-programmer, setFont() on solaris Hi,

In one of my methods, I have a call like:

label.setFont(new Font("Arial", Font.PLAIN, 9));

This call works fine on windows but not on solaris. Moreover, the
label's text gets truncated when it shows up ("Applications" shows as
"Applicati") I iterated through the fonts via
GraphicsEnvironment.getAllFonts() and Arial seems to be available to
the java graphics environment on solaris.

How do I get arial font on solaris and not cause the truncation? Any
suggestions?

Thanks.
 
Andrew Thompson





PostPosted: 2004-4-4 15:41:00 Top

java-programmer >> setFont() on solaris On Sat, 03 Apr 2004 05:22:56 GMT, Roedy Green wrote:

> On 2 Apr 2004 14:15:12 -0800, email***@***.com (sn) wrote or
> quoted :
>
>>In one of my methods, I have a call like:
>>label.setFont(new Font("Arial", Font.PLAIN, 9));
>>
...
> ...much simpler approach would be to use a font called
> "SansSerif" guaranteed to exist on all platforms.

Not just simpler, better. It would get the
user's _chosen_ sans-serif font, rather than
the one the software developer likes.

>> Moreover, the label's text gets truncated
>> when it shows up ("Applications" shows as
>>"Applicati")

Tha seems more like a problem with the layout
(using absolute positioning, no layout manager, etc..).

I would have to see an example to be sure.
<http://www.physci.org/codes/sscce.jsp>

--
Andrew Thompson
http://www.PhySci.org/ Open-source software suite
http://www.PhySci.org/codes/ Web & IT Help
http://www.1point1C.org/ Science & Technology
 
emailismylife





PostPosted: 2004-4-16 9:41:00 Top

java-programmer >> setFont() on solaris setFont(Font) does not seem to work at all for labels (I havet tried
for other components) on solaris.

I tried various ways of creating fonts before applying it to the
label:
- new Font("<logical-name>", <style>, <size>); // logical name is
"sansserif", "serif" etc.
- new Font("<physical-name>", <style>, <size>); // physical name is
"arial", etc.
- Font.createFont(<Type>, <InputStream to ttf file>) followed by
font.deriveFont()

Whenever I change a parameter (size, name, or style) while creating a
font, I can see that change when I access the applet (yes, all this
is in an applet!) while running in IE. But with Netscape on Solaris,
it always shows the default font and size.

Could be some JRE settings problem on Solaris. Any ideas? (I havent
modified the default font.properties in either case)

Thanks for your help.



Andrew Thompson <email***@***.com> wrote in message news:<18jrfp75fqool$email***@***.com>...
> On Sat, 03 Apr 2004 05:22:56 GMT, Roedy Green wrote:
>
> > On 2 Apr 2004 14:15:12 -0800, email***@***.com (sn) wrote or
> > quoted :
> >
> >>In one of my methods, I have a call like:
> >>label.setFont(new Font("Arial", Font.PLAIN, 9));
> >>
> ...
> > ...much simpler approach would be to use a font called
> > "SansSerif" guaranteed to exist on all platforms.
>
> Not just simpler, better. It would get the
> user's _chosen_ sans-serif font, rather than
> the one the software developer likes.
>
> >> Moreover, the label's text gets truncated
> >> when it shows up ("Applications" shows as
> >>"Applicati")
>
> Tha seems more like a problem with the layout
> (using absolute positioning, no layout manager, etc..).
>
> I would have to see an example to be sure.
> <http://www.physci.org/codes/sscce.jsp>
 
 
emailismylife





PostPosted: 2004-4-17 5:51:00 Top

java-programmer >> setFont() on solaris Well, this turned out to be a stupid problem. I am connecting to a
solaris box using an X server on windows (Xmanager) and my
installation of X server does not seem to have TrueType fonts in its
fontpath by default. When I run my java programs/applet on a Solaris
box all the fonts etc. work just fine.

Isnt it suprising how small things seem so perplexing when you are new
to things :) ????


email***@***.com (sn) wrote in message news:<email***@***.com>...
> setFont(Font) does not seem to work at all for labels (I havet tried
> for other components) on solaris.
>
> I tried various ways of creating fonts before applying it to the
> label:
> - new Font("<logical-name>", <style>, <size>); // logical name is
> "sansserif", "serif" etc.
> - new Font("<physical-name>", <style>, <size>); // physical name is
> "arial", etc.
> - Font.createFont(<Type>, <InputStream to ttf file>) followed by
> font.deriveFont()
>
> Whenever I change a parameter (size, name, or style) while creating a
> font, I can see that change when I access the applet (yes, all this
> is in an applet!) while running in IE. But with Netscape on Solaris,
> it always shows the default font and size.
>
> Could be some JRE settings problem on Solaris. Any ideas? (I havent
> modified the default font.properties in either case)
>
> Thanks for your help.
>
>
>
> Andrew Thompson <email***@***.com> wrote in message news:<18jrfp75fqool$email***@***.com>...
> > On Sat, 03 Apr 2004 05:22:56 GMT, Roedy Green wrote:
> >
> > > On 2 Apr 2004 14:15:12 -0800, email***@***.com (sn) wrote or
> > > quoted :
> > >
> > >>In one of my methods, I have a call like:
> > >>label.setFont(new Font("Arial", Font.PLAIN, 9));
> > >>
> ...
> > > ...much simpler approach would be to use a font called
> > > "SansSerif" guaranteed to exist on all platforms.
> >
> > Not just simpler, better. It would get the
> > user's _chosen_ sans-serif font, rather than
> > the one the software developer likes.
> >
> > >> Moreover, the label's text gets truncated
> > >> when it shows up ("Applications" shows as
> > >>"Applicati")
> >
> > Tha seems more like a problem with the layout
> > (using absolute positioning, no layout manager, etc..).
> >
> > I would have to see an example to be sure.
> > <http://www.physci.org/codes/sscce.jsp>