Bug #1046

RCP: 0.7.6, export view from JFC charts engine to PDF file format does not support all UTF-8 characters (e. g. RU characters if they are not present in the used font)

Added by Sebastien Jacquot almost 5 years ago. Updated 6 months ago.

Status:Feedback Start date:10/09/2014
Priority:Normal Due date:
Assignee:- % Done:

80%

Category:Charts Spent time: -
Target version:TXM X.X

Description

  • l'export view depuis Java/JFC vers PDF ne gère pas l'UTF-8 * NOTE DEV : je suis en train de chercher un moyen portable d'intégrer les polices Unicode utilisées aux PDF générés par iText. Le problème étant que pour intégrer la police au PDF il faut fournir le fichier de police à iText ou les bytes de la police, ce qui complique car il faut pointer vers des fichiers différents selon les OS, ex. : "c:/windows/fonts/arialuni.ttf", etc. et vers des polices Unicode.

Solution 2 (temporary but simple partial solution)

Convert from UTF-8 to the encoding needed to generate the PDF.

Validation test

  • load a Russian, Asian, Arabic, etc. corpus
  • create a chart with JFC charts engine then export it to a PDF file
    • => the created file must display the UTF-8 characters and the text must be selectable and copyable from the PDF viewer.
  • please provides the OS used for the tests
  • the UTF-8 special characters export is strongly linked to the user installed fonts, so the more machines/OS we can test, the better it'll be

History

#1 Updated by Serge Heiden almost 5 years ago

  • Description updated (diff)

#2 Updated by Sebastien Jacquot almost 5 years ago

  • Target version changed from TXM 0.7.7 to TXM 0.7.8

see: org.txm.tbx.chartsengine.jfreechart.JFCChartsEngine.exportPDF(JFreeChart, File, int, int, int, int, int, int)
We may try other libs than iText too.

#3 Updated by Sebastien Jacquot almost 5 years ago

  • Subject changed from RCP: 0.7.6, export view from JFC charts engine to PDF file format does not support UTF-8 characters to RCP: 0.7.6, export view from JFC charts engine to PDF file format does not support all UTF-8 characters (e. g. RU characters if they are not present in the used font)
  • Target version changed from TXM 0.7.8 to TXM 0.7.7
  • % Done changed from 0 to 30

Partially fixed: Windows OS, system fonts path has been added.
NOTE: Java 1.7 can not get the system font path anymore through FontManager class as Java <= 1.6.
TODO: Need to manually add all the possible font paths of Linux and Mac OS in org.txm.tbx.chartsengine.jfreechart.JFCChartsEngine.exportPDF(JFreeChart, File, int, int, int, int, int, int)

To check the fixes: load a Russian or an Asian corpus, create a chart with JFC charts engine then export it to a PDF file. The created file must display the UTF-8 characters and the text must be selectable and copyable from the PDF viewer.

#4 Updated by Matthieu Decorde almost 5 years ago

  • Description updated (diff)

#5 Updated by Sebastien Jacquot almost 5 years ago

The Linux and Mac OS X font paths has been added.

#6 Updated by Sebastien Jacquot almost 5 years ago

  • Description updated (diff)
  • Status changed from New to Feedback
  • % Done changed from 30 to 80

#7 Updated by Sebastien Jacquot almost 5 years ago

  • Description updated (diff)

#8 Updated by Sebastien Jacquot almost 5 years ago

The fix doesn't work under Ubuntu 13.04 VM, Russian characters are not displayed in Document Viewer 3.6.1 despite of the addition of the font paths. Could anyone test with another PDF viewer under Linux ?

The added fonts paths at this moment are the following:

// Linux
mapper.insertDirectory("/usr/share/fonts/");
mapper.insertDirectory("/usr/local/share/fonts/");
mapper.insertDirectory(System.getProperty("user.home") + "/.fonts");

// Mac
mapper.insertDirectory(System.getProperty("user.home") + "/Library/Fonts");
mapper.insertDirectory("/System/Library/Fonts");
mapper.insertDirectory("/Library/Fonts");

Under the tested Ubuntu, the fonts are in "/usr/local/share/fonts/" but there are subdirectories in this directory. We may need to implement a function to add the directories recursively. Structure of "/usr/local/share/fonts/":


cmap
truetype
type1
x11

#9 Updated by Sebastien Jacquot over 4 years ago

  • Target version changed from TXM 0.7.7 to TXM 0.7.8

#10 Updated by Matthieu Decorde about 4 years ago

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

#11 Updated by Sebastien Jacquot about 1 year ago

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

#12 Updated by Sebastien Jacquot 9 months ago

Need help to check again on 3 OS in TXM 0.8.0beta.

#13 Updated by Sebastien Jacquot 6 months ago

  • Target version changed from TXM 0.8.0 to TXM X.X

Also available in: Atom PDF