1
$\begingroup$

A long time ago they gave me many answers to these questions,

Code that generates a mandala

is it possible to enter text in the center something like "abcde" , without the quotes and maybe with some pretty font

$\endgroup$
0

1 Answer 1

2
$\begingroup$

Using the function MakeMandala from this answer by Anton Antonov:

SeedRandom[123];
Show[MakeMandala[],
 Epilog -> {White, Disk[{0, 0}, Scaled[.15]], 
   Text[Style["abcd", 
     FontSize -> Scaled[.1], FontFamily -> "Cambria",FontColor -> Red]]}]

enter image description here

SeedRandom[123]; 

Multicolumn[
 Table[Show[MakeMandala[] /. _GrayLevel -> RandomColor[], 
    Background -> Black,
    Epilog -> {Black, Disk[{0, 0}, Scaled[.15]], 
      Text[Style["abcd", FontSize -> Scaled[.1], 
        FontFamily -> "Cambria", FontColor -> Red]]}],
    10],
 5]

enter image description here

Update: "how the hollow letters can be placed so that they can be painted":

SeedRandom[123];
textoutlines = MeshPrimitives[
  BoundaryDiscretizeGraphics[
   Text[Style["abcd", 
     FontSize -> 5, FontFamily -> "Cambria", FontColor -> Red]], 
   _Text], 1];

Multicolumn[
 Table[Show[MakeMandala[] /. _GrayLevel -> (rc = RandomColor[]), 
   Background -> Black, 
   Epilog -> {Black, Disk[{0, 0}, Scaled[.15]], 
      AbsoluteThickness[.5], rc, textoutlines}, 
   ImageSize -> Medium], 4], 2]

enter image description here

Update 2: Put a frame on mandalas and export to PDF:

textoutlines = MeshPrimitives[
   BoundaryDiscretizeGraphics[
    Text[Style["abcd",
      FontSize -> 5,
      FontFamily -> "Cambria",
       FontColor -> GrayLevel[0.25]]],
    _Text],
   1];

SeedRandom[123];

{rows, columns} = {4, 2};

mandalagrid = Rasterize[Grid@
    Table[Show[MakeMandala[],
      Epilog -> {{White, Disk[{0, 0}, Scaled[.15]]},
        AbsoluteThickness[.5], textoutlines}, 
      Frame -> True, FrameTicks -> None, 
      ImagePadding -> 10, ImageSize -> 500],
     rows, columns], 
   ImageResolution -> 400];

Export["mandalagrid.pdf", mandalagrid]

"mandalagrid.pdf"

enter image description here

$\endgroup$
12
  • $\begingroup$ hi , I get this error ,Show::gtype: MakeMandala is not a type of graphics. I have MMA version 13.0 .Is there a way to adapt it for my version? $\endgroup$
    – zeros
    Jun 2, 2023 at 3:05
  • 1
    $\begingroup$ @zeros, you need to copy the code for functions MakeSeedSegment, MakeSymmetric and MakeMandala from the linked page. $\endgroup$
    – kglr
    Jun 2, 2023 at 3:36
  • $\begingroup$ It took me a while to integrate it, I haven't worked with MMA for a long time, one last question, how can I add, instead of one line, 2 lines something like abc defgh , first line "abc" , second line "defgh" Thanks in advance $\endgroup$
    – zeros
    Jun 2, 2023 at 14:14
  • 2
    $\begingroup$ replace Style["abcd,...] with Style["abc\ndefgh", ...] $\endgroup$
    – kglr
    Jun 2, 2023 at 14:21
  • 1
    $\begingroup$ zeros, please see update 2. $\endgroup$
    – kglr
    Jun 3, 2023 at 15:12

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.