4
$\begingroup$

Bug introduced in 10.0 and persisting through 12.0


I am attempting to implement this: How can I wrap text around a circle?

But I need Unicode support. Unfortunately, in my case, this gives a broken output (some Unicode characters missing replaced by rectangles)

ImportString[ExportString[
Style["ěščřžýáíé", FontFamily -> "Verdana", 
 FontSize -> 12],
"PDF"
],
"TextMode" -> "Outlines"][[1, 1]] // Graphics

screenshot

Can this be fixed somehow?

$\endgroup$
5
  • 1
    $\begingroup$ The characters which do not work ( [SHacek] and [ZHacek ) are from ISOLatin2. So it looks like ISOLatin2 characters are not fully implemented when exporting them. I think this is just another bug and you should report it to Wolfram Research ([email protected]) and then in a couple of days, or weeks, or months, or years, or never, it might get fixed in a future release. $\endgroup$ Commented Jan 14, 2018 at 14:51
  • $\begingroup$ It works as expected with versions 8.0.4 and 9.0.1 but fails starting from version 10.0. So it is a bug introduced in 10.0, adding the tag. Please report it to [email protected]. $\endgroup$ Commented Jan 14, 2018 at 15:52
  • $\begingroup$ The bug seems to be in importing rather than exporting. When I export and save to file, then display the file with another software, it displays OK. $\endgroup$ Commented Jan 14, 2018 at 18:15
  • $\begingroup$ The bug has been reported and I got a confirmation e-mail acknowledging the bug. $\endgroup$ Commented Jan 19, 2018 at 9:27
  • $\begingroup$ Update: The error persist in 11.3. $\endgroup$ Commented Mar 15, 2018 at 14:15

2 Answers 2

6
$\begingroup$

I reproduce the problem with versions 10.0.1, 10.4.1 and 11.2.0 on Windows 7 x64. The problem isn't related to the font used: the same happens when instead of FontFamily -> "Verdana" I set "Times" or "Courier". At the same time, with versions 8.0.4 and 9.0.1 I get the expected output:

screenshot

Note that in versions 8 and 9 non-ASCII characters are Exported as outlines, not as text. This is the reason why they are always imported as outlines, even with "TextOutlines" -> False.

The new Export produces a correct PDF file:

Export["test.pdf", 
  Style["ěščřžýáíé", FontFamily -> "Courier", FontSize -> 12]] // SystemOpen

Here is how it is rendered by Acrobat 11 (I intentionally selected a part of text to show that it is selectable text):

enter image description here

The text can be copied and pasted from Acrobat into Notepad correctly, hence there are no problems with encoding in the exported PDF.

This file (created by version 11.2.0) can't be correctly imported by pre-10 Import: the latter is unable to decode correctly any character at all:

screenshot

So the overall conclusion is that both Import and Export starting from version 10 received Unicode support, but in the case of Import there are bugs with some particular symbols.

Unfortunately I can't suggest any workaround for this problem except downgrading to a pre-10 version of Mathematica. Even new in version 10 BoundaryDiscretizeGraphics function is affected by this bug:

screenshot

Apart of this, the options "TextMode" -> "Outlines" and "TextOutlines" -> True are ignored by Export, so we can't revert to the old behavior of Export.

Please report it to the tech support.


UPDATE

According to discussion here, one can use GhostScript for outlining fonts in the exported PDF file. It can be automatized with gsExport function from this answer by Jens. Then Import will correctly import outlines from obtained PDF file (like it was in versions 8 and 9).

$\endgroup$
2
$\begingroup$

It works with Times on my system (Mac 10.11.6, Mathematica 11.1.1):

ImportString[ExportString[
  Style["ěščřžýáíé", FontFamily -> "Times", FontSize -> 12], "PDF"],
  "TextMode" -> "Outlines"][[1, 1]] // Graphics

enter image description here

$\endgroup$
4
  • $\begingroup$ Which version do you use and on which OS? It doesn't work for me with versions 10.0.1, 10.4.1 and 11.2.0 on Windows 7 x64. $\endgroup$ Commented Jan 14, 2018 at 16:12
  • $\begingroup$ Does not work for me. Linux, Mathematica 11.2 $\endgroup$ Commented Jan 14, 2018 at 17:46
  • $\begingroup$ @AlexeyPopkov I should have said that this is on a Mac with OS 10.11.6 and Mathematica 11.11.1. $\endgroup$
    – Themis
    Commented Jan 14, 2018 at 17:54
  • 2
    $\begingroup$ @AlexeyPopkov Works for me also (with OSX 10.11.6, mma 11.2) with Times but not Times New Roman, with Courier but not Courier New, with Helvetica but not Arial, ... (Print@{#, ImportString[ ExportString[ Style["ěščřžýáíé", FontFamily -> #, FontSize -> 12], "PDF"], "TextMode" -> "Outlines"][[1, 1]] // Graphics}) & /@ $FontFamilies[[1 ;;]] (be careful, this completely crashes my mma session when it reaches the font "YuGothic" (ExportString[.., "PDF"]) ...). $\endgroup$
    – SquareOne
    Commented Jan 16, 2018 at 9:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.