Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8067487

Selecting fonts based on family and style needs improvement

    Details

    • Type: Enhancement
    • Status: Closed
    • Priority: P4
    • Resolution: Duplicate
    • Affects Version/s: 8u25, 9
    • Fix Version/s: None
    • Component/s: client-libs
    • Labels:
    • CPU:
      x86
    • OS:
      os_x

      Description

      A DESCRIPTION OF THE REQUEST :
      Not sure if this is a bug or an RFE, since the spec for Font(family, style, size) says:

      When a font family name is specified, the style argument is used to select the most appropriate face from the family.

      and clearly there are cases where the selection is not the most appropriate.

      Here are some examples (on OS X):

      American Typewriter:
      AmericanTypewriter
      AmericanTypewriter-Bold
      AmericanTypewriter-Condensed
      AmericanTypewriter-CondensedBold [Bold]
      AmericanTypewriter-CondensedLight [Plain]
      AmericanTypewriter-Light



      Apple SD Gothic Neo:
      AppleSDGothicNeo-Bold
      AppleSDGothicNeo-ExtraBold [Bold]
      AppleSDGothicNeo-Heavy [Plain]
      AppleSDGothicNeo-Light
      AppleSDGothicNeo-Medium
      AppleSDGothicNeo-Regular
      AppleSDGothicNeo-SemiBold
      AppleSDGothicNeo-Thin
      AppleSDGothicNeo-UltraLight


      Avenir:
      Avenir-Black
      Avenir-BlackOblique
      Avenir-Book
      Avenir-BookOblique
      Avenir-Heavy [Plain] [Bold]
      Avenir-HeavyOblique
      Avenir-Light
      Avenir-LightOblique
      Avenir-Medium
      Avenir-MediumOblique
      Avenir-Oblique
      Avenir-Roman


      Avenir Next:
      AvenirNext-Bold [Bold]
      AvenirNext-BoldItalic
      AvenirNext-DemiBold
      AvenirNext-DemiBoldItalic
      AvenirNext-Heavy [Plain]
      AvenirNext-HeavyItalic
      AvenirNext-Italic
      AvenirNext-Medium
      AvenirNext-MediumItalic
      AvenirNext-Regular
      AvenirNext-UltraLight
      AvenirNext-UltraLightItalic


      A couple of obvious observations: Regular should be preferred for PLAIN and a simple Bold should be preferred for BOLD over things like DemiBold, ExtraBold, ...

      JUSTIFICATION :
      The exact set of faces in a family may be system dependent. Applications should get a reasonable font face when they specify a family name or use deriveFont().

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Additional font naming conventions should be recognized and taken into account.
      ACTUAL -
      It seems that any font without a recognized style is considered PLAIN and the choice among those is random. Similarly, when more than one font is recognized as BOLD or ITALIC, the choice among them is random.

      CUSTOMER SUBMITTED WORKAROUND :
      The only practical workaround is to use font face names rather than family names.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                prr Philip Race
                Reporter:
                webbuggrp Webbug Group
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: