Text Character Width?
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
Text Character Width?
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
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
-
- Livecode Opensource Backer
- Posts: 9287
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Text Character Width?
I suspect you'll have to use font substitution.
Re: Text Character Width?
Hi Jon,
no, sorry, LC does not provide any of these pleasantries that dedicated layout application supply!
Best
Klaus
no, sorry, LC does not provide any of these pleasantries that dedicated layout application supply!
Best
Klaus
Re: Text Character Width?
Well poop!
Thank you,
Jon
Thank you,
Jon
Re: Text Character Width?
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?
Hi kdjanz,
Unfortunately, the text changes
Thank you though!
Jon
Unfortunately, the text changes
Thank you though!
Jon
-
- Livecode Opensource Backer
- Posts: 9287
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Text Character Width?
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:
Stack removed as improved version in the next posting.
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
-
- Livecode Opensource Backer
- Posts: 9287
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Text Character Width?
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:
-
It should be clear why I have added lines 2-4
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
- Attachments
-
- TEXT SQUIDGER.livecode.zip
- Here's the stack.
- (1.19 KiB) Downloaded 104 times
-
- Livecode Opensource Backer
- Posts: 9287
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Text Character Width?
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
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