Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / January 2006

Tip: Looking for answers? Try searching our database.

Fonts Mac OS java

Thread view: 
janek - 24 Dec 2005 11:56 GMT
Hi,

I have a following problem.I need to use external ttf font in java on
Mac Computer.I have installed it on system using fontbook.Installed font
is visible to standard mac applications word,textedit etc. but when I
run java program the font is being replaced by some other font.On
another PC machine with windows XP font is proper.

I.ve done some research through google and I think it is about logical
and physical font mappings, but there is no font.properties file on Mac.
The reason is maybe also that I have java SDK on ma windows PC and only
JRE on Mac, but I don't want to force my client to install SDK.
I also found in some documents that MAC don't use font.properties file.
The documents I've read were very vague and maybe obsolete (2000).

So my question is how to make this font working?

Thanks for help in advance.
Roedy Green - 24 Dec 2005 12:03 GMT
>So my question is how to make this font working?

see http://mindprod.com/jgloss/opentype.html
and follow the link to the spec on font formats.

For general Mac use, you would want a Mac font map, but for Java use a
Unicode one, same as for use on Windows. That tends to indicate lack
of an encoding vector is not the problem.

I would like to find a utility to display the font meta-information.

I have written two to display installed fonts. See
http://mindprod.com/applets/fontshower.html
http://mindprod.com/applets/fontshowerawt.html
Signature

Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.

janek - 26 Dec 2005 20:48 GMT
> I have written two to display installed fonts. See
> http://mindprod.com/applets/fontshower.html
> http://mindprod.com/applets/fontshowerawt.html

Thx, but not solution for my problem.As I mentioned the font I want to
use is visible for java (also in Combobox on your applet) but it doesn't
look like it should look.

When I switch to my desired font in combobox on your applet the font
looks the same as the previous one in the list (No change). When I
switch to any other font 'visual alpahbet presentation' changes.

So I ask the question once more "How to make this font look the same as
in normal applications(word,textedit etc.) in java applications ?"
Roedy Green - 26 Dec 2005 21:04 GMT
>Thx, but not solution for my problem.As I mentioned the font I want to
>use is visible for java (also in Combobox on your applet) but it doesn't
[quoted text clipped - 6 lines]
>So I ask the question once more "How to make this font look the same as
>in normal applications(word,textedit etc.) in java applications ?"

"look different" is not much a clue.  Perhaps what you are referring
to is anti-aliasing.  Have you played with anti-aliasing on the two
Applets I gave you to see if they make the font appear the way you
expect?

Perhaps you are not successfully setting the font.  Try dumping the
font name with System.out.println( component.getFont() ).  Perhaps you
are not getting it because you spelling it with a tiny error.
Signature

Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.

janek - 26 Dec 2005 21:11 GMT
> "look different" is not much a clue.  Perhaps what you are referring
> to is anti-aliasing.  Have you played with anti-aliasing on the two
> Applets I gave you to see if they make the font appear the way you
> expect?

Font I want to use is Orator10EU and what I get is Optima.
Every child can see a difference.

> Perhaps you are not successfully setting the font.  Try dumping the
> font name with System.out.println( component.getFont() ).  Perhaps you
> are not getting it because you spelling it with a tiny error.

I don't have to set this font. As I wrote also in your applet and any
java application (ex. ireport) when I choose my font(orator) it looks
like optima.So it is JVM issue, not my application.
Roedy Green - 26 Dec 2005 21:40 GMT
>Font I want to use is Orator10EU and what I get is Optima.
>Every child can see a difference.

Yet when you go into control panel fonts they appear just fine?

I would try uninstalling both fonts, and reinstalling just one to see
what happens.

Also look for any other fonts that might be being confused for these
two.

You may have a corrupt font cache or font install.
Signature

Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.

janek - 27 Dec 2005 21:58 GMT
Thx for your assistance. The problem is more complex and relates many
font on Mac Os. It's about name convention on Mac Os.Some font during
loading (from system or with createFont() from file ) are getting
additional suffix to font name realating to font attributes, so my font
is 'orator15U-Normal' on MAC but it is 'orator15U Normal' on windows PC.
I checked it twice, when I change its name (in my code )  to
'orator15U-Normal' font is displayed properly.

But if i change my code to set 'orator15U Normal' it won't work on win
PC (I checked it). I haven't found a solution yet.
steve - 01 Jan 2006 21:46 GMT
> Thx for your assistance. The problem is more complex and relates many
> font on Mac Os. It's about name convention on Mac Os.Some font during
[quoted text clipped - 6 lines]
> But if i change my code to set 'orator15U Normal' it won't work on win
> PC (I checked it). I haven't found a solution yet.

then check what platform you are running on and change the name of the font
depending on that.
janek - 01 Jan 2006 22:50 GMT
> then check what platform you are running on and change the name of the font
> depending on that.

How ?  As far I know ,I cannot 'globaly register' font on different
method     createFont(..) registers font but it uses ttf platform specific
name and deriveFont(..) allows you to change this name but it return
only local Font object which is not visible to
GraphicsEnvironment.getLocalGraphicsEnviroment().getAllFonts() method.
There is no way to register this local Font.

But I cannot use this local Font, becausue  third-party software I use
in my project needs to get this font from global fonts.

I posted new message to the group some days ago about this case,but no
answer yet. So I doubt it is possible at all. So java is platform
portable on condition that you prepare different version for each
platform :).


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.