Re: full justification in a text field

2022-02-10 Thread Curry Kenworthy via use-livecode



Curt:

> text with full justification in a field?

Paul:

> no justified option. There is a REALLY old enhancement request
> at https://quality.livecode.com/show_bug.cgi?id=4714

Howdy,

I know how to do this perfectly, and would love to add
full justification to WordLib if there's demand/budget.

Anyone else interested?

Best wishes,

Curry Kenworthy

WordLib: Import MS Word and OpenOffice files in LiveCode!
"Dominate documents with WordLib and LC"
http://livecodeaddons.com/wordlib.html

Innovative Christian LiveCode Training and Consulting
"Better Methods, Better Results"
http://livecodeconsulting.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


RE: full justification in a text field

2022-02-10 Thread Ralph DiMola via use-livecode
I was just trying to make text break at slashes today. I put a zero width 
space(U+200B) after every slash. Although LC did break the lines properly the 
space was not rendered as zero width. It was more like a thin space and a half 
and looked terrible. Is this an engine bug? 

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 
Peter Bogdanoff via use-livecode
Sent: Thursday, February 10, 2022 2:50 PM
To: How to use LiveCode
Cc: Peter Bogdanoff
Subject: Re: full justification in a text field

You’re welcome.

What I really wanted to do is to use a narrower space character, such as the 
"thin space, U+2009" which would allow much better alignment of the right 
margin. That character does display in LiveCode.

https://en.wikipedia.org/wiki/Whitespace_character 

But that seems to require modifying the htmlText to insert that character. 
Maybe someone knows how to set/insert the htmlText of a character without 
messing with the html directly.

Peter Bogdanoff

> On Feb 10, 2022, at 1:03 PM, Curt Ford via use-livecode 
>  wrote:
> 
> Peter, that works really well. Looks like it does require a monospaced font 
> (I tried it with Monaco, looks good), so I'm not sure if my current client 
> will want this approach, but it's nice to have a relatively simple native 
> solution. Thanks so much!
> 
> Curt
> --
> Sent from Postbox 
> <https://www.postbox-inc.com/?utm_source=email_medium=siglink_
> campaign=reach> ___
> 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


___
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


Re: full justification in a text field

2022-02-10 Thread Peter Bogdanoff via use-livecode
You’re welcome.

What I really wanted to do is to use a narrower space character, such as the 
"thin space, U+2009" which would allow much better alignment of the right 
margin. That character does display in LiveCode.

https://en.wikipedia.org/wiki/Whitespace_character 

But that seems to require modifying the htmlText to insert that character. 
Maybe someone knows how to set/insert the htmlText of a character without 
messing with the html directly.

Peter Bogdanoff

> On Feb 10, 2022, at 1:03 PM, Curt Ford via use-livecode 
>  wrote:
> 
> Peter, that works really well. Looks like it does require a monospaced font 
> (I tried it with Monaco, looks good), so I'm not sure if my current client 
> will want this approach, but it's nice to have a relatively simple native 
> solution. Thanks so much!
> 
> Curt
> -- 
> Sent from Postbox 
> 
> ___
> 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


Re: full justification in a text field

2022-02-10 Thread Peter Bogdanoff via use-livecode
I’ve taken a quick stab at this ...

This script adds spaces between words of a line to get it close to the full 
width of the field to create a quick & dirty faux fully-justified field.
In operation, It converts each visible line of text to a LiveCode line 
(delineated by CRs) so the final text has a CR after each visible line. Then it 
uses the formattedWidth property of each line to determine its current width, 
then adds spaces between words to fill out the full width of the line. 

Note that the final width of the text is determined by tMaxWidth, which is 
based on the widest visible line of the field. But that could be changed to use 
the width property of the field itself, minus any V scrollbars.

Peter Bogdanoff


on mouseUp
   set lockscreen to true
   # Add CRs to the end of each line 
   put the formattedText of field "Text2" into field "Text2"
   
   # Find longest line of text. This will determine the overall width of the 
text.
   # This probably should be modified to simply get the width property of the 
field itself.
   put 0 into tMaxWidth
   repeat with x = 1 to the number of lines of field "Text2"
  put the formattedWidth of line x of field"Text2" into tWidth
  if tWidth > tMaxWidth then put tWidth into tMaxWidth
   end repeat
   
   # Format each line
   put tMaxWidth - 5 into tMaxWidth # This number can be adjusted for best 
results

   repeat with x = 1 to (the number of lines of field "Text2" - 1) # Don't 
format last line
  put 100 into maxRepeats # Max number of spaces that can be added to a line
  if line x of field "Text2" is empty then next repeat  
  if the formattedWidth of line x of field"Text2" >= tMaxWidth then next 
repeat
  
  put the number of words of line x of field "Text2" into tWordNum
  if char -1 of word tWordNum of line x of field "Text2" is "." then next 
repeat # Last word of a paragraph
  repeat with z = 1 to maxRepeats
 repeat with y = 1 to (tWordNum - 1) # Don't add spaces after the last 
word of a line
put space after word y of line x of field "Text2"
if the formattedWidth of line x of field "Text2" >= tMaxWidth then 
exit repeat
 end repeat
 if the formattedWidth of line x of field"Text2" >= tMaxWidth then put 
maxRepeats into z
  end repeat
   end repeat
end mouseUp


> On Feb 9, 2022, at 10:28 PM, Tom Glod via use-livecode 
>  wrote:
> 
> Hello Curt,
> 
> The only thing you can do is adjust the font size to maximize the use of
> the width of the field.with the don't wrap enabled. :)
> Remember the margins can be adjusted individually. like so 0,5,5,0
> Also, there is a problem with the margins when the font gets too small. in
> those cases, it helps to have "showborder" enabled, even if the borderwidth
> is set to 0.
> 
> All the best,
> 
> Tom
> 
> Founder & Developer @ MakeShyft R.D.A 
> Build Software with AppStarterStack  for
> Livecode
> Save Time with The Time Saver's Toolbox 
> 
> On Wed, Feb 9, 2022 at 5:50 PM Paul Dupuis via use-livecode <
> use-livecode@lists.runrev.com> wrote:
> 
>> On 2/9/2022 5:24 PM, Curt Ford via use-livecode wrote:
>>> This seems like an awfully basic question, but is it possible to have
>>> text with full justification in a field?
>>> 
>>> I've looked at using WordLib, but this client's text has lots of fussy
>>> formatting (background colors, different colors for individual
>>> characters) that didn't come through well.
>>> 
>>> Thanks for any ideas,
>>> 
>>> Curt
>> 
>> See the Dictionary entry for textAlign:
>> 
>> set the textAlign [of line] of {button | field} to {left | center | right}
>> 
>> There is no justified option. There is a REALLY old enhancement request
>> at https://quality.livecode.com/show_bug.cgi?id=4714
>> 
>> ___
>> 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


___
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


Re: full justification in a text field

2022-02-09 Thread Tom Glod via use-livecode
Hello Curt,

The only thing you can do is adjust the font size to maximize the use of
the width of the field.with the don't wrap enabled. :)
Remember the margins can be adjusted individually. like so 0,5,5,0
Also, there is a problem with the margins when the font gets too small. in
those cases, it helps to have "showborder" enabled, even if the borderwidth
is set to 0.

All the best,

Tom

Founder & Developer @ MakeShyft R.D.A 
Build Software with AppStarterStack  for
Livecode
Save Time with The Time Saver's Toolbox 

On Wed, Feb 9, 2022 at 5:50 PM Paul Dupuis via use-livecode <
use-livecode@lists.runrev.com> wrote:

> On 2/9/2022 5:24 PM, Curt Ford via use-livecode wrote:
> > This seems like an awfully basic question, but is it possible to have
> > text with full justification in a field?
> >
> > I've looked at using WordLib, but this client's text has lots of fussy
> > formatting (background colors, different colors for individual
> > characters) that didn't come through well.
> >
> > Thanks for any ideas,
> >
> > Curt
>
> See the Dictionary entry for textAlign:
>
> set the textAlign [of line] of {button | field} to {left | center | right}
>
> There is no justified option. There is a REALLY old enhancement request
> at https://quality.livecode.com/show_bug.cgi?id=4714
>
> ___
> 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


Re: full justification in a text field

2022-02-09 Thread Paul Dupuis via use-livecode

On 2/9/2022 5:24 PM, Curt Ford via use-livecode wrote:
This seems like an awfully basic question, but is it possible to have 
text with full justification in a field?


I've looked at using WordLib, but this client's text has lots of fussy 
formatting (background colors, different colors for individual 
characters) that didn't come through well.


Thanks for any ideas,

Curt


See the Dictionary entry for textAlign:

set the textAlign [of line] of {button | field} to {left | center | right}

There is no justified option. There is a REALLY old enhancement request 
at https://quality.livecode.com/show_bug.cgi?id=4714


___
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