Page 1 of 2

Text Field Rotation

Posted: Wed Jan 04, 2023 8:39 pm
by cmhjon
Hi LC,

I would to request the ability to rotate text fields. Currently, this...can...be achieved using a widget but the issue I have is that rotated text appears fuzzy/low res both on screen and when printed. I have written two apps for my team that use the aforementioned widget the but their complaint is the same as mine in that rotated text looks fuzzy/low res.

Can this be implemented in LC natively?

Best regards,
Jon :)

Re: Text Field Rotation

Posted: Wed Jan 04, 2023 8:54 pm
by richmond62
Do you want the rotated text to stay text?

If not, the EASY thing would be to take a SNAPSHOT of the field and rotate the resultant image.

Re: Text Field Rotation

Posted: Wed Jan 04, 2023 9:05 pm
by cmhjon
Hi Richmond!

Yes, I would like the rotated text to stay as text so that it prints sharply...

Unless, there is a way to import the snapshot in high resolution so the snapshot still looks sharp?

Best regards,
Jon

Re: Text Field Rotation

Posted: Wed Jan 04, 2023 10:06 pm
by dunbarx
What Richmond said.

The "angle" property will rotate any image to any degree without distortion.
Craig

Re: Text Field Rotation

Posted: Wed Jan 04, 2023 10:11 pm
by dunbarx
Remember to lock its size and position if you want to resize it.

Craig

Re: Text Field Rotation

Posted: Thu Jan 05, 2023 12:58 am
by stam
Also if wanting to resize a snapshot image, don't forget to

Code: Select all

set the resizeQuality of image <image name> to "best"
to ensure your image is pin-sharp for printing...
S.

Re: Text Field Rotation

Posted: Thu Jan 05, 2023 5:44 pm
by jacque
Unfortunately, rotated images are also usually jagged. Converting the text to SVG might help. But each printer is limited to a specific resolution so depending on the printer itself even SVG images may not print cleanly.

Re: Text Field Rotation

Posted: Thu Jan 05, 2023 8:30 pm
by cmhjon
Hi Jacque,

Can LC convert text to SVG?

Best regards,
Jon

Re: Text Field Rotation

Posted: Thu Jan 05, 2023 11:44 pm
by jacque
cmhjon wrote:
Thu Jan 05, 2023 8:30 pm
Can LC convert text to SVG?
Not directly but there are lots of web sites that can. I've used this one: https://convertio.co/txt-svg/.

Re: Text Field Rotation

Posted: Fri Jan 06, 2023 1:14 am
by dunbarx
I imported another screenshot as an image.

If I do not lock the size and position, changing the angle seems to do its job really well; i cannot see any distortion at all.

If I do lock those properties, the rotated image is distorted, and jaggedness is the least of its problems

I thought I had done the locking, in the earlier posts. Either I did not, or am nuts, or both.

Craig

Re: Text Field Rotation

Posted: Fri Jan 06, 2023 2:01 am
by stam
out of curiosity: are you using

Code: Select all

set the resizeQuality of image <image name> to "best"
in the the handler that creates 'jaggies' ?

Re: Text Field Rotation

Posted: Fri Jan 06, 2023 7:52 am
by richmond62
As one cannot convert text into SVGs inwith LiveCode, observing that an SVG image of text can be rotated
without jaggy edges is a bit beside the point.

As far as I can see the OP wishes to be able to rotate text that is, prior to rotation, available as text in a stack.

Re: Text Field Rotation

Posted: Fri Jan 06, 2023 8:53 am
by stam
Yes Richmond.

Ignoring the “convert to SVG” hypothesis, the approach suggested was to create a snapshot from the field and rotate that image, presumably as PNG, but apparently that caused jaggies. Hence my comment above.

Re: Text Field Rotation

Posted: Fri Jan 06, 2023 10:13 am
by stam
To answer my own question, no that doesn't help, unless I'm doing it wrong. Also setting the metadata ["density"] to very high DPI, eg 2400 doesn't produce a sharper image either it seems...

My feeble attempt at this, for a field called "captionField":

Code: Select all

on mouseup
    local tImage, tMetadata
    set the resizeQuality of the templateImage to "best"
    put 2400 into tMetadata["density"]
    create image "rotatedText"
    export snapshot from field "captionfield" with metadata tMetadata to tImage as png
    set the text of image "rotatedText" to tImage
    set the loc of image "rotatedText" to the loc of this card
    set the angle of image "rotatedText" to 45
end mouseup
produces an image which is fuzzier than source:
Screenshot 2023-01-06 at 09.05.10.png
so while I can produce an image of rotated text, this is still fuzzier than source... any other options?

Re: Text Field Rotation

Posted: Fri Jan 06, 2023 11:41 am
by bn
stam wrote:
Fri Jan 06, 2023 10:13 am
so while I can produce an image of rotated text, this is still fuzzier than source... any other options?
Hi Stam,

I had a try on this using the widget "rotate text"

https://forums.livecode.com/viewtopic.p ... 03#p220795

and somehow it looks a bit better. Especially when looking at it in Preview as pdf. Jon wanted the printed text to be crisper than what the widget produces (it is apparently rendered for printing that makes it look fuzzy in print)

It is a bit awkward to implement but seems to work better than to take the snapshot from a field and set the angle. (I tried Richmond's approach with a text field at higher textSize and scale the image down but still not great) Definitely try to create a PDF from the output.

Kind regards
Bernd