Page 1 of 1

Rotated text example doesn't work

Posted: Thu Oct 19, 2017 4:46 pm
by MaxV
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 8097 times
What's wrong?

Re: Rotated text example doesn't work

Posted: Thu Oct 19, 2017 5:06 pm
by LiveCode_Panos
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

Re: Rotated text example doesn't work

Posted: Fri Oct 20, 2017 11:31 am
by MaxV
No, it's not that. See this screenshot:
Screenshot2.png
Screenshot2.png (6.3 KiB) Viewed 8066 times

Re: Rotated text example doesn't work

Posted: Sat Oct 28, 2017 10:40 am
by [-hh]
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).

Re: Rotated text example doesn't work

Posted: Sun Mar 11, 2018 11:18 pm
by livecodeali
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

Re: Rotated text example doesn't work

Posted: Sun Mar 11, 2018 11:56 pm
by [-hh]
Hi Ali,
Thanks for that.
But what are the criteria for bug fixes in LC 8 Builder?

Re: Rotated text example doesn't work

Posted: Wed Mar 21, 2018 4:48 pm
by livecodeali
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.

Re: Rotated text example doesn't work

Posted: Wed Mar 21, 2018 8:34 pm
by richmond62
WText.png
Whacky text.livecode.zip
(3.06 KiB) Downloaded 285 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 308 times
Of course the resultant "text" is no editable.