3
$\begingroup$

I want to generate some graphics that contain framed texts with rounded corners that display correctly in the Working and PrintOut environment. For example,

Graphics[{Inset@Framed[Text[Foobar], RoundingRadius -> 15]}]

generates the first of the following two boxes in a notebook, which is what I want.

Framed Text in Working and PrintOut

However, when I export my notebook to pdf or print it then the frame will look like the second box in the picture, which I do not want. I can fix the second box by using a smaller RoundingRadius but then the box looks almost like a rectangular frame in my notebook.

How can I get a frame with rounded corners that looks like the first example the Working and PrintOut environment?

(I do not want to use the Working environment when printing because then font sizes and such will also change.)

$\endgroup$
  • $\begingroup$ I am running V10.3.1 on OS X. I can not reproduce your problem. The framed text looks the same in both the Working environment, the Printout environment and in saved PDF document. BTW, you have not need to use Inset. Graphics[Text[Framed[Foobar, RoundingRadius -> 15]]] will give the same image as the one you post in your question. $\endgroup$ – m_goldberg Jan 18 '16 at 16:36
  • $\begingroup$ I can confirm what @m_goldberg found on Mac. Just a guess: does it help if you set the ImageSize to a fixed value? Or perhaps try SetOptions[EvaluationNotebook[], WindowSize -> All] - these guesses are based on the hunch that the rounding radius (and/or thickness) is referenced to a different external length scale (outside the plot). In any case, it looks like a bug on Windows. $\endgroup$ – Jens Jan 18 '16 at 20:51
  • $\begingroup$ Thanks for the help. Setting ImageSize->{72} did not help and neither did changing the WindowSize. Also, I am using Mathematica 10.2.0.0 and Win10. $\endgroup$ – Berg Jan 18 '16 at 21:54
  • $\begingroup$ By the way, using Text@Framed is not identical to Inset@Framed@Text. Different (default) fonts are used. (But your suggestion seems better.) $\endgroup$ – Berg Jan 18 '16 at 21:57
3
$\begingroup$

As m_goldberg and Jens could not reproduce the problem on Mathematica 10.3.1 I updated my Mathematica and it turns out that the behavior of Mathematica depends on the version.

Graphics[Text[Framed[Foobar, RoundingRadius -> 7]]]

yields the following. From left to right: V10.2 Notebook, V10.2 PrintOut, V10.3.1 Notebook, V10.3.1 Printout

enter image description here

So the problem still exists in V10.3.1 but it is not nearly as pronounced.

It seems that the problem originates from a buggy implementation of the Magnification in Mathematica. (Someone not using a 4K-display would perhabs not notice it.) The line width of the frame scales faster with Magnification then the fonts. The same framed text at Magnification->5 looks like the following in V10.3.1:

enter image description here

This is even worse in V10.2: Left Magnification 1 and right 5, scaled to the same size (in gimp).

enter image description here

(The Magnification in the 4 samples above is 2.)

$\endgroup$
  • $\begingroup$ (+1) A workaround is to set AbsoluteThickness for the FrameStyle (the default setting seems to be the relative Thickness): Graphics[Text[Framed[Foobar, RoundingRadius -> 7, FrameStyle -> AbsoluteThickness[1]]]]. $\endgroup$ – Alexey Popkov Jan 19 '16 at 20:42
  • $\begingroup$ Very helpful, thanks. $\endgroup$ – Berg Jan 19 '16 at 23:09
0
$\begingroup$

Not a answer.

On my machine (Mathematica 10.0.2, Windows 7), I can reproduce the problem but it looks like a little bit different :

Working environment :

enter image description here

Printout environment :

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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