Message Boards Message Boards

Avoid problem with graphical transformation?

GROUPS:

Hello, 3 months ago I saved a notebook which was fine - but I am not sure which version was available at this point. However, actually I am using 11.2.0.0. The code is

WrapText[str_, transformation_] :=

 Rasterize[
  Module[{text}, 
   text = Style[str, Bold, FontFamily -> "Helvetica", FontSize -> 12, 
     LineBreakWithin -> False];
   Graphics@
     Cases[ImportString[ExportString[text, "PDF"], 
        "TextMode" -> "Outlines"][[1, 1]], 
      FilledCurve[a__] :> FilledCurve[a], Infinity] /. 
    transformation], ImageSize -> {300, 300}]

Export[NotebookDirectory[] <> "Test.jpg", 
 transformationSpiral = {x_Real, 
    y_Real} :> {Cos[-x/(12 Pi)]*(y + 4 + x/18), 
    Sin[-x/(12 Pi)]*(y + 4 + x/18)};
 WrapText[
  "All human beings are born free and equal in dignity and rights. \
They are endowed with reason and conscience and should act towards \
one another in a spirit of brotherhood.", transformationSpiral]]

with following result:

enter image description here

The code is from here and should look like this (and definately did it 3 months ago...):

enter image description here.

On an old os-backup with MMA 11.0.1 it works fine - except that it looks a bit different and the message "file was created with a newer version"...any ideas whats going on here?

Was there any version between 11.0.1 and 11.2 on the Raspberry? I am almost sure I saved it with actual 11.2 - but why does the output look so 'corrupted' now? And how could I fix it?

Many thanks for your help and ideas,

POSTED BY: Michael Steffen
Answer
23 days ago

Hello Michael,

I don't have this problem with version 11.3 on Windoiws 7 x64. I recommend contacting the tech support.

POSTED BY: Alexey Popkov
Answer
22 days ago

Hi,

I cannot reproduce this issue on MMA11.2 or 11.3 on OSX either.

Cheers,

Marco

POSTED BY: Marco Thiel
Answer
22 days ago

Hi Michael,

no problem on 11.3.0 for Linux x86 (64-bit) (March 7, 2018).

Nice code, thanks for sharing! How on earth you could come up with

ImportString[< data.pdf >, "TextMode" -> "Outlines"]

I cannot find this anywhere in the documentation.

Regards -- Henrik

POSTED BY: Henrik Schachner
Answer
22 days ago

Interesting code. Why do you write the replacement rule

FilledCurve[a__] :> FilledCurve[a]

in Cases? Wouldn't the simple pattern FilledCurve[a__] have the same effect?

POSTED BY: Gianluca Gorni
Answer
19 days ago

The problem seems to be somewhere in my OS I think (but where/why?). I did an apt-get update+upgrade on my os-backup - and this sd-card with MMA 11.2 now renders it as it should. Strange...but, however, it works fine now....as I saved it.

How on earth you could come up with

ImportString[< data.pdf >, "TextMode" -> "Outlines"]

Interesting code. Why do you write the replacement rule

FilledCurve[a__] :> FilledCurve[a]

that weren't my ideas, I just found it in the mentioned link in my first post (on Stackexchange) and modified it slightly. For questions you have to ask the person who posted it there.

POSTED BY: Michael Steffen
Answer
15 days ago

I meanwhile found the probably original source of this code: It is contained in the documentation on FilledCurve (the last one of the "Neat Examples"). But the question remains: How could one find the useful option "TextMode" -> "Outlines" of the function ImportString other than by chance and what are possibly other options? To me it seems that ImportString is poorly documented.

POSTED BY: Henrik Schachner
Answer
15 days ago

Group Abstract Group Abstract