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

[macos] Font.canDisplayUpTo always returns -1 on mac OS X

XMLWordPrintable

    • 2d
    • x86
    • os_x

      ADDITIONAL SYSTEM INFORMATION :
      Mac OS 10.14.4

      A DESCRIPTION OF THE PROBLEM :
      Font.canDisplayUpTo method always returns -1 on Mac OS X even if the font doesn't contain necessary glyphs to display the string.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Mac OS includes Herculanum system font which doesn't support cyrillic characters. Execute the following function:

      System.out.println(new Font("Herculanum", Font.PLAIN, 12).canDisplayUpTo("тест"));

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      The code prints "0" since "Herculanum" font doesn't support Cyrillic characters
      ACTUAL -
      The method returns -1 as if all characters are supported

      ---------- BEGIN SOURCE ----------
      System.out.println(new Font("Herculanum", Font.PLAIN, 12).canDisplayUpTo("тест"));
      ---------- END SOURCE ----------

      FREQUENCY : always


            prr Philip Race
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: