Text Field Rotation

Something you want to see in a LiveCode product? Want a new forum set up for a specific topic? Talk about it here.

Moderator: Klaus

cmhjon
Posts: 191
Joined: Tue Aug 04, 2015 11:55 am

Text Field Rotation

Post by cmhjon » Wed Jan 04, 2023 8:39 pm

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 :)

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10094
Joined: Fri Feb 19, 2010 10:17 am

Re: Text Field Rotation

Post by richmond62 » Wed Jan 04, 2023 8:54 pm

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.

cmhjon
Posts: 191
Joined: Tue Aug 04, 2015 11:55 am

Re: Text Field Rotation

Post by cmhjon » Wed Jan 04, 2023 9:05 pm

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

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10315
Joined: Wed May 06, 2009 2:28 pm

Re: Text Field Rotation

Post by dunbarx » Wed Jan 04, 2023 10:06 pm

What Richmond said.

The "angle" property will rotate any image to any degree without distortion.
Craig
Last edited by dunbarx on Wed Jan 04, 2023 10:09 pm, edited 1 time in total.

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10315
Joined: Wed May 06, 2009 2:28 pm

Re: Text Field Rotation

Post by dunbarx » Wed Jan 04, 2023 10:11 pm

Remember to lock its size and position if you want to resize it.

Craig

stam
Posts: 3069
Joined: Sun Jun 04, 2006 9:39 pm

Re: Text Field Rotation

Post by stam » Thu Jan 05, 2023 12:58 am

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.

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7390
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: Text Field Rotation

Post by jacque » Thu Jan 05, 2023 5:44 pm

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.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

cmhjon
Posts: 191
Joined: Tue Aug 04, 2015 11:55 am

Re: Text Field Rotation

Post by cmhjon » Thu Jan 05, 2023 8:30 pm

Hi Jacque,

Can LC convert text to SVG?

Best regards,
Jon

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7390
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: Text Field Rotation

Post by jacque » Thu Jan 05, 2023 11:44 pm

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/.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10315
Joined: Wed May 06, 2009 2:28 pm

Re: Text Field Rotation

Post by dunbarx » Fri Jan 06, 2023 1:14 am

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

stam
Posts: 3069
Joined: Sun Jun 04, 2006 9:39 pm

Re: Text Field Rotation

Post by stam » Fri Jan 06, 2023 2:01 am

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' ?

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10094
Joined: Fri Feb 19, 2010 10:17 am

Re: Text Field Rotation

Post by richmond62 » Fri Jan 06, 2023 7:52 am

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.

stam
Posts: 3069
Joined: Sun Jun 04, 2006 9:39 pm

Re: Text Field Rotation

Post by stam » Fri Jan 06, 2023 8:53 am

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.

stam
Posts: 3069
Joined: Sun Jun 04, 2006 9:39 pm

Re: Text Field Rotation

Post by stam » Fri Jan 06, 2023 10:13 am

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?

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4171
Joined: Sun Jan 07, 2007 9:12 pm

Re: Text Field Rotation

Post by bn » Fri Jan 06, 2023 11:41 am

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

Post Reply