# Tag Info

66

Here is a start. I'm sure others will come up with better solutions, but I think from here it's mostly down to finding a better algorithm to pick the random lines. First, we get ourselves a Region representation of the text we want to stylise (thanks to yode for simplifying this part): textRegion = DiscretizeGraphics[ Text[Style["MUSEUM", FontFamily ->...

43

Weighted sampling of line segments based on overlap/non-overlap ratio: Module[{reg}, reg = BoundaryDiscretizeGraphics[ Text[Style["MUSEUM", FontFamily -> "Arial"]], _Text, MaxCellMeasure -> 0.1]; Graphics@Line@ RandomSample[(With[{iarea = Quiet@Area@ BoundaryDiscretizeRegion@ ...

42

This problem is probably due to the MathematicaMono font which is introduced in v10. Defining the problem: Some fonts ("[","_","]","=", etc.) are rendered badly with strange thinning in v10 in some notebook magnifications. This is obvious when you compare the renderings from v10 with those from v9. Analyzing the problem: I found that all of these ugly-...

37

Here is another way of making this kind of graphics using version 6 commands. I am not sure how valuable is this different way of making them compared to the other answers of Martin Buettner and kirma, but I do think some of the results look interesting. I was mainly motivated to explore the 3D versions of writing words with straight lines. Code Here is ...

33

Another way that produces a more uniform distribution of lines is to take the DistanceTransform of the text. I start with the text itself: image = Rasterize@Graphics[ Text[ Style["MUSEUM", 64, Bold, FontFamily -> "Arial"] ], ImageSize -> {360, 200}] And the use the distance transform: ImageAdjust@DistanceTransform@ColorNegate@image as ...

31

Import text as a FilledCurve in graphics, using PDF as an intermediate format. Below are modified examples from Documentation Center: text = First[First[ImportString[ExportString[Style["Hi", Italic, FontSize -> 24, FontFamily -> "Times"], "PDF"], "PDF", "TextMode" -> "Outlines"]]]; Outline fonts using different edge and face forms: Graphics[{...

25

I might as well post my comment to Szabolcs as an answer. As Szabolcs noted, the default screen resolution in Mathematica is set to 72 dpi which might not agree with the actual resolution. You can change the screen resolution in the Option Inspector which can be found in the Format menu. Set "Show option values" to "Global preferences" to change Front End ...

23

To make such labeling more user-friendly, I wrote this function (edited to add rotation): stretchText[char_, pos_, scale_, angle_: 0] := Module[{g, coords, xMin, xMax, yMin, yMax}, g = First@First@ImportString[ExportString[char, "PDF"], "TextOutlines" -> True]; coords = Apply[Join, Cases[g, FilledCurve[___, p_] :> Flatten[p, 1], ...

23

The relevant line from this SO post: fontlist = FEEvaluate[FEPrivateGetPopupList["MenuListFonts"]]; Update: The content of the "MenuListFonts" list is system-dependent. In Windows Vista, I get a list that contains only FontFamily: Panel@Row[fontlist[[;; 60]] /. Rule[x_, y_] :> Style[ToString@x, 14, FontFamily -> y], " \[FilledSquare] "] On a ...

20

"Vectorizing" the font: curve = First[First[ ImportString[ExportString[ Style["{",FontFamily ->"Times",FontSize -> 72], "PDF"], "TextMode" -> "Outlines"]]]; cg = Graphics[curve] and then your code, replacing the Inset[] clause by Inset[Pane[cg, ImageSizeAction -> "ResizeToFit"], .... Result (scales OK when resizing the Plot): Edit ...

20

I don't run Windows, but I do know how to fix this problem on Mac OS X (see my web page). Based on that, I can at least provide a guess as to what you should do. However, I can't guarantee that it will work because I have no way to try it. So use this prescription at your own risk: Download the Mathematica fronts from the official web site (they also come ...

20

There is an option for Column or Grid to avoid this: AllowScriptLevelChange cell = Framed[Style[(2*x^(3/2))/3, FontSize -> 14], FrameMargins -> 10, FrameStyle -> {AbsoluteThickness[1], LightGray}, RoundingRadius -> 3]; {cell, Column[{cell}, AllowScriptLevelChange -> False]} UPDATE Honestly, I don't know why Panel doesn't respect ...

19

[Edit: I updated this question to fix a couple of mistakes and to reflect the behavior in 10.3. -jf] The question I'll answer here is "How is the cell style of a given cell resolved." There are several other questions one could ask about option resolution, and I won't attempt to answer all of them here, but I will show in some exhaustive detail, at the ...

18

Font family, size, etc. depends on "Graphics" style in the notebook stylesheet CurrentValue[{StyleDefinitions, "Graphics", "FontSize"}] (* 10 *) CurrentValue[{StyleDefinitions, "Graphics", "FontFamily"}] (* "Times" *) You can manually change it: open Format->Edit Stylesheet..., add Cell[StyleData["Graphics"],FontSize->20] and press Ctrl+Shift+E. ...

18

You can match formatting between Mathematica figures and LaTeX using a small package I just wrote for using LaTeX-snippets in Mathematica: MaTeX. Here's an example: <<MaTeX` Plot[Sin[z], {z, -2 Pi, 2 Pi}, Frame -> True, FrameStyle -> BlackFrame, FrameLabel -> (MaTeX[#, Magnification -> 20/12] &) /@ {"z", "a(z) = \\sin z"}, ...

17

There are a variety of ways to do this. One can use Stylesheets as noted by acl. Perhaps the most direct way is this: For one Notebook: SetOptions[EvaluationNotebook[], FontSize -> 16] For all Notebooks: SetOptions[$FrontEnd, FontSize -> 16] You can also set FontSize for different Box types, such as GraphicsBox: SetOptions[$FrontEnd, ...

16

The "OperatorSubstitution" option does prevent the use of Mathematica fonts, but only for those cases where there were ASCII equivalents. So if your graphic contains expressions which use, for example, parentheses, brackets, braces, or various ASCII operators (plus, minus, asterisk, etc.), then the "OperatorSubstitution" is exactly what you want and you are ...

16

Fonts in version 10.3.1 v1031 = {"Al Bayan", "Al Nile", "Al Tarikh", "American Typewriter", "Andale Mono", "Apple Braille", "Apple Chancery", "Apple Color Emoji", "AppleGothic", "AppleMyungjo", "Apple SD Gothic Neo", "Apple Symbols", "Arial", "Arial Black", "Arial Hebrew", "Arial Hebrew Scholar", "Arial Narrow", "Arial Rounded MT Bold", "...

16

No need to modify a stylesheet, it is sufficient to evaluate SetOptions[$FrontEnd, StyleHints -> {"CodeFont" -> "Courier"}] or equivalently CurrentValue[$FrontEnd, {StyleHints, "CodeFont"}] = "Courier"; for permanently setting the default font to "Courier New" system-wide in Mathematica 11. Note that the undocumented StyleHints option is new in ...

15

You can use my brace function. p2c[p_]:=p[[1]]+I p[[2]]; c2p[p_]:={Re[p],Im[p]}; brace[pa_,pb_,a_:1/10,t_:1/3]:=Module[{θ,ρ}, θ=Arg[p2c[pb-pa]]; ρ=Norm[p2c[pb-pa]]; {Circle[pa+a ρ{Cos[θ],Sin[θ]},a ρ,{π+θ+t π/2,(3π)/2+θ}], Line[{pa+a ρ{Cos[θ],Sin[θ]}+a ρ{Sin[θ],-Cos[θ]},(pa+pb)/2-a ρ{Cos[θ],Sin[θ]}+a ρ{Sin[θ],-Cos[θ]}}], Circle[(pa+pb)/2-a ρ{Cos[θ],Sin[θ]...

14

While this is not an answer, I did not want to add it as a comment. The issue is not specific to Linux, happens under Windows as well (Win7 in particular). Also, it is not specific to font: any monospaced font seems to produce overhangs to the default frame of $n$ characters. While rasterized characters have different image dimensions, as pointed out by ...

14

Straight from the proverbial horse's mouth: Default font changed to Source Code Pro on Mac, Consolas on Windows, and Bitstream Vera Sans Mono on Linux.

13

An important issue in the question seems to be that of speed. So as Sjoerd suggested, I wrote a solution that pre-outlines all the characters in a reasonable range of ASCII characters, and then does the replacements on an arbitrary string. The characters are stored in a table ascii, and their graphic replacements in asciiGraphics. I then define the ...

13

Personally I installed the Latin Modern font for this, which is an OpenType-packaged version of the same font face. When we set the font in Mathematica using the FontFamily option, we need to use the font name that the operating system uses, not the filename of the font. You can find this by looking at a font chooser dialog in any application. Example: ...

12

Mathematica uses two differen sets of styles for displaying graphics on screen and for exporting: ScreenStyleEnvironment for displaying and exporting in raster formats and PrintingStyleEnvironment for printing and exporting to EPS and PDF formats (see here for more details). One way to achieve consistent export to PostScript is to set ...

12

Getting the names of the fonts is pretty easy. I like Heike's solution, but I can remember the following procedure better. Just format the text in some text cell with any font style you like and then enter the menu command Cell > Show Expression (ctrlshiftE on a PC) revealing the formatting instructions. Cell[TextData[StyleBox["aaaaa", FontFamily->"...

12

Mathematica will normally embed the fonts correctly in a PDF. But this only works if the font exists. Papyrus does not have a bold weight. Try with FontWeight->"Bold" deleted and see if this works. I don't have Papyrus on my Windows machine, but I checked that Kristen ITC does not embed if it is bold, and does if the FontWeight option is removed.

11

Mathematica automatically replaces many operators found in normal text fonts with operators in a Mathematica font. You can change that behavior as follows: SetOptions[EvaluationNotebook[], PrivateFontOptions -> {"OperatorSubstitution" -> False}] Test: ListPlot[Table[RandomReal[NormalDistribution[], {20, 2}], {2}], PlotStyle -> PointSize[0.02],...

11

Mathematica will only let you use fonts installed on the system. I have two suggestions here: At the top of your CDF file, display a link depending on the operating system, pointing to the correct file for downloading the font link = If[$OperatingSystem == "Linux" ||$OperatingSystem == "Windows", Hyperlink["Download font for " <> \$...

11

The Program style is purpose-built for this sort of thing: If you do not like the look of the bars above and below the cell, you can remove them by selecting the cell and changing the CellFrame option in the Option Inspector:

Only top voted, non community-wiki answers of a minimum length are eligible