2
$\begingroup$

I use

  Graphics[{EdgeForm[Thick], LightGray, Rectangle[], {Black, Text[Style[F, FontSize -> 442, Bold, FontFamily -> Arial], {1/2, 1/2}]}}]

to put an "F" in a square. When I rotate,

    Graphics[GeometricTransformation[{EdgeForm[Thick], LightGray, Rectangle[], {Black,Text[Style[F, FontSize -> 442, Bold, FontFamily -> Arial], {1/2, 1/2}]}}, RotationTransform[30 Degree]], Frame -> True]

The "F" is now bigger than the square. I read previous questions/answers, but the best,

/. Graphics -> Identity // Graphics

Fixes 180 degrees, but not others. Thanks

$\endgroup$
  • 1
    $\begingroup$ I want to help, but I can't use the F word. I have some reputation to keep. $\endgroup$ – Sumit Sep 27 at 16:35
3
$\begingroup$

Here is a different approach. First I create an image of the word.

text = Graphics[{EdgeForm[Thick], LightGray, 
    Rectangle[], {Black, Text[Style["Q", FontSize -> 442, Bold, 
    FontFamily -> "Arial"], {1/2, 1/2}]}}];

enter image description here

Then I place it on the square

Graphics[{Texture[text], 
  Polygon[RotationTransform[30 Degree][{{0, 0}, {1, 0}, {1, 1}, {0, 1}}], 
  VertexTextureCoordinates -> {{0, 0}, {1, 0}, {1, 1}, {0, 1}}]}]

enter image description here

One advantage here is that you can use any polygon. For example

Graphics[{Texture[text], 
  Polygon[RotationTransform[0 Degree][{{0, 0}, {1, 0}, {2, 1}, {1, 1}}], 
  VertexTextureCoordinates -> {{0, 0}, {1, 0}, {1, 1}, {0, 1}}]}]

enter image description here

| improve this answer | |
$\endgroup$
  • $\begingroup$ Excellent, thanks! $\endgroup$ – Gerald Bilodeau Sep 28 at 17:15
2
$\begingroup$
fig = Graphics[{EdgeForm[Thick], LightGray, 
   Rectangle[], {Black, 
    Text[Style[F, FontSize -> 442, Bold, FontFamily -> Arial], {1/2, 
      1/2}]}}]
Rotate[fig, 40Degree]
| improve this answer | |
$\endgroup$
1
$\begingroup$

1. Add the option ImageSize using the form ImageSize -> 1 - size (with large enough size):

Row[{Graphics[{{EdgeForm[Thick], LightGray, Rectangle[]}, {Black, 
     Text[Style[F, FontSize -> 442, Bold, FontFamily -> "Arial"], {1/2, 1/2}]}}, 
    Frame -> True, ImageSize -> 1 -> 350], 
  Graphics[GeometricTransformation[{{EdgeForm[Thick], LightGray, Rectangle[]},
     {Black, Text[Style[F, FontSize -> 442, Bold, FontFamily -> "Arial"], {1/2, 1/2}]}}, 
    RotationTransform[30 Degree]],
   Frame -> True, ImageSize -> 1 -> 350]}, Spacer[5]]

enter image description here

2. Transform text primitives to FilledCurves use them as Inset:

text = Graphics @ ImportString[ExportString[
      Style["F", Italic, FontSize -> 442, Bold, 
       FontFamily -> "Arial"], "PDF"], "PDF", "TextMode" -> "Outlines"][[1, 1]];

Row[{Graphics[{EdgeForm[Thick], LightGray, 
    Rectangle[], {Black, Inset[text, {1/2, 1/2}]}},
   Frame -> True, ImageSize -> 200],
  Graphics[GeometricTransformation[{EdgeForm[Thick], LightGray, 
     Rectangle[], {Black, Inset[text, {1/2, 1/2}]}}, 
     RotationTransform[30 Degree]], 
  Frame -> True, ImageSize -> 200]}, Spacer[5]]

enter image description here

| improve this answer | |
$\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.