# Trying to get text in square to transform together

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

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

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}]}}]; 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}}]}] 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}}]}] • Excellent, thanks! – Gerald Bilodeau Sep 28 at 17:15
fig = Graphics[{EdgeForm[Thick], LightGray,
Rectangle[], {Black,
Text[Style[F, FontSize -> 442, Bold, FontFamily -> Arial], {1/2,
1/2}]}}]
Rotate[fig, 40Degree]


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] 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] 