Page 1 of 1
Troubles with htmlText superscript ² on Mac
Posted: Fri Dec 14, 2012 3:49 am
by Simon
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
Re: Troubles with htmlText superscript ² on Mac
Posted: Fri Dec 14, 2012 11:53 am
by Klaus
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
Re: Troubles with htmlText superscript ² on Mac
Posted: Fri Dec 14, 2012 11:56 am
by Mark
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
Re: Troubles with htmlText superscript ² on Mac
Posted: Fri Dec 14, 2012 12:40 pm
by Klaus
Ah, yes, older versions...
If not noted otherwise, I always presume the latest version (HINT, HINT!)

Re: Troubles with htmlText superscript ² on Mac
Posted: Fri Dec 14, 2012 7:46 pm
by Simon
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
Re: Troubles with htmlText superscript ² on Mac
Posted: Sat Dec 15, 2012 12:34 pm
by Mark
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
Re: Troubles with htmlText superscript ² on Mac
Posted: Sat Dec 15, 2012 9:10 pm
by Simon
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, ² should have been easy.
I'm good for now on this. Thanks for the help.
Simon
Re: Troubles with htmlText superscript ² on Mac
Posted: Sat Dec 15, 2012 9:26 pm
by Mark
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
Re: Troubles with htmlText superscript ² on Mac
Posted: Sat Dec 15, 2012 10:26 pm
by Simon
Character Map!
Or cut n' paste.
Wasn't ever expecting anything more then just plain text. Not part of the spec.
Simon
Re: Troubles with htmlText superscript ² on Mac
Posted: Sun Dec 16, 2012 4:02 am
by Mark
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