Page 1 of 1
Text Character Width?
Posted: Wed May 26, 2021 6:49 pm
by cmhjon
Hi all,
Does LC have any way of changing the width of text characters in a text box? In page layout applications, this is called horizontal scale. The following image shows what I mean:
https://creativepro.com/wp-content/uplo ... caling.png
I'm already using a condensed font in the text field but need to squeeze the width of the characters a little more.
I checked the dictionary and didn't find anything that seemed to fit my needs.
Thank you,
Jon
Re: Text Character Width?
Posted: Wed May 26, 2021 7:35 pm
by richmond62
-
I suspect you'll have to use font substitution.
Re: Text Character Width?
Posted: Wed May 26, 2021 7:37 pm
by Klaus
Hi Jon,
no, sorry, LC does not provide any of these pleasantries that dedicated layout application supply!
Best
Klaus
Re: Text Character Width?
Posted: Wed May 26, 2021 8:04 pm
by cmhjon
Well poop!
Thank you,
Jon
Re: Text Character Width?
Posted: Wed May 26, 2021 8:47 pm
by kdjanz
If the field is just a label for a control that does not need to change, you could take a snapshot to turn it into a graphic and then squeeze the graphic rectangle right down to unintelligibility. That won't work for a field where the text is changing however.
Re: Text Character Width?
Posted: Wed May 26, 2021 10:02 pm
by cmhjon
Hi kdjanz,
Unfortunately, the text changes
Thank you though!
Jon

Re: Text Character Width?
Posted: Thu May 27, 2021 8:09 am
by richmond62
Of course if the text is subject to change . . .
Every time the text changes the stack could take a snapshot of the field, scale it and position it as appropriate;
this is really quite straightforward.
-
-
Code in the wider field:
Code: Select all
on textChanged
put fld "ff" into fld "ff2"
set the width of fld "ff2" to the formattedWidth of fld "ff2"
set the location of fld "ff2" to 200,32
import snapshot from fld "ff2"
set the name of the last control to "SNAPP"
set the width of img "SNAPP" to 380
end textChanged
Stack removed as improved version in the next posting.
Re: Text Character Width?
Posted: Thu May 27, 2021 9:21 am
by richmond62
Ouch: I realised that as one typed a new word one ended up with a 'pile' of intermediate images all called "SNAPP"
which was a load of "bollo"!
So, here's an improved version:
-
Code: Select all
on textChanged
if exists(img "SNAPP") then
delete img "SNAPP"
end if
put fld "ff" into fld "ff2"
set the width of fld "ff2" to the formattedWidth of fld "ff2"
set the location of fld "ff2" to 200,32
import snapshot from fld "ff2"
set the name of the last control to "SNAPP"
set the width of img "SNAPP" to 380
end textChanged
It should be clear why I have added lines 2-4
Re: Text Character Width?
Posted: Thu May 27, 2021 10:58 am
by richmond62
Re: Text Character Width?
Posted: Thu May 27, 2021 1:02 pm
by cmhjon
Hi richmond62,
Although I am trying different condensed fonts to find one that will work, that import snapshot function is VERY cool! I didn't know that LC could do anything like that! I have filed that one away for future use. Thank you for sharing!
Best regards,
Jon
