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

java.awt.GraphicsEnvironment getAvailableFontFamilyNames & getAllFonts inconsist

XMLWordPrintable

    • 2d
    • b28
    • sparc
    • solaris_2.6
    • Verified



      Name: sdR10048 Date: 10/10/2003


      Filed By : SPB JCK team (###@###.###)
      JDK : java full version "1.5.0-beta-b22"
      JCK : 1.5
      Platform[s] : Solaris
      switch/Mode :
      JCK test owner : http://javaweb.eng/jct/sqe/JCK-tck/usr/owners.jto
      Failing Test [s] :
      api/java_awt/GraphicsEnvironment/index.html#GetAFFamilyNames[GraphicsEnvironment2004_15]


      Specification excerpt:
      ======================
      --------- J2SE API spec v.1.5 ---------
      ...
      public abstract Font[] getAllFonts()
      Returns an array containing a one-point size instance of all fonts available in
      this GraphicsEnvironment. Typical usage would be to allow a user to select a
       particular font. Then, the application can size the font and set various font
       attributes by calling the deriveFont method on the choosen instance.

      This method provides for the application the most precise control over which
      Font instance is used to render text. If a font in this GraphicsEnvironment has
       multiple programmable variations, only one instance of that Font is returned in
       the array, and other variations must be derived by the application.

      If a font in this environment has multiple programmable variations, such as
      Multiple-Master fonts, only one instance of that font is returned in the Font
      array. The other variations must be derived by the application.

      Returns:
      an array of Font objects

      ===

      public abstract String[] getAvailableFontFamilyNames(Locale l)
      Returns an array containing the names of all font families in this GraphicsEnvironment localized for the specified locale.

      Typical usage would be for presentation to a user for selection of a particular
      family name. An application can then specify this name when creating a font,
      in conjunction with a style, such as bold or italic, giving the font system
      flexibility in choosing its own best match among multiple fonts in the same
      font family.

      Parameters:
      l - a Locale object that represents a particular geographical, political, or
       cultural region. Specifying null is equivalent to specifying
       Locale.getDefault().
      Returns:
      an array of String containing font family names localized for the specified
      Locale, or a suitable alternative name if no name exists for the specified
      locale.

      ...
      ---------- end-of-excerpt ---------------

      Problem description
      ===================
      The output results of these two methods are inconsistent.
      On some platforms (actually on Solaris, see sysinfo output)
      getAvailableFontFamilyNames(Locale) can return an array
      with the font-family-name inside which is the family name of no one
      font available on the GraphicsEnvironment (mean getAllFonts).
      See demo.
          
      Minimized test:
      ===============
      ------- T2.java -------
      import java.awt.*;
      import java.util.*;

      public class T2 {
          public static void main(String[] args) {

              GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();

              Font[] all_fonts = ge.getAllFonts();

              HashSet all_families = new HashSet();
              for (int i=0; i<all_fonts.length; i++) {
                  all_families.add(all_fonts[i].getFamily());
              }

              Locale[] all_locales = Locale.getAvailableLocales();

              for (int i=0; i<all_locales.length; i++) {
                  String[] families_for_locale = ge.getAvailableFontFamilyNames(all_locales[i]);
                  for (int j=0; j<families_for_locale.length; j++) {
                      if ( !all_families.contains(families_for_locale[j]) ) {
                          System.out.println("LOCALE: [" + all_locales[i]+"]");
                          System.out.println("NO FONT HAS " +
                                             "THE FOLLOWING FAMILY NAME:");
                          System.out.println("["+families_for_locale[j]+"]");
                          return;
                      }
                  }
              }
          }
      }

      ------- end-of-T2.java -------

      Minimized test output:
      ======================
      LOCALE: [ar]
      NO FONT HAS THE FOLLOWING FAMILY NAME:
      [LucidaSansTypewriter]

      Sysinfo output (excerpt):
      ======================


      G E N E R A L I N F O R M A T I O N

      Host Name is archer
      Host Aliases is loghost
      Host Address(es) is 192.168.205.237
      Host ID is 80b66e6e
      Serial Number is 2159439470
      Manufacturer is Sun (Sun Microsystems)
      System Model is Enterprise 450 Model 4300
      Main Memory is 1024 MB
      Virtual Memory is 2.6 GB
      ROM Version is OBP 3.14.1 1999/02/12 07:50
      Number of CPUs is 4
      CPU Type is sparcv9+vis
      App Architecture is sparc
      Kernel Architecture is sun4u
      OS Name is SunOS
      OS Version is 5.8
      OS Distribution is Solaris 8 6/00 s28s_u1wos_08 SPARC
      Kernel Version is SunOS Release 5.8 Version Generic_108528-22 64-bit [UNIX(R) System V Release 4.0]
      Boot Time is Wed Sep 17 14:04:16 2003


      K E R N E L I N F O R M A T I O N

      Maximum number of processes for system is 15818
      Maximum number of processes per user is 15813
      Maximum number of users (for system tables) is 988
      Maximum number of BSD (/dev/ptyXX) pty's is 48
      Size of the virtual address cache is 16384
      Size of the callout table is 539
      Size of the inode table is 67544
      Size of the directory name lookup cache is 67544
      STREAMS: Maximum number of pushes allowed is 9
      Maximum global priority in sys class is 64
      Has UFS driver is TRUE
      Has NFS driver is TRUE
      Has LOFS driver is TRUE
      Has TMPFS driver is TRUE
      Has SD driver is TRUE
      Has FD driver is TRUE
      Has NFSSERVER is TRUE
      Has IPCSEMAPHORE is TRUE
      Has IPCSHMEM is TRUE


      S Y S C O N F I N F O R M A T I O N

      Max combined size of argv[] and envp[] is 2096640
      Max processes allowed to any UID is 15813
      Clock ticks per second is 100
      Max simultaneous groups per user is 16
      Max open files per process is 256
      System memory page size is 8192
      Job control supported is TRUE
      Savid ids (seteuid()) supported is TRUE
      Version of POSIX.1 standard supported is 199506
      Version of the X/Open standard supported is 3
      Max log name is 8
      Max password length is 8
      Number of processors (CPUs) configured is 4
      Number of processors (CPUs) online is 4
      Total number of pages of physical memory is 131072
      Number of pages of physical memory not currently in use is 17697
      Max number of I/O operations in single list I/O call is 4096
      Max amount a process can decrease its async I/O priority level is 0
      Max number of timer expiration overruns is 2147483647
      Max number of open message queue descriptors per process is 32
      Max number of message priorities supported is 32
      Max number of realtime signals is 8
      Max number of semaphores per process is 2147483647
      Max value a semaphore may have is 2147483647
      Max number of queued signals per process is 32
      Max number of timers per process is 32
      Supports asyncronous I/O is TRUE
      Supports File Synchronization is TRUE
      Supports memory mapped files is TRUE
      Supports process memory locking is TRUE
      Supports range memory locking is TRUE
      Supports memory protection is TRUE
      Supports message passing is TRUE
      Supports process scheduling is TRUE
      Supports realtime signals is TRUE
      Supports semaphores is TRUE
      Supports shared memory objects is TRUE
      Supports syncronized I/O is TRUE
      Supports timers is TRUE
      Supports C language binding option is TRUE
      Supports C language development utilities is TRUE
      Version of ISO POSIX-2 standard (Commands) is 199209
      Supports creation of locales by localedef is TRUE
      Supports Software Development Utitility is TRUE
      Supports User Portability Utilities is TRUE
      Version of ISO POSIX-2 standard (C Language binding) is 199209
      Maximum obase values allowed by bc is 99
      Maximum number of elements in array in bc is 2048
      Maximum scale value in bc is 99
      Maximum string constant in bc is 1000
      Maximum weights for LC_COLLATE is 10
      Maximum expressionss in expr is 32
      Maximum length of input line is 2048
      Maximum repeated _SC_REALTIME_SIGNALS is 255
      Supports X/Open Encryption Features is TRUE
      Supports X/Open Enhanced Internationalization Features is TRUE
      Supports X/Open Shared Memory Features is TRUE
      Supports Character Terminals is TRUE
      Version of supported XCU is 4
      Maximum functions in atexit() is 32
      Maximum iovec structures for readv()/writev() is 16
      Supports X/Open CAE 8/1994 is TRUE
      Maximum pid value is 30000
      Default stack protection is 3
      Max size of group entry buffer is 10496
      Max size of password entry buffer is 1024
      Max login name is 9
      Max TTY name is 128
      Supports POSIX Threads is TRUE
      Supports Thread Stack Address Attriutes is TRUE
      Supports Thread Stack Size Attribute is TRUE
      Supports Thread Priority Scheduling is TRUE
      Supports Thread Priority Inherit is TRUE
      Supports Thread Priority Protection is TRUE
      Supports Thread Process Sharing is TRUE
      Supports Thread Safe Functions is TRUE
      Supports X/Open Legacy Feature Group is TRUE
      Supports X/Open POSIX Realtime Feature Group is TRUE
      Supports X/Open POSIX Realtime Threads Feature Group is TRUE
      Supports X/Open ILP32 w/32-bit offset is TRUE
      Supports X/Open LP32 w/64-bit offset is TRUE
      Supports X/Open LP64, 64-bit offset is TRUE
      Supports X/Open LP64, 64-bit offset is TRUE


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

            prr Philip Race
            dsvsunw Dsv Dsv (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: