![]() |
CanScan
|
Singleton responsible for loading and applying custom fonts in the Swing UI. More...
Collaboration diagram for fr.softsf.canscan.util.FontManager:Public Member Functions | |
| int | getCharWidth () |
| Returns the reference character width based on 'W'. | |
| int | getLineHeight () |
| Returns the total line height (ascent + descent + leading). | |
| void | initialize () |
| Initializes and sets the Luciole font as the default Swing UI font (including scaling/shifting). | |
Public Attributes | |
| INSTANCE | |
Private Member Functions | |
| FontMetrics | getCurrentFontMetrics () |
Retrieves FontMetrics safely. | |
| void | loadLucioleFontAsDefaultFont () |
| void | loadMaterialIconsFont () |
| Loads Material Icons (TTF) and registers it in the JVM's Graphics Environment. | |
Static Private Attributes | |
| static final String | DEFAULT_FONT = "defaultFont" |
| static final JLabel | DUMMY_JLABEL = new JLabel() |
| static final String | FONT_LUCIOLE_PATH = "/font/Luciole-Regular.ttf" |
| static final String | FONT_MATERIAL_ICONS_PATH = "/font/MaterialIcons-Regular.ttf" |
| static final double | FONT_SHIFT_DOWN = 2.5 |
| static final Font | JRE_GUARANTEED_FONT_FALLBACK_FOR_UNIT_TESTS |
Singleton responsible for loading and applying custom fonts in the Swing UI.
It loads the Luciole font as the default UIManager font (with vertical adjustment) and registers the Material Icons font for use in specialized UI components. This class is accessed via the INSTANCE enum constant.
| int fr.softsf.canscan.util.FontManager.getCharWidth | ( | ) |
Returns the reference character width based on 'W'.
Uses an internal JLabel context to calculate exact metrics.
Here is the call graph for this function:
|
private |
Retrieves FontMetrics safely.
Guarantees non-null return, resolving the Font and relying on client catch blocks for fault tolerance in headless environments.
FontMetrics object. | int fr.softsf.canscan.util.FontManager.getLineHeight | ( | ) |
Returns the total line height (ascent + descent + leading).
Here is the call graph for this function:| void fr.softsf.canscan.util.FontManager.initialize | ( | ) |
Initializes and sets the Luciole font as the default Swing UI font (including scaling/shifting).
It also loads and registers the Material Icons font for UI components.
The UI is updated asynchronously on the EDT using SwingUtilities#invokeLater(Runnable) after fonts are loaded.
Here is the call graph for this function:
|
private |
|
private |
Loads Material Icons (TTF) and registers it in the JVM's Graphics Environment.
The font is then accessible using the family name "Material Icons".
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
| fr.softsf.canscan.util.FontManager.INSTANCE |
|
staticprivate |