Task #2342

Charts engine, set/fix default font preference

Added by Sebastien Jacquot over 2 years ago. Updated almost 2 years ago.

Status:Closed Start date:04/10/2017
Priority:Normal Due date:
Assignee:- % Done:


Category:Charts Spent time: -
Target version:TXM 0.8.0


**Set/test/fix default font preference for charts viewing but also export. At least 3 possible ways:
- find and set a portable Unicode font installed on all OS
- embed a free portable Unicode font in setups
- detect client OS and set 3 different fonts according to the current client

See if using the default Eclipse SWT font is interesting, required.

Location: /org.txm.chartsengine.core/src/org/txm/chartsengine/core/preferences/ChartsEnginePreferences.java
See the fixme above.

preferences.putBoolean(ChartsEnginePreferences.SHOW_TITLE, true);
preferences.putBoolean(ChartsEnginePreferences.SHOW_LEGEND, true);
preferences.putBoolean(ChartsEnginePreferences.SHOW_GRID, true);
preferences.putInt(ChartsEnginePreferences.RENDERING_COLORS_MODE, ChartsEngine.RENDERING_COLORS_MODE);
preferences.put(ChartsEnginePreferences.MONOCHROME_COLOR, "0,220,20"); //$NON-NLS-1$

// FIXME: maybe need need to check here the target OS and set a default unicode installed font
preferences.put(FONT, "1|Lucida Sans Unicode|11.0|0|WINDOWS|1|-16|0|0|0|400|0|0|0|0|3|2|1|34|Lucida Sans Unicode;"); //$NON-NLS-1$


#1 Updated by Sebastien Jacquot over 2 years ago

  • Description updated (diff)

#2 Updated by Sebastien Jacquot over 2 years ago

  • Target version changed from TXM 0.8.0a (split/restructuration) to TXM 0.8.0

#3 Updated by Sebastien Jacquot almost 2 years ago

  • Description updated (diff)

It seems there is a bug in SWT/JFace under Linux that doesn't load the JVM embedded fonts in JFace. A manual loading has been added at TXM start for Linux. Then the default font is set this way:

        // Check the target OS and set the default font from the JVM embedded font
        String defaultFont; 
        if(OSDetector.isFamilyUnix())    {
            defaultFont = "1|Lucida Sans|11.0|0|GTK|1|"; //$NON-NLS-1$ other version: "1|Lucida Sans|11|0" 
        else    {
            defaultFont = "1|Lucida Sans Unicode|11.0|0|WINDOWS|1|-16|0|0|0|400|0|0|0|0|3|2|1|34|Lucida Sans Unicode;"; //$NON-NLS-1$

Is seems the fonts are well loaded on Win and Mac.

Validation tests

- launch TXM fresh install
- go to Preferences\TXM\Advanced\Charts Engine
- you should have a "Change" button that opens a font selection popup
- click on it
=> the popup must open with the Lucida font selected:
=> on Windows and Mac => "Lucida Sans Unicode"
=> on Linux => "Lucida Sans"

#4 Updated by Sebastien Jacquot almost 2 years ago

  • Category changed from Development to Charts
  • Status changed from In Progress to Closed
  • % Done changed from 10 to 100

Duplicate of #2074

Also available in: Atom PDF