/** * the default font for monospace text, as used by the {@link #getMarkupScanner() scanner}. Note * that if a preference store is used then {@link #setMonospaceFontPreference(String)} should be * used instead. */ public void setDefaultMonospaceFont(Font defaultMonospaceFont) { if (this.defaultMonospaceFont != defaultMonospaceFont) { this.defaultMonospaceFont = defaultMonospaceFont; if (scanner != null) { scanner.resetFonts(defaultFont, defaultMonospaceFont); } } }
/** * The default font, as used by the {@link #getMarkupScanner() scanner}. Note that if a preference * store is used then {@link #setFontPreference(String)} should be used instead. */ public void setDefaultFont(Font defaultFont) { if (defaultFont == null) { throw new IllegalArgumentException(); } if (defaultFont != this.defaultFont) { this.defaultFont = defaultFont; if (scanner != null) { scanner.resetFonts(defaultFont, defaultMonospaceFont); } } }
/** * Initialize default fonts. Causes this to re-read font preferences from the preference store. * Calling this method should only be necessary if font preferences have changed, or if the font * preference keys have changed. * * @since 1.3 * @see #getFontPreference() * @see #getMonospaceFontPreference() */ public void initializeDefaultFonts() { Font defaultFont = null; Font defaultMonospaceFont = null; if (WikiTextUiPlugin.getDefault() != null) { IThemeManager themeManager = PlatformUI.getWorkbench().getThemeManager(); FontRegistry fontRegistry = themeManager.getCurrentTheme().getFontRegistry(); defaultFont = fontRegistry.get(fontPreference); defaultMonospaceFont = fontRegistry.get(monospaceFontPreference); } if (defaultFont == null) { // could be the case when running stand-alone defaultFont = JFaceResources.getDefaultFont(); } if (this.defaultFont != defaultFont || this.defaultMonospaceFont != defaultMonospaceFont) { this.defaultFont = defaultFont; this.defaultMonospaceFont = defaultMonospaceFont; if (scanner != null) { scanner.resetFonts(defaultFont, defaultMonospaceFont); } } }