source: trunk/src/org/expeditee/gio/FontManager.java@ 1097

Last change on this file since 1097 was 1097, checked in by davidb, 6 years ago

Newly structured files from Corey's work on logic/graphics separation

File size: 1.8 KB
Line 
1package org.expeditee.gio;
2
3import java.io.File;
4
5import org.expeditee.core.Font;
6
7/**
8 * Class for managing font references in Expeditee. Expeditee's Font class is an
9 * opaque handle that is translated to an internal representation when used by
10 * other managers. The internal representation used for a given Font handle is
11 * implementation-specific (i.e. if an exact match for the font handle is not registered
12 * with the manager, the alternative selected is undefined).
13 *
14 * TTF font files can be registered with the manager to increase the range of internal
15 * fonts available, and a collection of handles to all of the fonts the manager supports
16 * can be requested.
17 *
18 * @author cts16
19 */
20public abstract class FontManager {
21
22 /** The default font registered with the manager. */
23 private Font _defaultFont = new Font();
24
25 /** Returns the default font registered with the manager. */
26 public final Font getDefaultFont()
27 {
28 return _defaultFont;
29 }
30
31 /** Sets the default font for the font manager. */
32 public final void setDefaultFont(final Font font)
33 {
34 _defaultFont = font;
35 }
36
37 /** Registers a font file with the font manager, and returns the handle
38 to the newly registered font. */
39 public abstract Font registerFontFile(File fontFile);
40
41 /** Gets an array of all font families registered with the manager. */
42 public abstract String[] getRegisteredFontFamilies();
43
44 /** Returns true if the given font is registered with the manager. */
45 public abstract boolean isFontFamilyRegistered(String fontFamily);
46
47 /** Returns a handle representing the actual font used for the given font. */
48 public abstract Font getActualFont(Font font);
49
50 /** Checks if the given font was matched exactly by the font manager. */
51 public boolean fontIsActualFont(Font font)
52 {
53 if (font == null) return false;
54
55 return font.equals(getActualFont(font));
56 }
57
58
59}
Note: See TracBrowser for help on using the repository browser.