2

This is probably a question that has been answered many times before. For some reason I cannot find the answer in the Asymptote manual or in StackExchange although I have searched diligently. I have trouble understanding why labels do not scale with picture size. If I write the following code,

picture pic1;
size(pic1,40);

path box = (0,0) -- (1,0) -- (1,1) -- (0,1) -- cycle ;
pair center = (0.5,0.5);
draw(pic1,box);
label(pic1,"M",center);

picture pic2;
size(pic2,20);
draw(pic2,box);
label(pic2,"M",center);

add(pic1.fit(),(0,0),W);
add(pic2.fit(),(0,0),E);

then although the box is the same size in both pictures it will scale with the picture size. enter image description here The font which is 12pt does not. I can scale it manually by multiplying the label with a scale() transform but I cannot find anything in the documentation that would make the label scale automatically with the picture size. Any ideas?

1 Answer 1

1

After some dormant neurons fired in my brain I discovered that Asymptote provides

Label Label(string s="", align align=NoAlign, pen p=nullpen, embed embed=Rotate, filltype filltype=NoFill);

which using the option embed=Scale does exactly what I was asking for (the Label returned by the function can be used in a label() command to make sure the text scales with the picture).

Very embarrassing..

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .