diff --git a/platform/editor-ui-api/src/com/intellij/openapi/editor/colors/DelegatingFontPreferences.java b/platform/editor-ui-api/src/com/intellij/openapi/editor/colors/DelegatingFontPreferences.java index add18752ea7c..8a833bedd98c 100644 --- a/platform/editor-ui-api/src/com/intellij/openapi/editor/colors/DelegatingFontPreferences.java +++ b/platform/editor-ui-api/src/com/intellij/openapi/editor/colors/DelegatingFontPreferences.java @@ -20,7 +20,7 @@ import org.jetbrains.annotations.NotNull; import java.util.List; import java.util.function.Supplier; -public class DelegatingFontPreferences implements FontPreferences { +public class DelegatingFontPreferences extends FontPreferences { private Supplier myDelegateSupplier; public DelegatingFontPreferences(@NotNull Supplier delegateSupplier) { diff --git a/platform/editor-ui-api/src/com/intellij/openapi/editor/colors/FontPreferences.java b/platform/editor-ui-api/src/com/intellij/openapi/editor/colors/FontPreferences.java index bffdec3fa761..e04d7da3289f 100644 --- a/platform/editor-ui-api/src/com/intellij/openapi/editor/colors/FontPreferences.java +++ b/platform/editor-ui-api/src/com/intellij/openapi/editor/colors/FontPreferences.java @@ -22,36 +22,52 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import java.awt.*; +import java.util.Collections; import java.util.List; -public interface FontPreferences { - @NonNls @NotNull String DEFAULT_FONT_NAME = getDefaultFontName(); - int DEFAULT_FONT_SIZE = FontSize.SMALL.getSize(); +public class FontPreferences { + public final static @NonNls @NotNull String DEFAULT_FONT_NAME = getDefaultFontName(); + public final static int DEFAULT_FONT_SIZE = FontSize.SMALL.getSize(); - float DEFAULT_LINE_SPACING = 1.0f; - String FALLBACK_FONT_FAMILY = "Monospaced"; - String MAC_OS_DEFAULT_FONT_FAMILY = "Menlo"; - String LINUX_DEFAULT_FONT_FAMILY = "DejaVu Sans Mono"; - String WINDOWS_DEFAULT_FONT_FAMILY = FALLBACK_FONT_FAMILY; + public final static float DEFAULT_LINE_SPACING = 1.0f; + public final static String FALLBACK_FONT_FAMILY = "Monospaced"; + public final static String MAC_OS_DEFAULT_FONT_FAMILY = "Menlo"; + public final static String LINUX_DEFAULT_FONT_FAMILY = "DejaVu Sans Mono"; + public final static String WINDOWS_DEFAULT_FONT_FAMILY = FALLBACK_FONT_FAMILY; @NotNull - List getEffectiveFontFamilies(); + public List getEffectiveFontFamilies() { + return Collections.emptyList(); + } @NotNull - List getRealFontFamilies(); + public List getRealFontFamilies() { + return Collections.emptyList(); + } @NotNull - String getFontFamily(); + public String getFontFamily() { + return FALLBACK_FONT_FAMILY; + } - int getSize(@NotNull String fontFamily); + public int getSize(@NotNull String fontFamily) { + return DEFAULT_FONT_SIZE; + } - void copyTo(@NotNull FontPreferences preferences); + public void copyTo(@NotNull FontPreferences preferences) { + } - boolean useLigatures(); + public boolean useLigatures() { + return false; + } - boolean hasSize(@NotNull String fontName); + public boolean hasSize(@NotNull String fontName) { + return false; + } - float getLineSpacing(); + public float getLineSpacing() { + return DEFAULT_LINE_SPACING; + } /** * There is a possible case that particular font family is not available at particular environment (e.g. Monaco under *nix). @@ -67,7 +83,7 @@ public interface FontPreferences { * null if font family with the given name is registered at the current environment */ @Nullable - static String getFallbackName(@NotNull String fontName, int fontSize, @Nullable EditorColorsScheme fallbackScheme) { + public static String getFallbackName(@NotNull String fontName, int fontSize, @Nullable EditorColorsScheme fallbackScheme) { Font plainFont = new Font(fontName, Font.PLAIN, fontSize); if (plainFont.getFamily().equals("Dialog") && !("Dialog".equals(fontName) || fontName.startsWith("Dialog."))) { return fallbackScheme == null ? DEFAULT_FONT_NAME : fallbackScheme.getEditorFontName(); @@ -75,7 +91,7 @@ public interface FontPreferences { return null; } - static String getDefaultFontName() { + public static String getDefaultFontName() { if (SystemInfo.isWindows) return WINDOWS_DEFAULT_FONT_FAMILY; if (SystemInfo.isMacOSSnowLeopard) return MAC_OS_DEFAULT_FONT_FAMILY; if (SystemInfo.isXWindow && !GraphicsEnvironment.isHeadless()) { diff --git a/platform/editor-ui-api/src/com/intellij/openapi/editor/colors/ModifiableFontPreferences.java b/platform/editor-ui-api/src/com/intellij/openapi/editor/colors/ModifiableFontPreferences.java index 1fd6769596ed..3f807250f65e 100644 --- a/platform/editor-ui-api/src/com/intellij/openapi/editor/colors/ModifiableFontPreferences.java +++ b/platform/editor-ui-api/src/com/intellij/openapi/editor/colors/ModifiableFontPreferences.java @@ -19,16 +19,16 @@ import org.jetbrains.annotations.NotNull; import java.util.List; -public interface ModifiableFontPreferences extends FontPreferences { - void clear(); - void clearFonts(); - void setUseLigatures(boolean useLigatures); - void addFontFamily(String family); - void register(String family, int size); - void setEffectiveFontFamilies(List fontFamilies); - void setRealFontFamilies(List fontFamilies); - void setTemplateFontSize(int size); - void setLineSpacing(float lineSpacing); - void resetFontSizes(); - void setFontSize(@NotNull String fontFamily, int size); +public abstract class ModifiableFontPreferences extends FontPreferences { + public abstract void clear(); + public abstract void clearFonts(); + public abstract void setUseLigatures(boolean useLigatures); + public abstract void addFontFamily(String family); + public abstract void register(String family, int size); + public abstract void setEffectiveFontFamilies(List fontFamilies); + public abstract void setRealFontFamilies(List fontFamilies); + public abstract void setTemplateFontSize(int size); + public abstract void setLineSpacing(float lineSpacing); + public abstract void resetFontSizes(); + public abstract void setFontSize(@NotNull String fontFamily, int size); } diff --git a/platform/editor-ui-ex/src/com/intellij/openapi/editor/colors/impl/FontPreferencesImpl.java b/platform/editor-ui-ex/src/com/intellij/openapi/editor/colors/impl/FontPreferencesImpl.java index 0c5f2cf30c38..afa259d48e8b 100644 --- a/platform/editor-ui-ex/src/com/intellij/openapi/editor/colors/impl/FontPreferencesImpl.java +++ b/platform/editor-ui-ex/src/com/intellij/openapi/editor/colors/impl/FontPreferencesImpl.java @@ -36,7 +36,7 @@ import java.util.List; * @author Denis Zhdanov * @since 12/20/12 9:37 PM */ -public class FontPreferencesImpl implements ModifiableFontPreferences { +public class FontPreferencesImpl extends ModifiableFontPreferences { @NotNull private final TObjectIntHashMap myFontSizes = new TObjectIntHashMap<>(); @NotNull private final List myEffectiveFontFamilies = ContainerUtilRt.newArrayList();