0N/A/*
2362N/A * Copyright (c) 2003, 2008, Oracle and/or its affiliates. All rights reserved.
0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0N/A *
0N/A * This code is free software; you can redistribute it and/or modify it
0N/A * under the terms of the GNU General Public License version 2 only, as
2362N/A * published by the Free Software Foundation. Oracle designates this
0N/A * particular file as subject to the "Classpath" exception as provided
2362N/A * by Oracle in the LICENSE file that accompanied this code.
0N/A *
0N/A * This code is distributed in the hope that it will be useful, but WITHOUT
0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0N/A * version 2 for more details (a copy is included in the LICENSE file that
0N/A * accompanied this code).
0N/A *
0N/A * You should have received a copy of the GNU General Public License version
0N/A * 2 along with this work; if not, write to the Free Software Foundation,
0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0N/A *
2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2362N/A * or visit www.oracle.com if you need additional information or have any
2362N/A * questions.
0N/A */
0N/Apackage sun.font;
0N/A
0N/Aimport java.awt.Font;
0N/Aimport java.awt.FontFormatException;
0N/Aimport java.io.File;
0N/Aimport java.util.Locale;
0N/Aimport java.util.TreeMap;
1686N/A
0N/Aimport javax.swing.plaf.FontUIResource;
0N/A
1686N/A/**
0N/A * Interface between Java Fonts (java.awt.Font) and the underlying
0N/A * font files/native font resources and the Java and native font scalers.
0N/A */
1686N/Apublic interface FontManager {
0N/A
1686N/A // These constants are used in findFont().
1686N/A public static final int NO_FALLBACK = 0;
1686N/A public static final int PHYSICAL_FALLBACK = 1;
1686N/A public static final int LOGICAL_FALLBACK = 2;
0N/A
0N/A /**
1686N/A * Register a new font. Please, note that {@code null} is not a valid
1686N/A * argument, and it's caller's responsibility to ensure that, but to keep
1686N/A * compatibility, if {@code null} is passed as an argument, {@code false}
1686N/A * is returned, and no {@link NullPointerException}
1686N/A * is thrown.
0N/A *
1686N/A * As additional note, an implementation should ensure that this font
1686N/A * cannot override existing installed fonts.
0N/A *
1686N/A * @param font
1686N/A * @return {@code true} is the font is successfully registered,
1686N/A * {@code false} otherwise.
0N/A */
1686N/A public boolean registerFont(Font font);
0N/A
1686N/A public void deRegisterBadFont(Font2D font2D);
0N/A
0N/A /**
0N/A * The client supplies a name and a style.
0N/A * The name could be a family name, or a full name.
0N/A * A font may exist with the specified style, or it may
0N/A * exist only in some other style. For non-native fonts the scaler
0N/A * may be able to emulate the required style.
0N/A */
1686N/A public Font2D findFont2D(String name, int style, int fallback);
0N/A
1686N/A /**
1686N/A * Creates a Font2D for the specified font file, that is expected
1686N/A * to be in the specified font format (according to the constants
1686N/A * in java.awt.Font). The parameter {@code isCopy} is set to true
1686N/A * when the specified font file is actually a copy of the font data
1686N/A * and needs to be deleted afterwards. This method is called
1686N/A * for the Font.createFont() methods.
1686N/A *
1686N/A * @param fontFile the file holding the font data
1686N/A * @param fontFormat the expected font format
1686N/A * @param isCopy {@code true} if the file is a copy and needs to be
1686N/A * deleted, {@code false} otherwise
1686N/A *
1686N/A * @return the created Font2D instance
1686N/A */
1686N/A public Font2D createFont2D(File fontFile, int fontFormat,
1686N/A boolean isCopy, CreatedFontTracker tracker)
1686N/A throws FontFormatException;
0N/A
1686N/A /**
0N/A * If usingPerAppContextComposites is true, we are in "applet"
0N/A * (eg browser) enviroment and at least one context has selected
0N/A * an alternate composite font behaviour.
0N/A */
1686N/A public boolean usingPerAppContextComposites();
0N/A
1686N/A /**
1686N/A * Creates a derived composite font from the specified font (handle).
1686N/A *
1686N/A * @param family the font family of the derived font
1686N/A * @param style the font style of the derived font
1686N/A * @param handle the original font (handle)
1686N/A *
1686N/A * @return the handle for the derived font
0N/A */
1686N/A public Font2DHandle getNewComposite(String family, int style,
1686N/A Font2DHandle handle);
0N/A
0N/A /**
1686N/A * Indicates a preference for locale-specific fonts in the mapping of
1686N/A * logical fonts to physical fonts. Calling this method indicates that font
1686N/A * rendering should primarily use fonts specific to the primary writing
1686N/A * system (the one indicated by the default encoding and the initial
1686N/A * default locale). For example, if the primary writing system is
1686N/A * Japanese, then characters should be rendered using a Japanese font
1686N/A * if possible, and other fonts should only be used for characters for
1686N/A * which the Japanese font doesn't have glyphs.
1686N/A * <p>
1686N/A * The actual change in font rendering behavior resulting from a call
1686N/A * to this method is implementation dependent; it may have no effect at
1686N/A * all, or the requested behavior may already match the default behavior.
1686N/A * The behavior may differ between font rendering in lightweight
1686N/A * and peered components. Since calling this method requests a
1686N/A * different font, clients should expect different metrics, and may need
1686N/A * to recalculate window sizes and layout. Therefore this method should
1686N/A * be called before user interface initialisation.
1686N/A *
1686N/A * @see #preferProportionalFonts()
1686N/A * @since 1.5
0N/A */
1686N/A public void preferLocaleFonts();
0N/A
0N/A /**
1686N/A * preferLocaleFonts() and preferProportionalFonts() are called to inform
1686N/A * that the application could be using an alternate set of composite
1686N/A * fonts, and so the implementation should try to create a CompositeFonts
1686N/A * with this directive in mind.
1686N/A *
1686N/A * @see #preferLocaleFonts()
0N/A */
1686N/A public void preferProportionalFonts();
0N/A
0N/A}