Revert "GUI: use "Droid Sans" as default font" 55/17755/1
Clément DAVID [Tue, 2 Feb 2016 09:17:00 +0000 (10:17 +0100)]
This reverts commit f32c2da22144c6a64793d930988859ed799be713 as the feature
is only partially implemented and does not the right fonts.

Change-Id: I6eee14e052f38744fa6e86fcb1b403d70e28a071

16 files changed:
scilab/CHANGES_6.0.X
scilab/desktop/DroidSans-Bold.ttf [deleted file]
scilab/desktop/DroidSans.ttf [deleted file]
scilab/desktop/DroidSansMono.ttf [deleted file]
scilab/desktop/DroidSerif-Bold.ttf [deleted file]
scilab/desktop/DroidSerif-BoldItalic.ttf [deleted file]
scilab/desktop/DroidSerif-Italic.ttf [deleted file]
scilab/desktop/DroidSerif-Regular.ttf [deleted file]
scilab/desktop/Makefile.am
scilab/desktop/Makefile.in
scilab/modules/console/etc/configuration.xml
scilab/modules/core/src/java/org/scilab/modules/core/Scilab.java
scilab/modules/gui/etc/XConfiguration-font.xml
scilab/modules/gui/etc/flexdock-themes.xml
scilab/modules/gui/gui.iss
scilab/modules/gui/src/java/org/scilab/modules/gui/utils/LookAndFeelManager.java

index 35cfd69..9ff0193 100644 (file)
@@ -36,10 +36,6 @@ earlier versions:
    automatically converted to the 6.0 format: they cannot be opened again
    in Scilab/Xcos 5.x.
 
-Scilab now use the Droid fonts across all platforms. This might generally
-improve the look 'n feel of the software but might regress sometimes.
-
-
 Bug Fixes
 =========
 
diff --git a/scilab/desktop/DroidSans-Bold.ttf b/scilab/desktop/DroidSans-Bold.ttf
deleted file mode 100644 (file)
index d065b64..0000000
Binary files a/scilab/desktop/DroidSans-Bold.ttf and /dev/null differ
diff --git a/scilab/desktop/DroidSans.ttf b/scilab/desktop/DroidSans.ttf
deleted file mode 100644 (file)
index ad1efca..0000000
Binary files a/scilab/desktop/DroidSans.ttf and /dev/null differ
diff --git a/scilab/desktop/DroidSansMono.ttf b/scilab/desktop/DroidSansMono.ttf
deleted file mode 100644 (file)
index 4a27887..0000000
Binary files a/scilab/desktop/DroidSansMono.ttf and /dev/null differ
diff --git a/scilab/desktop/DroidSerif-Bold.ttf b/scilab/desktop/DroidSerif-Bold.ttf
deleted file mode 100644 (file)
index 838d255..0000000
Binary files a/scilab/desktop/DroidSerif-Bold.ttf and /dev/null differ
diff --git a/scilab/desktop/DroidSerif-BoldItalic.ttf b/scilab/desktop/DroidSerif-BoldItalic.ttf
deleted file mode 100644 (file)
index 0b1601f..0000000
Binary files a/scilab/desktop/DroidSerif-BoldItalic.ttf and /dev/null differ
diff --git a/scilab/desktop/DroidSerif-Italic.ttf b/scilab/desktop/DroidSerif-Italic.ttf
deleted file mode 100644 (file)
index 2972809..0000000
Binary files a/scilab/desktop/DroidSerif-Italic.ttf and /dev/null differ
diff --git a/scilab/desktop/DroidSerif-Regular.ttf b/scilab/desktop/DroidSerif-Regular.ttf
deleted file mode 100644 (file)
index 5b4fe81..0000000
Binary files a/scilab/desktop/DroidSerif-Regular.ttf and /dev/null differ
index 035b3a5..40d83ea 100644 (file)
@@ -34,14 +34,3 @@ mime_DATA = scilab.xml
 # Note that here, it is datadir and NOT pkgdatadir
 appdatadir = $(datadir)/appdata
 appdata_DATA = scilab.appdata.xml
-
-# Embedded font file
-# Note that here, it is datadir and NOT pkgdatadir
-fontdir = $(datadir)/fonts/google-droid/
-font_DATA = DroidSans-Bold.ttf \
-DroidSansMono.ttf \
-DroidSans.ttf \
-DroidSerif-BoldItalic.ttf \
-DroidSerif-Bold.ttf \
-DroidSerif-Italic.ttf \
-DroidSerif-Regular.ttf
index 2d3d16f..4a7133f 100644 (file)
@@ -185,8 +185,8 @@ am__uninstall_files_from_dir = { \
          $(am__cd) "$$dir" && rm -f $$files; }; \
   }
 am__installdirs = "$(DESTDIR)$(appdatadir)" "$(DESTDIR)$(desktopdir)" \
-       "$(DESTDIR)$(fontdir)" "$(DESTDIR)$(mimedir)"
-DATA = $(appdata_DATA) $(desktop_DATA) $(font_DATA) $(mime_DATA)
+       "$(DESTDIR)$(mimedir)"
+DATA = $(appdata_DATA) $(desktop_DATA) $(mime_DATA)
 RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive        \
   distclean-recursive maintainer-clean-recursive
 am__recursive_targets = \
@@ -552,18 +552,6 @@ mime_DATA = scilab.xml
 # Note that here, it is datadir and NOT pkgdatadir
 appdatadir = $(datadir)/appdata
 appdata_DATA = scilab.appdata.xml
-
-# Embedded font file
-# Note that here, it is datadir and NOT pkgdatadir
-fontdir = $(datadir)/fonts/google-droid/
-font_DATA = DroidSans-Bold.ttf \
-DroidSansMono.ttf \
-DroidSans.ttf \
-DroidSerif-BoldItalic.ttf \
-DroidSerif-Bold.ttf \
-DroidSerif-Italic.ttf \
-DroidSerif-Regular.ttf
-
 all: all-recursive
 
 .SUFFIXES:
@@ -644,27 +632,6 @@ uninstall-desktopDATA:
        @list='$(desktop_DATA)'; test -n "$(desktopdir)" || list=; \
        files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
        dir='$(DESTDIR)$(desktopdir)'; $(am__uninstall_files_from_dir)
-install-fontDATA: $(font_DATA)
-       @$(NORMAL_INSTALL)
-       @list='$(font_DATA)'; test -n "$(fontdir)" || list=; \
-       if test -n "$$list"; then \
-         echo " $(MKDIR_P) '$(DESTDIR)$(fontdir)'"; \
-         $(MKDIR_P) "$(DESTDIR)$(fontdir)" || exit 1; \
-       fi; \
-       for p in $$list; do \
-         if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
-         echo "$$d$$p"; \
-       done | $(am__base_list) | \
-       while read files; do \
-         echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(fontdir)'"; \
-         $(INSTALL_DATA) $$files "$(DESTDIR)$(fontdir)" || exit $$?; \
-       done
-
-uninstall-fontDATA:
-       @$(NORMAL_UNINSTALL)
-       @list='$(font_DATA)'; test -n "$(fontdir)" || list=; \
-       files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
-       dir='$(DESTDIR)$(fontdir)'; $(am__uninstall_files_from_dir)
 install-mimeDATA: $(mime_DATA)
        @$(NORMAL_INSTALL)
        @list='$(mime_DATA)'; test -n "$(mimedir)" || list=; \
@@ -846,7 +813,7 @@ check: check-recursive
 all-am: Makefile $(DATA)
 installdirs: installdirs-recursive
 installdirs-am:
-       for dir in "$(DESTDIR)$(appdatadir)" "$(DESTDIR)$(desktopdir)" "$(DESTDIR)$(fontdir)" "$(DESTDIR)$(mimedir)"; do \
+       for dir in "$(DESTDIR)$(appdatadir)" "$(DESTDIR)$(desktopdir)" "$(DESTDIR)$(mimedir)"; do \
          test -z "$$dir" || $(MKDIR_P) "$$dir"; \
        done
 install: install-recursive
@@ -900,7 +867,7 @@ info: info-recursive
 info-am:
 
 install-data-am: install-appdataDATA install-desktopDATA \
-       install-fontDATA install-mimeDATA
+       install-mimeDATA
 
 install-dvi: install-dvi-recursive
 
@@ -945,7 +912,7 @@ ps: ps-recursive
 ps-am:
 
 uninstall-am: uninstall-appdataDATA uninstall-desktopDATA \
-       uninstall-fontDATA uninstall-mimeDATA
+       uninstall-mimeDATA
 
 .MAKE: $(am__recursive_targets) install-am install-strip
 
@@ -955,15 +922,14 @@ uninstall-am: uninstall-appdataDATA uninstall-desktopDATA \
        distclean-tags distdir dvi dvi-am html html-am info info-am \
        install install-am install-appdataDATA install-data \
        install-data-am install-desktopDATA install-dvi install-dvi-am \
-       install-exec install-exec-am install-fontDATA install-html \
-       install-html-am install-info install-info-am install-man \
-       install-mimeDATA install-pdf install-pdf-am install-ps \
-       install-ps-am install-strip installcheck installcheck-am \
-       installdirs installdirs-am maintainer-clean \
-       maintainer-clean-generic mostlyclean mostlyclean-generic \
-       mostlyclean-libtool pdf pdf-am ps ps-am tags tags-am uninstall \
-       uninstall-am uninstall-appdataDATA uninstall-desktopDATA \
-       uninstall-fontDATA uninstall-mimeDATA
+       install-exec install-exec-am install-html install-html-am \
+       install-info install-info-am install-man install-mimeDATA \
+       install-pdf install-pdf-am install-ps install-ps-am \
+       install-strip installcheck installcheck-am installdirs \
+       installdirs-am maintainer-clean maintainer-clean-generic \
+       mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \
+       ps ps-am tags tags-am uninstall uninstall-am \
+       uninstall-appdataDATA uninstall-desktopDATA uninstall-mimeDATA
 
 .PRECIOUS: Makefile
 
index 2f09e61..31a91a3 100644 (file)
@@ -31,7 +31,7 @@
         <ScrollableBlockIncrement useCache="true" value="20"/>
         <VerticalWrapAllowed useCache="true" value="false"/>
         <HorizontalWrapAllowed useCache="true" value="false"/>
-        <FontName useCache="true" value="Droid Sans Mono"/>
+        <FontName useCache="true" value="Monospaced"/>
         <FontStyle useCache="true" value="0"/>
         <!-- 0=PLAIN, 1=BOLD, 2=ITALIC, 3=BOLD+ITALIC -->
         <FontSize useCache="true" value="13"/>
index 49bc43f..cd7c72f 100644 (file)
@@ -170,7 +170,7 @@ public class Scilab {
                 /* Init the LookAndFeelManager all the time since we can
                  * create windows in the NW mode */
                 if (!GraphicsEnvironment.isHeadless()) {
-                    LookAndFeelManager lookAndFeel = LookAndFeelManager.getInstance();
+                    LookAndFeelManager lookAndFeel = new LookAndFeelManager();
 
                     if (lookAndFeel.isSupportedLookAndFeel(scilabLookAndFeel)) {
                         lookAndFeel.setLookAndFeel(scilabLookAndFeel);
@@ -178,7 +178,7 @@ public class Scilab {
                         lookAndFeel.setSystemLookAndFeel();
                     }
                 }
-            } catch (Exception exception) {
+            } catch (java.lang.NoClassDefFoundError exception) {
                 System.err.println("Could not initialize graphics Environment");
                 System.err.println("Scilab Graphical option may not be working correctly.");
                 System.err.println("An error occurred: " + exception.getLocalizedMessage());
index feff346..e8cdf08 100644 (file)
@@ -2,8 +2,8 @@
 <fonts title="_(Fonts)">
     <body>
         <fonts item="Console" system="true" font-name="Monospaced" font-face="plain" font-size="13" latex="15">
-            <item xconf-uid="console-font" name="Console" desktop="false" font-name="Droid Sans Mono" font-face="plain" font-size="13"/>
-            <item xconf-uid="scinotes-font" name="Scinotes" desktop="false" font-name="Droid Sans Mono" font-face="plain" font-size="12"/>
+            <item xconf-uid="console-font" name="Console" desktop="false" font-name="Monospaced" font-face="plain" font-size="13"/>
+            <item xconf-uid="scinotes-font" name="Scinotes" desktop="false" font-name="Monospaced" font-face="plain" font-size="12"/>
             <!--item name="Command History" desktop="true" font-name="Monospaced" font-face="plain" font-size="10"/>
       <item name="Variable Browser" desktop="true" font-name="Monospaced" font-face="plain" font-size="10"/>
       <item name="Help" desktop="true" font-name="Monospaced" font-face="plain" font-size="10"/>
index 8b1c8b5..bfc69b8 100644 (file)
@@ -17,7 +17,6 @@
         <!-- List the various titlebars that are available -->
         <titlebar-ui name="scilab" extends="default">
             <property name="icon-map" value="scilab" />
-            <property name="font" value="Droid Sans, 0, 11" handler="font" />
         </titlebar-ui>
         
         <icon-resource name="scilab.undock">
index cac54f6..e07d0e1 100644 (file)
@@ -46,7 +46,6 @@ Source: modules\{#GUI}\etc\*.xml; DestDir: {app}\modules\{#GUI}\etc; Components:
 Source: modules\{#GUI}\etc\*.xsl; DestDir: {app}\modules\{#GUI}\etc; Components: {#COMPN_SCILAB} and {#COMPN_JVM_MODULE}
 Source: modules\{#GUI}\images\icons\*.png; DestDir: {app}\modules\{#GUI}\images\icons; Flags: recursesubdirs; Components: {#COMPN_SCILAB} and {#COMPN_JVM_MODULE}
 Source: modules\{#GUI}\images\preferences\*.png; DestDir: {app}\modules\{#GUI}\images\preferences; Flags: recursesubdirs; Components: {#COMPN_SCILAB} and {#COMPN_JVM_MODULE}
-Source: desktop\*.ttf; DestDir: {app}\desktop; Components: {#COMPN_SCILAB} and {#COMPN_JVM_MODULE}
 ;
 ;Source: modules\{#GUI}\includes\*.h; DestDir: {app}\modules\{#GUI}\includes; Components: {#COMPN_SCILAB} and {#COMPN_JVM_MODULE}
 ;
index 7eea666..b9b7649 100644 (file)
@@ -2,7 +2,6 @@
  * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
  * Copyright (C) 2007 - INRIA - Allan CORNET
  * Copyright (C) 2007 - INRIA - Sylvestre Ledru
- * Copyright (C) 2015 - Scilab Enterprises - Clement DAVID
  *
  * Copyright (C) 2012 - 2016 - Scilab Enterprises
  *
 
 package org.scilab.modules.gui.utils;
 
-import java.awt.Font;
-import java.awt.FontFormatException;
-import java.awt.GraphicsEnvironment;
-import java.io.File;
-import java.io.IOException;
 import java.lang.reflect.InvocationTargetException;
 
 import javax.swing.SwingUtilities;
-import javax.swing.UIDefaults;
 import javax.swing.UIManager;
 import javax.swing.UnsupportedLookAndFeelException;
-import javax.swing.plaf.FontUIResource;
 
 /**
  * Class used to modify look and feel in Scilab GUIs
@@ -37,70 +29,16 @@ import javax.swing.plaf.FontUIResource;
  * @author Sylvestre Ledru
  */
 public class LookAndFeelManager {
-    private static LookAndFeelManager instance;
 
-    public static LookAndFeelManager getInstance() {
-        if (instance == null) {
-            instance = new LookAndFeelManager();
-        }
-        return instance;
-    }
-
-    private final UIManager.LookAndFeelInfo[] availableLookAndFeels;
+    private static UIManager.LookAndFeelInfo[] availableLookAndFeels = UIManager.getInstalledLookAndFeels();
     private boolean ret;
 
-    private Font serif;
-    private Font sansSerif;
-    private Font monospaced;
-    private Font dialog;
-    private Font dialogInput;
-
-
     /**
      * Constructor
      */
     public LookAndFeelManager() {
-        availableLookAndFeels = UIManager.getInstalledLookAndFeels();
     }
 
-    public Font getSerifFont() {
-        if (serif == null) {
-            serif = new Font(Font.SERIF, Font.PLAIN, 12);
-        }
-        return serif;
-    }
-
-    public Font getSansSerifFont() {
-        if (sansSerif == null) {
-            sansSerif = new Font(Font.SANS_SERIF, Font.PLAIN, 12);
-        }
-        return sansSerif;
-    }
-
-    public Font getMonospacedFont() {
-        if (monospaced == null) {
-            monospaced = new Font(Font.MONOSPACED, Font.PLAIN, 12);
-        }
-        return monospaced;
-    }
-
-    public Font getDialogFont() {
-        if (dialog == null) {
-            dialog = new Font(Font.DIALOG, Font.PLAIN, 12);
-        }
-        return dialog;
-    }
-
-    public Font getDialogInputFont() {
-        if (dialogInput == null) {
-            dialogInput = new Font(Font.DIALOG_INPUT, Font.PLAIN, 12);
-        }
-        return dialogInput;
-    }
-
-
-
-
     /**
      * Get Installed Look and Feels
      * @return an array of String
@@ -155,10 +93,6 @@ public class LookAndFeelManager {
                 public void run() {
                     try {
                         UIManager.setLookAndFeel(lookandfeel);
-                        registerEmbeddedFonts();
-                        storeEmbeddedFonts();
-                        initComponentDefaults(UIManager.getDefaults());
-
                         ret = true;
                     } catch (UnsupportedLookAndFeelException e) {
                         System.err.println("Cannot find this look and feel:");
@@ -172,12 +106,6 @@ public class LookAndFeelManager {
                     } catch (InstantiationException e) {
                         System.err.println("Instantiation error while setting the Look And Feel:");
                         System.err.println(e.getLocalizedMessage());
-                    } catch (FontFormatException e) {
-                        System.err.println("Invalid Font format:");
-                        System.err.println(e.getLocalizedMessage());
-                    } catch (IOException e) {
-                        System.err.println("Unable to open Font:");
-                        System.err.println(e.getLocalizedMessage());
                     }
                 }
             });
@@ -190,115 +118,6 @@ public class LookAndFeelManager {
     }
 
     /**
-     * Register the shipped fonts
-     */
-    private void registerEmbeddedFonts() throws FontFormatException, IOException {
-        GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
-
-        File[] possibleDirs = {
-            new File(System.getenv("SCI"), "/../fonts/google-droid"),   // binary version (eg.  where we have a "share")
-            new File(System.getenv("SCI"), "/desktop"),                 // Linux dev. version or Windows install
-        };
-
-        // detect existing dir
-        File dir = null;
-        for (File d : possibleDirs) {
-            if (d.isDirectory()) { // also check if it exists implicitly
-                dir = d;
-                break;
-            }
-        }
-        if (dir == null) {
-            return;
-        }
-
-        // register fonts
-        String[] filenames = {"DroidSans-Bold.ttf", "DroidSansMono.ttf", "DroidSans.ttf", "DroidSerif-BoldItalic.ttf", "DroidSerif-Bold.ttf", "DroidSerif-Italic.ttf", "DroidSerif-Regular.ttf"}; ;
-        final Float size = 11f;
-
-        for (String filename : filenames) {
-            File f  = new File(dir, filename);
-
-            if (f.canRead()) {
-                Font base = Font.createFont(Font.TRUETYPE_FONT, f);
-
-                Font derived = base.deriveFont(size);
-                ge.registerFont(derived);
-            }
-        }
-    }
-
-    /**
-     * Store on local fields the default used fonts
-     */
-    private void storeEmbeddedFonts() {
-        serif = new Font("Droid Serif", Font.PLAIN, 12);
-        sansSerif = new Font("Droid Sans", Font.PLAIN, 12);
-        monospaced = new Font("Droid Sans Mono", Font.PLAIN, 12);
-        dialog = new Font("Droid Sans", Font.PLAIN, 12);
-        dialogInput = new Font("Droid Sans Mono", Font.PLAIN, 12);
-    }
-
-    /**
-     * Override some defaults previously set in GTKLookAndFell#initComponentDefaults(UIDefaults)
-     *
-     * @param table the default settings
-     */
-    private void initComponentDefaults(UIDefaults table) {
-        final FontUIResource defaultFontUIResource = new FontUIResource(getDialogFont());
-        final FontUIResource defaultMonospacedFontUIResource = new FontUIResource(getMonospacedFont());
-
-        table.put("ArrowButton.font", defaultFontUIResource);
-        table.put("Button.font", defaultFontUIResource);
-        table.put("CheckBox.font", defaultFontUIResource);
-        table.put("CheckBoxMenuItem.font", defaultFontUIResource);
-        table.put("ColorChooser.font", defaultFontUIResource);
-        table.put("ComboBox.font", defaultFontUIResource);
-        table.put("DesktopPane.font", defaultFontUIResource);
-        table.put("DesktopIcon.font", defaultFontUIResource);
-        table.put("EditorPane.font", defaultFontUIResource);
-        table.put("FileChooser.font", defaultFontUIResource);
-        table.put("FormattedTextField.font", defaultFontUIResource);
-        table.put("InternalFrame.font", defaultFontUIResource);
-        table.put("InternalFrameTitlePane.font", defaultFontUIResource);
-        table.put("Label.font", defaultFontUIResource);
-        table.put("List.font", defaultFontUIResource);
-        table.put("Menu.font", defaultFontUIResource);
-        table.put("MenuBar.font", defaultFontUIResource);
-        table.put("MenuItem.font", defaultFontUIResource);
-        table.put("OptionPane.font", defaultFontUIResource);
-        table.put("Panel.font", defaultFontUIResource);
-        table.put("PasswordField.font", defaultFontUIResource);
-        table.put("PopupMenu.font", defaultFontUIResource);
-        table.put("PopupMenuSeparator.font", defaultFontUIResource);
-        table.put("ProgressBar.font", defaultFontUIResource);
-        table.put("RadioButton.font", defaultFontUIResource);
-        table.put("RadioButtonMenuItem.font", defaultFontUIResource);
-        table.put("RootPane.font", defaultFontUIResource);
-        table.put("ScrollBar.font", defaultFontUIResource);
-        table.put("ScrollBarTrack.font", defaultFontUIResource);
-        table.put("ScrollBarThumb.font", defaultFontUIResource);
-        table.put("ScrollPane.font", defaultFontUIResource);
-        table.put("Separator.font", defaultFontUIResource);
-        table.put("Slider.font", defaultFontUIResource);
-        table.put("SliderTrack.font", defaultFontUIResource);
-        table.put("SliderThumb.font", defaultFontUIResource);
-        table.put("Spinner.font", defaultFontUIResource);
-        table.put("SplitPane.font", defaultFontUIResource);
-        table.put("TabbedPane.font", defaultFontUIResource);
-        table.put("Table.font", defaultFontUIResource);
-        table.put("TableHeader.font", defaultFontUIResource);
-        table.put("TextArea.font", defaultFontUIResource);
-        table.put("TextField.font", defaultMonospacedFontUIResource);
-        table.put("TextPane.font", defaultMonospacedFontUIResource);
-        table.put("ToggleButton.font", defaultFontUIResource);
-        table.put("ToolBar.font", defaultFontUIResource);
-        table.put("ToolTip.font", defaultFontUIResource);
-        table.put("Tree.font", defaultFontUIResource);
-        table.put("Viewport", defaultFontUIResource);
-    }
-
-    /**
      * Set System Look and Feel
      * @return a boolean
      */