chaoticbob / Cinder-SdfText

libcinder.org
SIL Open Font License 1.1
40 stars 20 forks source link

Scaling individual runs? #26

Open creativexp opened 7 years ago

creativexp commented 7 years ago

Hi,

I want to be able to scale the a Run after its been created. I dont want to destroy it and create it in the new scale. This seems wasteful and slow. I would rather keep the original run and change the scale in DrawOptions. The scale in Run::Options does not seem to be used anywhere.

I have added a non-const getOptions() function to Run so that i can call Run->getOptions()->setDrawScale(new scale) .

I can now scale a Run after i have created (unless you have already implemented this another way). This works fine for text that does not have any line breaks(i.e does not fit on one line). But for text that does have line breaks the space between the lines grows exponentially. Instead of being based on the new scaled height of the text.

So how to scale individual runs that have line breaks?

Scale = 1.0

unscaled

Scale = 3.0

scaled