src/share/classes/sun/font/FontManager.java

Print this page


   1 /*
   2  * Copyright (c) 2003, 2008, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 package sun.font;
  26 
  27 import java.awt.Font;
  28 import java.awt.FontFormatException;
  29 import java.io.File;
  30 import java.util.Locale;
  31 import java.util.TreeMap;
  32 
  33 import javax.swing.plaf.FontUIResource;
  34 
  35 import javax.tools.annotation.GenerateNativeHeader;
  36 
  37 /**
  38  * Interface between Java Fonts (java.awt.Font) and the underlying
  39  * font files/native font resources and the Java and native font scalers.
  40  */
  41 /* No native methods here, but the constants are needed in the supporting JNI code */
  42 @GenerateNativeHeader
  43 public interface FontManager {
  44 
  45     // These constants are used in findFont().
  46     public static final int NO_FALLBACK = 0;
  47     public static final int PHYSICAL_FALLBACK = 1;
  48     public static final int LOGICAL_FALLBACK = 2;
  49 
  50     /**
  51      * Register a new font. Please, note that {@code null} is not a valid
  52      * argument, and it's caller's responsibility to ensure that, but to keep
  53      * compatibility, if {@code null} is passed as an argument, {@code false}
  54      * is returned, and no {@link NullPointerException}
  55      * is thrown.
  56      *
  57      * As additional note, an implementation should ensure that this font
  58      * cannot override existing installed fonts.
  59      *
  60      * @param font
  61      * @return {@code true} is the font is successfully registered,
  62      * {@code false} otherwise.


   1 /*
   2  * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 package sun.font;
  26 
  27 import java.awt.Font;
  28 import java.awt.FontFormatException;
  29 import java.io.File;
  30 import java.util.Locale;
  31 import java.util.TreeMap;
  32 
  33 import javax.swing.plaf.FontUIResource;
  34 

  35 
  36 /**
  37  * Interface between Java Fonts (java.awt.Font) and the underlying
  38  * font files/native font resources and the Java and native font scalers.
  39  */


  40 public interface FontManager {
  41 
  42     // These constants are used in findFont().
  43     public static final int NO_FALLBACK = 0;
  44     public static final int PHYSICAL_FALLBACK = 1;
  45     public static final int LOGICAL_FALLBACK = 2;
  46 
  47     /**
  48      * Register a new font. Please, note that {@code null} is not a valid
  49      * argument, and it's caller's responsibility to ensure that, but to keep
  50      * compatibility, if {@code null} is passed as an argument, {@code false}
  51      * is returned, and no {@link NullPointerException}
  52      * is thrown.
  53      *
  54      * As additional note, an implementation should ensure that this font
  55      * cannot override existing installed fonts.
  56      *
  57      * @param font
  58      * @return {@code true} is the font is successfully registered,
  59      * {@code false} otherwise.