What is the difference between styledText and formattedStyledText? A quick test 
yielded identical results. StyledText is in the dictionary.

Ralph DiMola
IT Director
Evergreen Information Services
rdim...@evergreeninfo.net


-----Original Message-----
From: use-livecode [mailto:use-livecode-boun...@lists.runrev.com] On Behalf Of 
J. Landman Gay via use-livecode
Sent: Tuesday, February 18, 2020 2:15 PM
To: How to use LiveCode
Cc: J. Landman Gay
Subject: Re: Translate metadata to field content

Thanks for the reply guys, both Hermann and Mark, and Bernd who sent me 
materials offline. I'll be going over these suggestions to see what works best. 
The file content can be very long especially when separated into runs (more 
than 200,000 runs for an average file) so speed will matter since this is 
headed for a mobile app.

I was surprised to see two things:

1. FormattedStyledText appears nowhere in the dictionary. I didn't know it 
existed.

2. FormattedStyledText treats some punctuation as a new run, even if it has not 
changed text style. For example, semi-colons are independent runs. Very odd.

I need to do some experimentation and timing tests, but thanks to all for the 
responses.

On 2/17/20 6:25 PM, Mark Waddingham via use-livecode wrote:
> There’s the formattedStyledText property which is like the formattedText but 
> in the form of a style array. If you sum the number of chars in each run up 
> until you find your tag, then you can should be able to use the 
> formattedheight of char 1 up to the summed index to get the vscroll you need.
> 
> Warmest Regards,
> 
> Mark.
> 
> Sent from my iPhone
> 
>> On 17 Feb 2020, at 22:50, J. Landman Gay via use-livecode 
>> <use-livecode@lists.runrev.com> wrote:
>>
>> Thanks, I'll save that for someday. In this case though, the text is 
>> wrapped and there are anchors scattered around inside paragraphs. Unless 
>> someone else has an idea it looks like I'm going to have to extract lookup 
>> tables. That's going to be quite a job.
>>
>>> On 2/17/20 3:59 PM, Richard Gaskin via use-livecode wrote:
>>> J. Landman Gay wrote:
>>>> I'm still working on htmltext in a field. There are anchors that indicate 
>>>> positions elsewhere in the file. A browser will automatically find and 
>>>> scroll to the right place in the text. I need to reproduce that.
>>>>
>>>> Is there a way to translate an anchor like "#12345" to the location in the 
>>>> visible field text it links to?
>>>>
>>>> I've thought of a couple of alternate ways to do it involving lookup 
>>>> files, but it would be better to do a direct translation to avoid the 
>>>> extra overhead.
>>> The closest I have doesn't account for softwraps, but FWIW:
>>> function fwAnchorTagLine pFldObj, pTag
>>>     local tA
>>>     local tLastLine
>>>     local tNumRuns
>>>     put the styledText of pFldObj into tA
>>>     put item 2 of extents(tA) into tLastLine
>>>     repeat with i = 1 to tLastLine
>>>        put item 2 of extents(tA[i]["runs"]) into tNumRuns
>>>        repeat with j = 1 to tNumRuns
>>>           if pTag is in tA[i]["runs"][j]["style"]["linkText"] \
>>>                 AND "link" is not in \
>>>                    tA[i]["runs"][j]["style"]["textStyle"] then
>>>              return i
>>>           end if
>>>        end repeat
>>>     end repeat
>>> end fwAnchorTagLine
>>
>>
>> -- 
>> Jacqueline Landman Gay         |     jac...@hyperactivesw.com
>> HyperActive Software           |     http://www.hyperactivesw.com
>>
>>
>> _______________________________________________
>> use-livecode mailing list
>> use-livecode@lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your subscription 
>> preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
> 
> 
> _______________________________________________
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription 
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
> 


-- 
Jacqueline Landman Gay         |     jac...@hyperactivesw.com
HyperActive Software           |     http://www.hyperactivesw.com


_______________________________________________
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


_______________________________________________
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Reply via email to