Bug 525870 - The Java plugin does not report available fonts accurately
The Java plugin does not report available fonts accurately
Status: CLOSED ERRATA
Product: Fedora
Classification: Fedora
Component: java-1.6.0-openjdk (Show other bugs)
13
All Linux
low Severity medium
: ---
: ---
Assigned To: Omair Majid
Fedora Extras Quality Assurance
:
Depends On:
Blocks: F12Target
  Show dependency treegraph
 
Reported: 2009-09-26 09:32 EDT by Nicolas Mailhot
Modified: 2011-01-19 16:09 EST (History)
6 users (show)

See Also:
Fixed In Version: java-1.6.0-openjdk-1.6.0.0-48.1.8.4.fc13
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2011-01-19 16:06:04 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)

  None (edit)
Description Nicolas Mailhot 2009-09-26 09:32:32 EDT
Description of problem:

The Java plugin does not report available fonts accurately. Samplers such as
http://www.codestyle.org/css/font-family/sampler-Unix.shtml
collect incomplete info

Version-Release number of selected component (if applicable):
java-1.6.0-openjdk-plugin-1.6.0.0-31.b16.fc12.x86_64

How reproducible:
Always

Steps to Reproduce:
1. Get a F11 or rawhide system
2. Install our fonts # yum -y install $(repoquery --whatprovides "font(*)")
3. List them $ fc-list : family |sort
4. Open http://www.codestyle.org/css/font-family/sampler-Unix.shtml
5. Let the applet run, check its result
  
Actual results:
The java-detected font list is incomplete (for example it's missing STIX) and does not use the same names at fontconfig

Expected results:
The same list in both cases

Additional info:
Comment 1 Bug Zapper 2010-03-15 08:53:10 EDT
This bug appears to have been reported against 'rawhide' during the Fedora 13 development cycle.
Changing version to '13'.

More information and reason for this action is here:
http://fedoraproject.org/wiki/BugZappers/HouseKeeping
Comment 3 Omair Majid 2010-07-02 11:39:58 EDT
Just some thoughts about missing fonts:

The Java runtime searches /usr/share/fonts/stix (and other folders) but does not find any type of fonts that it recognizes. The JDK source code seems to indicate that only X11 native fonts, FreeType and Postscript Type 1 fonts are supported or recognized. This would explain why fonts like STIX (an OpenType font) are not recognized.
Comment 4 Nicolas Mailhot 2010-07-02 13:04:23 EDT
It seems to have been fixed upstream

http://blogs.sun.com/openjdk/entry/openjdk_roundup1

"adding support for OpenType/CFF fonts"

it would be nice if the fix was pushed Fedora-side too. We have lots (30%) of OpenType/CFF fonts in the distro.
Comment 5 Omair Majid 2010-11-16 13:25:10 EST
Support for opentype fonts has been added in OpenJDK6. See commits:

http://hg.openjdk.java.net/jdk6/jdk6/jdk/rev/b577c70564b8
http://hg.openjdk.java.net/jdk6/jdk6/jdk/rev/acb763ebef95

These should be part of the next OpenJDK6 source drop. IcedTea6 1.10 should include these fixes.

Note that even with this patch, the fonts listed are not identical. OpenJDK does not support X11 bitmap fonts. There is also a slight naming difference - OpenJDK names the fonts using just the English parts of the font name shown by fc-list.
Comment 6 Nicolas Mailhot 2010-11-16 13:52:23 EST
(In reply to comment #5)
> Support for opentype fonts has been added in OpenJDK6. See commits:
> 
> http://hg.openjdk.java.net/jdk6/jdk6/jdk/rev/b577c70564b8
> http://hg.openjdk.java.net/jdk6/jdk6/jdk/rev/acb763ebef95
> 
> These should be part of the next OpenJDK6 source drop. IcedTea6 1.10 should
> include these fixes.

Thanks!

> Note that even with this patch, the fonts listed are not identical. OpenJDK
> does not support X11 bitmap fonts.

That's a feature

> There is also a slight naming difference -
> OpenJDK names the fonts using just the English parts of the font name shown by
> fc-list.

This part won't work. Not all fonts have English names (it can be trivially be checked by running repo-font-audit from fontpackages-tools on a Fedora, RHEL or Centos repository, this is one of its checks)
Comment 7 Omair Majid 2010-11-16 15:55:28 EST
(In reply to comment #6)
> (In reply to comment #5)
> > Note that even with this patch, the fonts listed are not identical. OpenJDK
> > does not support X11 bitmap fonts.
> 
> That's a feature
> 

Heh. :)

> > There is also a slight naming difference -
> > OpenJDK names the fonts using just the English parts of the font name shown by
> > fc-list.
> 
> This part won't work. Not all fonts have English names (it can be trivially be
> checked by running repo-font-audit from fontpackages-tools on a Fedora, RHEL or
> Centos repository, this is one of its checks)

Hm.. So I downloaded all packages in the group Font and ran this tool against a new repo containing those packages. I still have no clue what I am looking for :/
Comment 8 Nicolas Mailhot 2010-11-17 02:16:03 EST
See the last part of 
http://www.redhat.com/archives/fedora-fonts-list/2009-June/msg00001.html

for example (this is an *old* repo-font-audit report, many font packages have been added since)
Comment 9 Omair Majid 2010-11-19 09:51:33 EST
(In reply to comment #8)
> See the last part of 
> http://www.redhat.com/archives/fedora-fonts-list/2009-June/msg00001.html
> 
> for example (this is an *old* repo-font-audit report, many font packages have
> been added since)

Are you talking about "packages with localized metadata but no English variant" section? I tried out installing sazanami-gothic-fonts (which my local repo-font-audio report also pointed out) and fc-list shows "Sazanami Gothic,さざなみゴシック" (it still has an english name).
Comment 10 Omair Majid 2010-11-19 09:54:24 EST
Update: I just installed every single fedora (13) font package. 'fc-list : family' does not show me any fonts without an English name. I must be missing something.
Comment 11 Nicolas Mailhot 2010-11-19 13:53:58 EST
fc-list :family is a summary. To really see what's in a font file you need to use fc-query

$ fc-query /usr/share/fonts/sazanami/gothic/sazanami-gothic.ttf
Pattern has 20 elts (size 32)
        family: "Sazanami Gothic"(s) "さざなみゴシック"(s)
        familylang: "ar"(s) "ja"(s)

So sazanami does not have an English name, it has an Arabic and Japanese name

$ fc-query /usr/share/fonts/gfs-theokritos/GFSTheokritos.otf
Pattern has 19 elts (size 32)
        family: "GFS Theokritos"(s)
        familylang: "el"(s)

And this one only declares a Greek name

It's pure luck than in both cases the non-English name was filled with an English string, you can't rely on it for a general-purpose java engine

Also when you filter the names declared by fonts, that means all the CSS-y dialects people use nowadays can fail (because they can reference one of the names you've filtered out).

IIRC there have been efforts to expose the Postscript font name in fontconfig recently in addition to the TrueType one, because some pdf generators are fond of using this font name in their font references, so software that filters those names out can not display the resulting files correctly.
Comment 12 Omair Majid 2010-11-22 18:21:57 EST
(In reply to comment #11)
> fc-list :family is a summary. To really see what's in a font file you need to
> use fc-query
> 
> $ fc-query /usr/share/fonts/sazanami/gothic/sazanami-gothic.ttf
> Pattern has 20 elts (size 32)
>         family: "Sazanami Gothic"(s) "さざなみゴシック"(s)
>         familylang: "ar"(s) "ja"(s)
> 
> So sazanami does not have an English name, it has an Arabic and Japanese name
> 
> $ fc-query /usr/share/fonts/gfs-theokritos/GFSTheokritos.otf
> Pattern has 19 elts (size 32)
>         family: "GFS Theokritos"(s)
>         familylang: "el"(s)
> 
> And this one only declares a Greek name
> 
> It's pure luck than in both cases the non-English name was filled with an
> English string, you can't rely on it for a general-purpose java engine
> 

Ah, thanks for the explanation. I dug into the OpenJDK source code to find that Java picks one name for every font. The name is either the the last english name in the font file or (if there is no english name) the first non-english name. So Java should not have problems handing the actual fonts, but it may not associate the right localized name with the font (based on your localization settings).
Comment 13 Fedora Update System 2011-01-18 11:17:10 EST
java-1.6.0-openjdk-1.6.0.0-48.1.8.4.fc13 has been submitted as an update for Fedora 13.
https://admin.fedoraproject.org/updates/java-1.6.0-openjdk-1.6.0.0-48.1.8.4.fc13
Comment 14 Fedora Update System 2011-01-18 11:25:43 EST
java-1.6.0-openjdk-1.6.0.0-50.1.9.4.fc14 has been submitted as an update for Fedora 14.
https://admin.fedoraproject.org/updates/java-1.6.0-openjdk-1.6.0.0-50.1.9.4.fc14
Comment 15 Fedora Update System 2011-01-18 11:27:21 EST
java-1.6.0-openjdk-1.6.0.0-48.1.8.4.fc13 has been submitted as an update for Fedora 13.
https://admin.fedoraproject.org/updates/java-1.6.0-openjdk-1.6.0.0-48.1.8.4.fc13
Comment 16 Fedora Update System 2011-01-18 16:29:43 EST
java-1.6.0-openjdk-1.6.0.0-48.1.8.4.fc13 has been pushed to the Fedora 13 testing repository.  If problems still persist, please make note of it in this bug report.
 If you want to test the update, you can install it with 
 su -c 'yum --enablerepo=updates-testing update java-1.6.0-openjdk'.  You can provide feedback for this update here: https://admin.fedoraproject.org/updates/java-1.6.0-openjdk-1.6.0.0-48.1.8.4.fc13
Comment 17 Fedora Update System 2011-01-19 16:05:36 EST
java-1.6.0-openjdk-1.6.0.0-50.1.9.4.fc14 has been pushed to the Fedora 14 stable repository.  If problems still persist, please make note of it in this bug report.
Comment 18 Fedora Update System 2011-01-19 16:09:18 EST
java-1.6.0-openjdk-1.6.0.0-48.1.8.4.fc13 has been pushed to the Fedora 13 stable repository.  If problems still persist, please make note of it in this bug report.

Note You need to log in before you can comment on or make changes to this bug.