author | adinn |
Fri, 26 Jan 2018 16:38:21 +0000 | |
changeset 48682 | 34e45260c040 |
parent 47216 | 71c04702a3d5 |
child 53793 | 9bb638b282bc |
permissions | -rw-r--r-- |
2 | 1 |
/* |
16734
da1901d79073
8000406: change files using @GenerateNativeHeader to use @Native
dxu
parents:
12317
diff
changeset
|
2 |
* Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. |
2 | 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 |
|
5506 | 7 |
* published by the Free Software Foundation. Oracle designates this |
2 | 8 |
* particular file as subject to the "Classpath" exception as provided |
5506 | 9 |
* by Oracle in the LICENSE file that accompanied this code. |
2 | 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 |
* |
|
5506 | 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. |
|
2 | 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; |
|
3928 | 32 |
|
2 | 33 |
import javax.swing.plaf.FontUIResource; |
34 |
||
12317
9670c1610c53
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
5506
diff
changeset
|
35 |
|
3928 | 36 |
/** |
2 | 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 |
*/ |
|
3928 | 40 |
public interface FontManager { |
2 | 41 |
|
3928 | 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; |
|
2 | 46 |
|
47 |
/** |
|
3928 | 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. |
|
2 | 53 |
* |
3928 | 54 |
* As additional note, an implementation should ensure that this font |
55 |
* cannot override existing installed fonts. |
|
2 | 56 |
* |
3928 | 57 |
* @param font |
58 |
* @return {@code true} is the font is successfully registered, |
|
59 |
* {@code false} otherwise. |
|
2 | 60 |
*/ |
3928 | 61 |
public boolean registerFont(Font font); |
2 | 62 |
|
3928 | 63 |
public void deRegisterBadFont(Font2D font2D); |
2 | 64 |
|
65 |
/** |
|
66 |
* The client supplies a name and a style. |
|
67 |
* The name could be a family name, or a full name. |
|
68 |
* A font may exist with the specified style, or it may |
|
69 |
* exist only in some other style. For non-native fonts the scaler |
|
70 |
* may be able to emulate the required style. |
|
71 |
*/ |
|
3928 | 72 |
public Font2D findFont2D(String name, int style, int fallback); |
2 | 73 |
|
3928 | 74 |
/** |
75 |
* Creates a Font2D for the specified font file, that is expected |
|
76 |
* to be in the specified font format (according to the constants |
|
77 |
* in java.awt.Font). The parameter {@code isCopy} is set to true |
|
78 |
* when the specified font file is actually a copy of the font data |
|
79 |
* and needs to be deleted afterwards. This method is called |
|
80 |
* for the Font.createFont() methods. |
|
81 |
* |
|
82 |
* @param fontFile the file holding the font data |
|
83 |
* @param fontFormat the expected font format |
|
36899
e766024a0873
8055463: Need public API allowing full access to font collections in Font.createFont()
prr
parents:
25859
diff
changeset
|
84 |
* @param all whether to retrieve all fonts in the resource or |
e766024a0873
8055463: Need public API allowing full access to font collections in Font.createFont()
prr
parents:
25859
diff
changeset
|
85 |
* just the first one. |
3928 | 86 |
* @param isCopy {@code true} if the file is a copy and needs to be |
87 |
* deleted, {@code false} otherwise |
|
88 |
* |
|
89 |
* @return the created Font2D instance |
|
90 |
*/ |
|
36899
e766024a0873
8055463: Need public API allowing full access to font collections in Font.createFont()
prr
parents:
25859
diff
changeset
|
91 |
public Font2D[] createFont2D(File fontFile, int fontFormat, boolean all, |
e766024a0873
8055463: Need public API allowing full access to font collections in Font.createFont()
prr
parents:
25859
diff
changeset
|
92 |
boolean isCopy, CreatedFontTracker tracker) |
3928 | 93 |
throws FontFormatException; |
2 | 94 |
|
3928 | 95 |
/** |
2 | 96 |
* If usingPerAppContextComposites is true, we are in "applet" |
21278 | 97 |
* (eg browser) environment and at least one context has selected |
2 | 98 |
* an alternate composite font behaviour. |
99 |
*/ |
|
3928 | 100 |
public boolean usingPerAppContextComposites(); |
2 | 101 |
|
3928 | 102 |
/** |
103 |
* Creates a derived composite font from the specified font (handle). |
|
104 |
* |
|
105 |
* @param family the font family of the derived font |
|
106 |
* @param style the font style of the derived font |
|
107 |
* @param handle the original font (handle) |
|
108 |
* |
|
109 |
* @return the handle for the derived font |
|
2 | 110 |
*/ |
3928 | 111 |
public Font2DHandle getNewComposite(String family, int style, |
112 |
Font2DHandle handle); |
|
2 | 113 |
|
114 |
/** |
|
3928 | 115 |
* Indicates a preference for locale-specific fonts in the mapping of |
116 |
* logical fonts to physical fonts. Calling this method indicates that font |
|
117 |
* rendering should primarily use fonts specific to the primary writing |
|
118 |
* system (the one indicated by the default encoding and the initial |
|
119 |
* default locale). For example, if the primary writing system is |
|
120 |
* Japanese, then characters should be rendered using a Japanese font |
|
121 |
* if possible, and other fonts should only be used for characters for |
|
122 |
* which the Japanese font doesn't have glyphs. |
|
123 |
* <p> |
|
124 |
* The actual change in font rendering behavior resulting from a call |
|
125 |
* to this method is implementation dependent; it may have no effect at |
|
126 |
* all, or the requested behavior may already match the default behavior. |
|
127 |
* The behavior may differ between font rendering in lightweight |
|
128 |
* and peered components. Since calling this method requests a |
|
129 |
* different font, clients should expect different metrics, and may need |
|
130 |
* to recalculate window sizes and layout. Therefore this method should |
|
131 |
* be called before user interface initialisation. |
|
132 |
* |
|
133 |
* @see #preferProportionalFonts() |
|
134 |
* @since 1.5 |
|
2 | 135 |
*/ |
3928 | 136 |
public void preferLocaleFonts(); |
2 | 137 |
|
138 |
/** |
|
3928 | 139 |
* preferLocaleFonts() and preferProportionalFonts() are called to inform |
140 |
* that the application could be using an alternate set of composite |
|
141 |
* fonts, and so the implementation should try to create a CompositeFonts |
|
142 |
* with this directive in mind. |
|
143 |
* |
|
144 |
* @see #preferLocaleFonts() |
|
2 | 145 |
*/ |
3928 | 146 |
public void preferProportionalFonts(); |
2 | 147 |
|
148 |
} |