I just filed bug 6517861:
Installing font of family "Times" on Windows hides "Times New Roman"

I can give you a brief explanation of what's happening but
I don't have a workaround for you.

In jdk 6 we started to use GDI for font lookups for performance
and it looks as if we are running afoul of some hard-coded
"alias" mappings that windows has in its registry that seems
wrong to me.
Eg I see
Times : Times Roman
Times Roman : Times New Roman
Times New Roman : Times
Wrong in that they should not apply when real fonts of those
aliased names are installed.

In order to be able to report all fonts we call into GDI
and ask it for
1) All font families
2) All fonts in each of those families.

We use the windows API EnumFontFamiliesExW(..)
So in the first case it includes "Times" in its list
of families and when we then ask for the fonts in that
"Times" family it reports 5 fonts (!)

Times Roman
Times New Roman
Times New Roman Bold
Times New Roman Bold Italic
Times New Roman Italic

I think that what happens next is that since we see
the family "Times" after seeing the family "Times New Roman"
and so GDI's claim that "Times New Roman" is a member
of the "Times" family wins. Tnen we pull the "plain" font
from that family and that's what you get.

Fixing it means adding some extra checking and hoping
GDI plays nice.

-phil.

Jan Bösenberg (INCORS GmbH) wrote:
Hello Alexey,

yes I am using JDK 1.6 (b105). Here is some additional information about
the Times font that I extracted with Microsoft's Font Properties Editor:

Font family name: Times
Version: 19: 34455: 1999
Weight and style: Roman
PostScript name: Times-Roman
Unique name: Agfa:Times-Roman:1999

The other font is the standard Times New Roman that comes with Windows
XP. If there is any other Information that I can provide, just let me know.


Cheers

Jan




Alexey Ushakov schrieb:
Hello Jan,

It seems like a bug. Could you please provide more details concerning
this problem. What version jdk are you using? Did you try jdk6.0 with
your test case?

Best Regards,
Alexey
Java2D Team

Jan Bösenberg (INCORS GmbH) wrote:
Hello,

on one test system we found a really strange behavious of a little app,
which creates a Font instance for each available font familiy name. The
code looks like this:

     String[] fontFamilyNames =
GraphicsEnvironment.getLocalGraphicsEnvironment().getAvailableFontFamilyNames();



     Font[] fonts = new Font[fontFamilyNames.length];
     int fontCount = 0;
     for (int i = 0; i < fontFamilyNames.length; i++) {
       fonts[i] = new Font(fontFamilyNames[i], Font.PLAIN, 1);
     }

On that particular (WinXP) system, there are two fonts installed: Times
New Roman (file name times.ttf) and Times (file name kycw1_75.ttf). Both
family names ("Times New Roman" and "Times") are returned by the
getAvailableFontFamilyNames() method.

The problem is that the line new Font(fontFamilyNames[i], Font.PLAIN, 1)
creates an instance of the "Times" font for both family names. I tried
using alternative constructors (for example new Font(Map attributes)
with only the FamilyName attribute set), but nothing works. As a result
of this, we simply cannot use Times New Roman on that machine from Java,
which is quite a shame, because it is far better than the Times font
(much more of the Unicode glyphs are covered). If we remove the Times
font from the machine, everything works fine. In non-Java applications
both fonts appear in font choosers (under the names "Times" and "Times
New Roman" as you would expect).

I guess this is a bug in the Java font package, but I have a tiny bit a
hope left that there is a workaround available. Can someone help? The
Times font was installed from a driver CD-ROM for a Kyocera printer.


Thanks

Jan

===========================================================================



To unsubscribe, send email to [EMAIL PROTECTED] and include in the
body
of the message "signoff JAVA2D-INTEREST".  For general help, send
email to
[EMAIL PROTECTED] and include in the body of the message "help".

===========================================================================


To unsubscribe, send email to [EMAIL PROTECTED] and include in the
body
of the message "signoff JAVA2D-INTEREST".  For general help, send
email to
[EMAIL PROTECTED] and include in the body of the message "help".


===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA2D-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA2D-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to