Question:

How correctly align text as graphics

Leah: 26 June 2022

When I try this:

Framed@Graphics[{Text[
    Style["Text", FontSize -> 50, Bold, Black, Background -> Green, 
     FontFamily -> "Calibri"]]}]

enter image description here

I get a centered text with a large empty space around.

How can I align the text e.g. to left or how can I make the frame as large as the text is?

Answer:
Naomi: 26 June 2022

I would use a slightly different approach which gives more flexibility.

Graphics[{Green, EdgeForm[Black], Rectangle[{0, 0}, {2, 1}], (*Green Background*)
 Inset[Style["Text", FontSize -> 150, Bold, Black,FontFamily -> "Calibri"],
 {0, 0}, {Left, Bottom}]}] (*position and alignment*)

enter image description here

Or some tilting

q = Pi/6;
Graphics[{Green, EdgeForm[Black], Rectangle[{0, 0}, {2, 1}], 
 Inset[Style["Text", FontSize -> 100, Bold, Black, FontFamily -> "Calibri"],
 {0.5, 0}, {-1,-0.5}, {Cos[q],Sin[q]}]}]

enter image description here

Look at Inset (https://reference.wolfram.com/language/ref/Inset.html) for more options.


For Text in a box

wordbox[text_, fontsize_, fontcolor_, font_, background_] := 
       Framed[ImageCrop@Rasterize@Style[text, FontSize -> fontsize, Bold, fontcolor, 
       FontFamily -> font, Background -> background],
       Background -> background, FrameMargins -> 0]

wordbox["Text", 100, Blue, "Calibri", Red]
wordbox["Texture", 100, Black, "Calibri", Green]

enter image description here