2
$\begingroup$

What do I need to do to make the text keep the same proportions as the rectangle even when I increase the image size?

altura=180;largura=250;
g=Graphics[{White,EdgeForm[Thickness[0.01]],Rectangle[{0,0},{largura,altura}],Black,Text[Style["TC-01",100],{largura/2,altura/2}]}]

enter image description here

$\endgroup$
3
$\begingroup$

You can use FontSize -> Scaled[s] in Style to get a font whose point size is a fraction s of the horizontal plot range.

Graphics[{White, EdgeForm[Thickness[0.01]], Rectangle[{0, 0}, {largura, altura}], Black, 
   Text[Style["TC-01", FontSize -> Scaled[.3]], {largura/2, altura/2}]}, 
  ImageSize -> #] & /@ {50, 100, 300, 500} // Row

enter image description here

frames = Panel[Graphics[{White, EdgeForm[Thickness[0.01]], 
     Rectangle[{0, 0}, {largura, altura}], Black, 
     Text[Style["TC-01", FontSize -> Scaled[.3]], {largura/2, altura/2}]}, 
     ImageSize -> #], Style[#, 16] &@ToString[ImageSize -> #, StandardForm], 
     ImageSize -> {400, 300}, Alignment -> Center] & /@ 
   Range[30, 300, 10];

ListAnimate[frames, Alignment -> Center, 
 AnimationDirection -> ForwardBackward, Paneled -> False]

enter image description here

$\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.