Forums Register Login

Font problem

+Pie Number of slices to send: Send
How does it come the button's label isn't displayed with the font Broadway BT? In the method paint the font works.

When i use the method setFont it still doesn't work.

Thanks for the replies in advance.
Sofie
+Pie Number of slices to send: Send
There are multiple problems here... Under some JVM/OS combinations the JVM is pretty good at finding the installed fonts on the system and using those, under others, you have to go to great lengths to install fonts (i.e. install them in the lib/fonts directory of the JRE, then edit font.properties to include them correctly). This is for applications.

You have an additional problem because you are running as an Applet. The applet runs on the JVM of the *user's* browser. If the *user* doesn't have the font installed, then the JVM will not know what font you are talking about, and will just use the default font.
+Pie Number of slices to send: Send
 


You have to go to great lengths to install fonts (i.e. install them in the lib/fonts directory of the JRE, then edit font.properties to include them correctly)


What do I have to edit about the font.properties? Does it satisfy when I just place the appropiated fonts in the directory lib/fonts of the JRE?
+Pie Number of slices to send: Send
No, you have to edit font.properties for Java to find it correctly, too. That is, *IF* your JDK version/OS requires this. Try calling -


And see what fonts are available to you.

A good description of what you have to do if you need to manually install fonts is here. Sun provides examples of how to install asian fonts in the JDK.
+Pie Number of slices to send: Send
I tried what you said and saw that the font Bangle was available but when I tried the following it still didn't work out! What's the problem then?


Try calling -
code:
--------------------------------------------------------------------------------
String[] fontNames = GraphicsEnvironment.getLocalGraphicsEnvironment(). getAvailableFontFamilyNames();
--------------------------------------------------------------------------------
And see what fonts are available to you.


+Pie Number of slices to send: Send
Did it just use the default font or did a bunch of squares or question marks show up? If it just used the default then I'm not sure what's wrong, because the GraphicsEnvironment *told* you it was installed. If it's just displaying little empty squares or a bunch of question marks it means that the font isn't rendering correctly in UTF, which may be a solvable problem or may not.

I found more good resources on getting more fonts to work in Java :
  • MindProd Java Glossery entry on Fonts
  • A Sun forum thread on fonts that don't seem to render correctly.
  • Some font issues discussed in a FAQ for a Java program called "Kirrkirr".

  • +Pie Number of slices to send: Send
    It was just displayed with the default font so tricky to solve the problem.
    Thanks for the links on how fonts work.
    The overall mission is to change the world. When you've done that, then you can read this tiny ad:
    a bit of art, as a gift, that will fit in a stocking
    https://gardener-gift.com


    reply
    reply
    This thread has been viewed 1462 times.
    Similar Threads
    Observable/Observer - Application/Applet
    Default Font
    Applet help.....
    labeling in this Applet..
    labeling in this Applet..
    More...

    All times above are in ranch (not your local) time.
    The current ranch time is
    Apr 16, 2024 02:53:04.