public class FontManager
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
private static class |
FontManager.EnvironmentFontTable
The font-table associated with a certain environment.
|
private static class |
FontManager.WorkArea
Context-local data for this font manager.
|
Modifier and Type | Field and Description |
---|---|
static int |
ALERT_BOX_FONT
Reference to the alert box font, a system font.
|
private static java.util.Map<java.lang.String,java.lang.Integer> |
browseCellBottomTextOffset
Map "font key" -> "offset of a text in a browse cell, from the cell bottom" (in pixels).
|
static int |
DEFAULT_FIXED_FONT
Reference for the default fixed font.
|
static int |
DEFAULT_FONT
Reference for the default font.
|
private static ContextLocal<FontManager.WorkArea> |
local
Context local instance of this class.
|
private static java.util.logging.Logger |
LOG
logger
|
static int |
MENU_FONT
Reference to the menu font, a system font.
|
static int |
SORT_NUMBER_FONT
Reference to the sort number font (on browse column labels), a system font.
|
static int |
STACK_TRACE_WINDOW_FONT
Reference to the stack trace window font, a system font.
|
static int |
SYSTEM_FONT_BASE
The base for the system fonts.
|
static int |
UNDEFINED_FONT
Reference for the undefined font.
|
static int |
WINDOW_TITLE_FONT
Reference to the window title font, a system font.
|
Constructor and Description |
---|
FontManager() |
Modifier and Type | Method and Description |
---|---|
static void |
adjustFontTableSize(Window<?> window,
int numEntries)
Set the number of entries in the font-table.
|
static void |
deregisterFontTable(Window<?> window,
ScreenDriver<?> driver)
Deregister the font-table associated with this window.
|
static int |
fontTableSize(Window<?> window)
Get the number of entries in the font-table.
|
static int |
getBrowseCellBottomTextOffset(FontDetails font)
Get offset of a text drawn with the specific font in a browse cell, from the cell bottom
(in pixels).
|
static int |
getFontHeight(TitledWindow<?> window,
int font,
ScreenDriver<?> driver)
Get the height of the given font.
|
static java.lang.String |
getFontKey(java.lang.String name,
int size,
boolean bold,
boolean italic,
boolean underline)
Get a key describing the given font.
|
static java.lang.String |
getFontKey(TitledWindow<?> window,
int font,
ScreenDriver<?> driver)
Resolve the font key associated with the given font, in the current window's font-table.
|
static int |
getFontWidth(TitledWindow<?> window,
int font,
ScreenDriver<?> driver)
Get the width of the given font.
|
static int |
getMaxFontWidth(TitledWindow<?> window,
int font,
ScreenDriver<?> driver)
Get the maximum font width for the given font.
|
static int |
getPixelsPerColumn(ScreenDriver<?> driver)
Get the PIXELS-PER-COLUMN value for this client session.
|
static int |
getPixelsPerRow(ScreenDriver<?> driver)
Get the PIXELS-PER-ROW value for this client session.
|
static int |
getTextHeight(java.lang.String text,
Window<?> window,
int font,
ScreenDriver<?> driver)
Get the height of the specified text, in pixels, using the specified font.
|
private static int[] |
getTextMetrics(java.lang.String text,
Window<?> window,
int font,
ScreenDriver<?> driver)
Get the metrics for the specified text and font from the
cache . |
static int |
getTextWidth(java.lang.String text,
Window<?> window,
int font,
ScreenDriver<?> driver)
Get the width of the specified text, in pixels, using the specified font.
|
static void |
init(ServerExports server)
Initialize the font manager's helpers.
|
static boolean |
isFixedSize(TitledWindow<?> window,
int font,
ScreenDriver<?> driver)
Check if the system font from the given font table entry is a fixed-size font.
|
static boolean |
isThreeD()
Get the state of the
use-3d-size flag. |
private static FontManager.WorkArea |
locate()
Locate the context-local data of this class.
|
static void |
registerFontTable(Window<?> window,
ScreenDriver<?> driver)
Compute and register the window's font-table.
|
static int |
resolveFont(int font,
boolean fixedSize)
If the given font is undefined, default to either the
DEFAULT_FONT or
-2, depending on whether a fixed font is required or not. |
static FontDetails<?> |
resolveFont(Window<?> window,
int font,
ScreenDriver<?> driver)
Resolve a font instance associated with the specified font entry in the window's
font table.
|
static void |
setThreeD(boolean isThreeD)
Set the state of the
use-3d-size flag. |
static void |
unload(java.lang.String envName)
Unload environment.
|
public static final int UNDEFINED_FONT
public static final int DEFAULT_FONT
public static final int DEFAULT_FIXED_FONT
public static final int SYSTEM_FONT_BASE
public static final int WINDOW_TITLE_FONT
public static final int ALERT_BOX_FONT
public static final int STACK_TRACE_WINDOW_FONT
public static final int MENU_FONT
public static final int SORT_NUMBER_FONT
private static final java.util.logging.Logger LOG
private static java.util.Map<java.lang.String,java.lang.Integer> browseCellBottomTextOffset
private static final ContextLocal<FontManager.WorkArea> local
public static int getFontHeight(TitledWindow<?> window, int font, ScreenDriver<?> driver)
window
- The window from which the font-table is used.font
- Font index.driver
- The reference screen driver.public static boolean isFixedSize(TitledWindow<?> window, int font, ScreenDriver<?> driver)
window
- The window for which the font-table is retrieved.font
- The font number in the window's font table.driver
- The active screen driver.true
if the associated font is fixed-size.public static int getFontWidth(TitledWindow<?> window, int font, ScreenDriver<?> driver)
window
- The window from which the font-table is used.font
- Font index.driver
- The reference screen driver.public static int getMaxFontWidth(TitledWindow<?> window, int font, ScreenDriver<?> driver)
window
- The window for which the font-table is retrieved.font
- The font number in the window's font table.driver
- The active screen driver.public static FontDetails<?> resolveFont(Window<?> window, int font, ScreenDriver<?> driver)
window
- The window from which the font-table is used.font
- The entry in the font-table.driver
- The reference screen driver.public static int getTextWidth(java.lang.String text, Window<?> window, int font, ScreenDriver<?> driver)
text
- The text.window
- The window from which the font-table is used.font
- The entry in the font-table.driver
- The reference screen driver.public static int getTextHeight(java.lang.String text, Window<?> window, int font, ScreenDriver<?> driver)
text
- The text.window
- The window from which the font-table is used.font
- The entry in the font-table.driver
- The reference screen driver.public static int getPixelsPerColumn(ScreenDriver<?> driver)
driver
- The reference screen driver.public static int getPixelsPerRow(ScreenDriver<?> driver)
driver
- The reference screen driver.public static void registerFontTable(Window<?> window, ScreenDriver<?> driver)
The same font-table may be shared by one or more windows.
window
- The window.driver
- The reference screen driver.public static void deregisterFontTable(Window<?> window, ScreenDriver<?> driver)
window
- The window.driver
- The reference screen driver.public static void adjustFontTableSize(Window<?> window, int numEntries)
window
- The window from which the font-table is used.numEntries
- The new size of the font-table.public static int fontTableSize(Window<?> window)
window
- The window from which the font-table is used.public static java.lang.String getFontKey(java.lang.String name, int size, boolean bold, boolean italic, boolean underline)
name
- The font name.size
- The font point size.bold
- Flag indicating if the font style is bold.italic
- Flag indicating if the font style is italic.underline
- Flag indicating if the font style is underline.public static java.lang.String getFontKey(TitledWindow<?> window, int font, ScreenDriver<?> driver)
window
- The window from which the font-table is used.font
- The entry in the font-table.driver
- The reference screen driver.public static void unload(java.lang.String envName)
UNLOAD environment
statement is executed.envName
- Environment name.public static void init(ServerExports server)
server
- The server exports.public static boolean isThreeD()
use-3d-size
flag.public static void setThreeD(boolean isThreeD)
use-3d-size
flag.isThreeD
- The new state of this flag.public static int resolveFont(int font, boolean fixedSize)
DEFAULT_FONT
or
-2, depending on whether a fixed font is required or not.font
- The font number.fixedSize
- Flag indicating if a fixed-size font is needed, if the font is
undefined
.public static int getBrowseCellBottomTextOffset(FontDetails font)
font
- Font used in the browse cell.private static FontManager.WorkArea locate()
FontManager.WorkArea
instance.java.lang.IllegalStateException
- If the FontManager.WorkArea
has not been FontManager.WorkArea.initialized
.private static int[] getTextMetrics(java.lang.String text, Window<?> window, int font, ScreenDriver<?> driver)
cache
.
If not present, ask the server-side for the metrics.
text
- The text.window
- The window from which the font-table is used.font
- The entry in the font-table.driver
- The reference screen driver.