Rotated text example doesn't work

Moderators: LCMark, LCfraser

Post Reply
MaxV
Posts: 1489
Joined: Tue May 28, 2013 2:20 pm
Location: Italy
Contact:

Rotated text example doesn't work

Post by MaxV » Thu Oct 19, 2017 4:46 pm

Hi,
I found this example on livecode site:

Code: Select all

widget community.livecode.myname.rotatedtext
 use com.livecode.canvas
 use com.livecode.widget
 use com.livecode.engine
 use com.livecode.library.widgetutils

 metadata title is "Rotated text example"
 metadata author is "myName mySurname"
 metadata version is "1.0.2"

 variable mRotation as Number

 property "rotation" get mRotation set setRotation
 metadata widgetTheme.editor is "com.livecode.pi.integer "

 public handler SetRotation(in pRotation as Number) returns nothing
    put pRotation into mRotation
    redraw all
 end handler

public handler OnPaint()
 variable tText as String
 variable tHeight as Number
 variable tWidth as Number
 variable tRectangle as Rectangle
 variable tPath as Path

 put my width into tWidth
 put my height into tHeight
 put "Hello world!" into tText

 rotate this canvas by mRotation
 put rectangle path of rectangle [0,0,tWidth,tHeight] into tPath
 rotate tPath by (-1 * mRotation)
 put the bounding box of tPath into tRectangle

 fill text tText at center of tRectangle on this canvas

 end handler
end widget
But I get this:
Screnshot.png
Screnshot.png (4.9 KiB) Viewed 720 times
What's wrong?
Livecode Wiki: http://livecode.wikia.com
My blog: http://livecodeitalia.blogspot.it
To post code use this: http://tinyurl.com/ogp6d5w

LiveCode_Panos
Livecode Staff Member
Livecode Staff Member
Posts: 388
Joined: Fri Feb 06, 2015 4:03 pm

Re: Rotated text example doesn't work

Post by LiveCode_Panos » Thu Oct 19, 2017 5:06 pm

Hi Max,

From the screenshot, it looks like the rect of widget is smaller than it should be, so the text is cropped. Try clicking on the rect on Edit mode and then resize it.

Best,
Panos


PS: Hermann has created a pretty rotatingText widget

MaxV
Posts: 1489
Joined: Tue May 28, 2013 2:20 pm
Location: Italy
Contact:

Re: Rotated text example doesn't work

Post by MaxV » Fri Oct 20, 2017 11:31 am

No, it's not that. See this screenshot:
Screenshot2.png
Screenshot2.png (6.3 KiB) Viewed 689 times
Livecode Wiki: http://livecode.wikia.com
My blog: http://livecodeitalia.blogspot.it
To post code use this: http://tinyurl.com/ogp6d5w

[-hh]
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1682
Joined: Thu Feb 28, 2013 11:52 pm
Location: Göttingen, DE

Re: Rotated text example doesn't work

Post by [-hh] » Sat Oct 28, 2017 10:40 am

This is a bug of LCB (linux only), the "orientedText"-widget does also not work correctly on linux.
#20446 (at least related to that bug as it shows the same effect).
shiftLock happens

livecodeali
Livecode Staff Member
Livecode Staff Member
Posts: 160
Joined: Thu Apr 18, 2013 2:48 pm

Re: Rotated text example doesn't work

Post by livecodeali » Sun Mar 11, 2018 11:18 pm

Just a quick note to say that this bug has been fixed in the develop branch, so the rotated text example will work on all platforms from 9.0 RC 1

[-hh]
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1682
Joined: Thu Feb 28, 2013 11:52 pm
Location: Göttingen, DE

Re: Rotated text example doesn't work

Post by [-hh] » Sun Mar 11, 2018 11:56 pm

Hi Ali,
Thanks for that.
But what are the criteria for bug fixes in LC 8 Builder?
shiftLock happens

livecodeali
Livecode Staff Member
Livecode Staff Member
Posts: 160
Joined: Thu Apr 18, 2013 2:48 pm

Re: Rotated text example doesn't work

Post by livecodeali » Wed Mar 21, 2018 4:48 pm

In this case the main criterion for not fixing in 8 was (lack of) ease of backporting- unfortunately it would have been a different fix due to the graphics library changes in 9. Also in this case proximity to 9 GM was a factor.

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 2437
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria
Contact:

Re: Rotated text example doesn't work

Post by richmond62 » Wed Mar 21, 2018 8:34 pm

WText.png
Whacky text.livecode.zip
(3.06 KiB) Downloaded 10 times
This was done in LiveCode 8.1.8.

It is a fairly long-winded procedure:

1. Prepare text as a PNG image.

2. Convert PNG image to an SVG vector file.

3. Import the SVG vector file as an SVG widget into LiveCode.

I used Inkscape to do the vectorisation, followed by my own SVG import stack:
SVG Importer.livecode.zip
(73.99 KiB) Downloaded 9 times
Of course the resultant "text" is no editable.

Post Reply

Return to “LiveCode Builder”