Uploaded image for project: 'JEMS Installer'
  1. JEMS Installer
  2. JBINSTALL-131

Need to determine font selection methods on multi-os (ie, fontconfig on linux, windows?)


    • Type: Task
    • Status: Closed
    • Priority: Minor
    • Resolution: Done
    • Affects Version/s: None
    • Fix Version/s: 1.3.1.GA (i18N Media Kit)
    • Component/s: Core
    • Labels:


      this is just a research task. need to determine how swing selects default font.

      forward this info to llim@redhat.com

      Java uses 5 logical fonts, which are supposed to be universal and equal
      on each OS (but they are not). On each OS these logical fonts
      correspond to particular "physical" (or native, or actual) fonts. This
      is how they are defined by default for Windows (western
      fonts only):

      Logical Font Corresponding Actual Font
      Dialog Arial(for older JREs) or Lucida Sans (for JRE 1.4 and

      DialogInput Courier New (comes with Windows)
      Monospaced Courier New (comes with Windows)
      SansSerif Lucida Sans (comes with JRE)
      Serif Times New Roman (comes with Windows)

      *JRockit has different mappings, but similar.

      How each logical font maps to an actual font is OS-specific and is
      defined in the $JAVA_HOME\jre\lib folder (all
      fontconfig files describe the default fonts for the different supported
      OSes and languages). In JRE 1.4 fontconfig.properties
      describes all fonts for the current OS, and in JRE 1.5 java relies on
      the file fontconfig.properties.src. In Linux the
      java GUI manager will reference the default X Windows fonts if the
      "default look and feel" option is enabled in the java awt/swing

      Whenever the JVM fails to find a font defined with the configuration
      files in it's own font directories (happens commonly on linux with the
      asian fonts) - it looks for a folder named
      $JAVA_HOME\jre\lib\fonts\fallback and check to see if any of the missing
      fonts are there. Many east-asian java linux users already know about
      this bug and have configured their systems either
      by changing the fontconfig files or by creating the fallback folder.
      Generally the fallback folder solution is
      prefferred, because it doesn't override the original settings if they

      I tried the fallback folder solution on Fedora 6 with JVM 1.5 and 1.4.
      In order the japanese text to render correctly the
      following lines have to be executed:

      1. cd /usr/java/jre1.5/lib/fonts
      2. mkdir fallback
      3. cd fallback
      4. ln -s /usr/share/fonts/japanese/TrueType/sazanami-gothic.ttf
      5. ln -s /usr/share/fonts/japanese/TrueType/sazanami-mincho.ttf

      for chinese:

      1. cd /usr/java/jre1.5/lib/fonts
      2. mkdir fallback
      3. cd fallback
      4. ln -s /usr/share/fonts/japanese/TrueType/ukai.ttf
      5. ln -s /usr/share/fonts/japanese/TrueType/uming.ttf

      and similarly for each other east-asian language.. (before proceeding
      make sure you have the fonts installed from the
      fonts* rpms). It will also work with JVM 1.6.

      In order to determine the actual font on other operating systems the
      JVMs chooses from a large set of fonts, which is
      hard to keep track on. Common for english in Linux are B&H Lucida,
      lucidatypewriter, Luxi and the Windows analogs
      (lucida, arial).

      The default fonts you are seeing in the Java applications belong to a
      certain Java UI component (button, label,
      textarea, etc..). Each java UI component has it's own pre-defined
      default font - it is one of the logical fonts and
      which one exactly depends on the GUI manager in Java (this is why in
      linux you can see some of the GUI
      componentes rendering correctly east-asian characters and other do not).

        Gliffy Diagrams




              • Assignee:
                vralev Vladimir Ralev
                alex.pinkin Alex Pinkin (Inactive)
              • Votes:
                0 Vote for this issue
                1 Start watching this issue


                • Created: