| 1 | package com.googlecode.lanterna.terminal.swing; |
| 2 | |
| 3 | import java.awt.*; |
| 4 | |
| 5 | /** |
| 6 | * Font configuration class for {@link SwingTerminal} that is extending from {@link AWTTerminalFontConfiguration} |
| 7 | */ |
| 8 | public class SwingTerminalFontConfiguration extends AWTTerminalFontConfiguration { |
| 9 | /** |
| 10 | * This is the default font settings that will be used if you don't specify anything |
| 11 | */ |
| 12 | public static SwingTerminalFontConfiguration getDefault() { |
| 13 | return newInstance(filterMonospaced(selectDefaultFont())); |
| 14 | } |
| 15 | |
| 16 | /** |
| 17 | * Creates a new font configuration from a list of fonts in order of priority. This works by having the terminal |
| 18 | * attempt to draw each character with the fonts in the order they are specified in and stop once we find a font |
| 19 | * that can actually draw the character. For ASCII characters, it's very likely that the first font will always be |
| 20 | * used. |
| 21 | * @param fontsInOrderOfPriority Fonts to use when drawing text, in order of priority |
| 22 | * @return Font configuration built from the font list |
| 23 | */ |
| 24 | @SuppressWarnings("WeakerAccess") |
| 25 | public static SwingTerminalFontConfiguration newInstance(Font... fontsInOrderOfPriority) { |
| 26 | return new SwingTerminalFontConfiguration(true, BoldMode.EVERYTHING_BUT_SYMBOLS, fontsInOrderOfPriority); |
| 27 | } |
| 28 | |
| 29 | /** |
| 30 | * Creates a new font configuration from a list of fonts in order of priority. This works by having the terminal |
| 31 | * attempt to draw each character with the fonts in the order they are specified in and stop once we find a font |
| 32 | * that can actually draw the character. For ASCII characters, it's very likely that the first font will always be |
| 33 | * used. |
| 34 | * @param useAntiAliasing If {@code true} then anti-aliasing should be enabled when drawing text |
| 35 | * @param boldMode Option to control what to do when drawing text with the bold SGR enabled |
| 36 | * @param fontsInOrderOfPriority Fonts to use when drawing text, in order of priority |
| 37 | */ |
| 38 | public SwingTerminalFontConfiguration(boolean useAntiAliasing, BoldMode boldMode, Font... fontsInOrderOfPriority) { |
| 39 | super(useAntiAliasing, boldMode, fontsInOrderOfPriority); |
| 40 | } |
| 41 | } |