Troubles with htmlText superscript ² on Mac

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am

Troubles with htmlText superscript ² on Mac

Post by Simon » Fri Dec 14, 2012 3:49 am

I'm not getting the expected results from this code on my Mac:

Code: Select all

 put "10²" into tCode
set the htmlText of fld "result" to tCode
The Mac does not display the superscript 2 but my Win machine does.
I see that when I create the superscript on the Mac and put the htmlText into another fld it contains the <font> </font> tag.

Now how do I get my Win machine to include the <font> tags like the Mac does?

Thanks,
Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

Klaus
Posts: 14213
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Troubles with htmlText superscript &sup2; on Mac

Post by Klaus » Fri Dec 14, 2012 11:53 am

Hi Simon,

I'm not sure I understand?

Please see the attached screenshot from my Mac, the superscript is shown in one field
and its HTML text does not contain any "font" tag?


Best

Klaus
Attachments
superscript.jpg
superscript.jpg (8.04 KiB) Viewed 8851 times

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Re: Troubles with htmlText superscript &sup2; on Mac

Post by Mark » Fri Dec 14, 2012 11:56 am

Hi Simon,

Although your example doesn't seem to work for me in Revolution 4.5, it seems to work in more recent versions of LiveCode. Do you have different versions of LiveCode/Revolution installed on Win and Mac?

The following example should work on both platforms:

Code: Select all

on mouseUp
     put 102 into fld 1
     set the textShift of the last char of fld 1 to -3
     set the textSize of the last char of fld 1 to \
            (the effective textSize of char -2 of fld 1) - 2
     put the htmlText of fld 1
end mouseUp
This produces the following HTML:

Code: Select all

<p>10<font size="9"><sup>2</sup></font></p>
and seems to work everywhere.

Kind regards,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

Klaus
Posts: 14213
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Troubles with htmlText superscript &sup2; on Mac

Post by Klaus » Fri Dec 14, 2012 12:40 pm

Ah, yes, older versions...

If not noted otherwise, I always presume the latest version (HINT, HINT!) 8)

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am

Re: Troubles with htmlText superscript &sup2; on Mac

Post by Simon » Fri Dec 14, 2012 7:46 pm

Sorry Klaus,
You are correct in 5.5 it does work correctly, this is for an older 4.6 app.
Mark,
The initial text is created by a user typing into a fld (on Win) that is saved as a text file and read by Mac and Win machines so I couldn't use textShift.
I had thought the htmlText property was pretty solid on both OS.
Don't suppose there is a workaround without using replace??

Thanks,
Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Re: Troubles with htmlText superscript &sup2; on Mac

Post by Mark » Sat Dec 15, 2012 12:34 pm

Hi Simon,

Why can't you use textShift? What kind of interface do you use for the user to enter the text? Could you use rtfText instead of htmlText and does that make a difference (I haven't tried it myself)?

Kind regards,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am

Re: Troubles with htmlText superscript &sup2; on Mac

Post by Simon » Sat Dec 15, 2012 9:10 pm

Hi Mark,
I'm not using much more then fld with a post button for an interface. Using RTFText did sort of work, the Mac displayed the superscript 2 but then the font size of the entire message was tiny. I can fix that.
Still not sure about using the TextShift, I understand how to do it just not in the context of the user entering text.

Bummer about HTMLText and LC ver < 5, &sup2; should have been easy.
I'm good for now on this. Thanks for the help.

Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Re: Troubles with htmlText superscript &sup2; on Mac

Post by Mark » Sat Dec 15, 2012 9:26 pm

Simon,

Please explain your interface a little more. When the user enters 102, there must be a way for the user to tell that the "2" must be superscript and apparently you don't do this by script. So, how do you do this?

Kind regards,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am

Re: Troubles with htmlText superscript &sup2; on Mac

Post by Simon » Sat Dec 15, 2012 10:26 pm

Character Map!
Or cut n' paste.
Wasn't ever expecting anything more then just plain text. Not part of the spec.

Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Re: Troubles with htmlText superscript &sup2; on Mac

Post by Mark » Sun Dec 16, 2012 4:02 am

Hi Simon,

I can understand that cat and paste may cause problems, but a character map implies scripting and would allow you to use the textShift. If you'd disable the pasteKey, you'd be able to make sure that the character map is the only input method available to your users and that would solve the problem.

Kind regards,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

Post Reply