Request for feedback

Michael Doub mikedoub at gmail.com
Sun Nov 30 11:56:43 EST 2014


I would like the lists assistance in flushing out a enhancement request 
proposal that I would like to make to the development team. Because of a 
bug in the pageranges function where it did not take into account the 
spaceabove and spacebelow properties, i attempted to do this manually.  
I quickly learned that there is no easy way to understand where a line 
is actually wrapped.  I was using the formatted size functions measuring 
each character and run and getting different answers when measuring the 
same text.  This was attributed to kerning and letter spacing issues by 
the support folks.  This was not a very satisfying answer.

After working on this for several weeks, I have come to the conclusion 
that we can not accurately reproduce the algorithms of the field object 
with the current tools available to us.  I would loved to be proven 
wrong here, but I threw in the towel and starting thinking about the the 
information that is really needed to understand what is actually being 
displayed within a field.

I am proposing that a property or function be added to livecode field 
object.  It would be similar to styled text, but it would provide a 
PERFECT representation of what is being displayed within a field.  The 
structure returned would include all attributes needed to understand 
exactly how a field is laid out and how the text was flowed within the 
field.

For the purposes of this discussion a field is made up of lines.
A line is a string terminated by a return.  A line is made up of 
softlines.  A line may contain a single softline or multiple softlines.  
A softline is single row of text that fits in the visual area within the 
field.  SoftLines are made up of runs as defined in styledtext.   A tab 
character is considered a run.

Ok to be clear, a softline is each segment of a line that was wrapped to 
fit in to the field.  ;-)


put the formatedStyledAttributes of fld "foo" into rArray

rArray:
     "height":
     "width":
     "dontwrap":
     "borderwidth":
     "leftMargin":
     "topMargin":
     "rightMargin":
     "bottomMargin":
     [line_Nbr] --  a number for each string terminated by a return
         "borderwidth":
         "leftIndent":
         "rightIndent":
         "padding":
         "spaceAbove":
         "spaceBelow":
         [softline_number]  -- this the segment of the line on a row 
within a field
             "MaxformattedHeight":  -- of the softline including all runs
             "MaxformattedWidth":   -- of the softline including all runs
             "leftIndent":
             "firstIndent":  -- only applicable to the first segment of 
a paragraph
             "rightIndent":
             "padding":
             [run_number]      -- this is the run within the soft line
                                        -- a tab character is considered 
a run
                 "textSize":
                 "textFont":
                 "textStyle":
                 "text":
                 formattedHeight:
                 formattedWidth: -- when text = tab, this is the length 
of space
                                            -- allocated to the tab
             [run_number + 1]
         [softline_number + 1]
     [pgh_Nbr + 1]


I added the MaxFormatted Height/Width so it would be easer to calculate 
the scroll positions.  A function that would tell you the softline 
number of a given chunk would also be a huge help.

I look forward to hearing your comments about this proposal.   I am 
specifically looking for suggestions on how lists should be handled.

Regards,
   Mike





More information about the use-livecode mailing list