Home | History | Annotate | Download | only in graphics

Lines Matching refs:typeface

25  * The Typeface class specifies the typeface and intrinsic style of a font.
30 public class Typeface {
32 /** The default NORMAL typeface object */
33 public static final Typeface DEFAULT;
35 * The default BOLD typeface object. Note: this may be not actually be
39 public static final Typeface DEFAULT_BOLD;
40 /** The NORMAL style of the default sans serif typeface. */
41 public static final Typeface SANS_SERIF;
42 /** The NORMAL style of the default serif typeface. */
43 public static final Typeface SERIF;
44 /** The NORMAL style of the default monospace typeface. */
45 public static final Typeface MONOSPACE;
47 static Typeface[] sDefaults;
48 private static final SparseArray<SparseArray<Typeface>> sTypefaceCache =
49 new SparseArray<SparseArray<Typeface>>(3);
61 /** Returns the typeface's intrinsic style attributes */
77 * Create a typeface object given a family name, and option style information.
79 * The resulting typeface object can be queried (getStyle()) to discover what
83 * @param style The style (normal, bold, italic) of the typeface.
85 * @return The best matching typeface.
87 public static Typeface create(String familyName, int style) {
88 return new Typeface(nativeCreate(familyName, style));
92 * Create a typeface object that best matches the specified existing
93 * typeface and the specified Style. Use this call if you want to pick a new
94 * style from the same family of an existing typeface object. If family is
98 * @param style The style (normal, bold, italic) of the typeface.
100 * @return The best matching typeface.
102 public static Typeface create(Typeface family, int style) {
113 Typeface typeface;
114 SparseArray<Typeface> styles = sTypefaceCache.get(ni);
117 typeface = styles.get(style);
118 if (typeface != null) {
119 return typeface;
123 typeface = new Typeface(nativeCreateFromTypeface(ni, style));
125 styles = new SparseArray<Typeface>(4);
128 styles.put(style, typeface);
130 return typeface;
134 * Returns one of the default typeface objects, based on the specified style
136 * @return the default typeface that corresponds to the style
138 public static Typeface defaultFromStyle(int style) {
143 * Create a new typeface from the specified font data.
146 * @return The new typeface.
148 public static Typeface createFromAsset(AssetManager mgr, String path) {
149 return new Typeface(nativeCreateFromAsset(mgr, path));
153 * Create a new typeface from the specified font file.
156 * @return The new typeface.
158 public static Typeface createFromFile(File path) {
159 return new Typeface(nativeCreateFromFile(path.getAbsolutePath()));
163 * Create a new typeface from the specified font file.
166 * @return The new typeface.
168 public static Typeface createFromFile(String path) {
169 return new Typeface(nativeCreateFromFile(path));
173 private Typeface(int ni) {
175 throw new RuntimeException("native typeface cannot be made");
184 DEFAULT_BOLD = create((String) null, Typeface.BOLD);
189 sDefaults = new Typeface[] {
192 create((String) null, Typeface.ITALIC),
193 create((String) null, Typeface.BOLD_ITALIC),
210 Typeface typeface = (Typeface) o;
212 return mStyle == typeface.mStyle && native_instance == typeface.native_instance;