< prev index next >

src/java.desktop/share/classes/sun/font/PhysicalFont.java

Print this page




  35 import java.nio.channels.FileChannel;
  36 
  37 public abstract class PhysicalFont extends Font2D {
  38 
  39     protected String platName;
  40     // nativeNames is a String or a (possibly null) String[].
  41     protected Object nativeNames;
  42 
  43     public boolean equals(Object o) {
  44         return (o != null && o.getClass() == this.getClass() &&
  45                 ((Font2D)o).fullName.equals(this.fullName));
  46     }
  47 
  48     public int hashCode() {
  49         return fullName.hashCode();
  50     }
  51 
  52     /**
  53      * Opens the file (temporarily) and does basic verification.
  54      * Initializes the CMAP
  55      * @throws FontFormatException - if the font can't be opened
  56      * or fails verification,  or there's no usable cmap
  57      */
  58     PhysicalFont(String platname, Object nativeNames)
  59         throws FontFormatException {
  60 
  61         handle = new Font2DHandle(this);
  62         this.platName = platname;
  63         this.nativeNames = nativeNames;
  64     }
  65 
  66     protected PhysicalFont() {
  67         handle = new Font2DHandle(this);
  68     }
  69 
  70     /* The following methods are delegated to the font by the strike
  71      * for physical fonts as the PhysicalFont holds a shared reference
  72      * to the native resource, so all invocations need to be directed
  73      * through a synchronization point. Implementations of these methods
  74      * will typically be "synchronized native"
  75      */




  35 import java.nio.channels.FileChannel;
  36 
  37 public abstract class PhysicalFont extends Font2D {
  38 
  39     protected String platName;
  40     // nativeNames is a String or a (possibly null) String[].
  41     protected Object nativeNames;
  42 
  43     public boolean equals(Object o) {
  44         return (o != null && o.getClass() == this.getClass() &&
  45                 ((Font2D)o).fullName.equals(this.fullName));
  46     }
  47 
  48     public int hashCode() {
  49         return fullName.hashCode();
  50     }
  51 
  52     /**
  53      * Opens the file (temporarily) and does basic verification.
  54      * Initializes the CMAP
  55      * @throws FontFormatException if the font can't be opened
  56      * or fails verification,  or there's no usable cmap
  57      */
  58     PhysicalFont(String platname, Object nativeNames)
  59         throws FontFormatException {
  60 
  61         handle = new Font2DHandle(this);
  62         this.platName = platname;
  63         this.nativeNames = nativeNames;
  64     }
  65 
  66     protected PhysicalFont() {
  67         handle = new Font2DHandle(this);
  68     }
  69 
  70     /* The following methods are delegated to the font by the strike
  71      * for physical fonts as the PhysicalFont holds a shared reference
  72      * to the native resource, so all invocations need to be directed
  73      * through a synchronization point. Implementations of these methods
  74      * will typically be "synchronized native"
  75      */


< prev index next >