Latest Uploads
PixeLink - ... oween 2014

rockford

PixeLink - ... oween 2014

rockford

PixeLink P ... zle Editor

rockford

PixeLink

rockford

image-21-0 ... -21-29.jpg

Jayenkai

image-15-0 ... -19-40.jpg

Jayenkai

Forum Home

Txt within a field

UserMessage
Posted : Monday, 17 October 2011, 16:43 | Permalink
dna


Hey.

I'm trying to put text into a field. What the code does is measure the width of the field in pixels, gets the fontwidth() which is in pixels and then returns the maximum number of characters that can be placed into that field.

-->

Using Arial and the default size I get 24 for the fontwidth.

I use NN=Int(WID/FNT_WID)-1 after setting FONT_1=fontwidth() and WID being the width of the field. The number that returns is much smaller than the size of WID. Meaning that I get an amount of characters that is smaller than the space I want to fill.

Do I need to use a monospaced font?


-----
DNA
Posted : Monday, 17 October 2011, 20:14 | Permalink | Mark Here
dna



I tried using a monospaced font and the results were better but the text generated never went all the way across the row of the field.

-----
DNA
Posted : Monday, 17 October 2011, 20:22 | Permalink | Mark Here
dna


Hey all.

I found the solution. Use Stringwidth()


thanks


-----
DNA
Latest Posts
RIP : Jay's Nan
Jayenkai Thu 09:12
What they promise - and what they deliver...
Jayenkai Thu 08:43
Tabitha
steve_ancell Thu 08:26
Scary Music
rockford Thu 06:16
Levity
rockford Thu 01:48
What Have You Done - Oct 2014
rychan Wed 18:14
Swimming
Jayenkai Wed 13:19
Misfit Shine
Jayenkai Wed 03:49
The president's golf club.
Jayenkai Tue 20:33
Jogging
Jayenkai Tue 19:44
More

Latest Items
Snippet : Monkey Framework - HTML Layout
steve_ancell Thu 08:35
Woot : Update on hand issues
Kuron Fri 10:34
News : Newsletter #240
steve_ancell Fri 05:29
Techy : My Newest Toys
Jayenkai Sun 04:16
News : Newsletter #239
Jayenkai Sat 05:34
Showcase : Preppie!
Jayenkai Fri 13:00
Rant : I Stubbed My Toe...
steve_ancell Tue 09:47
Blog : Bedroom 2.0
Kuron Mon 18:59
Link : Message(s) from the grave
Jayenkai Tue 09:27
Blog : 20 Years Ago....
steve_ancell Mon 15:28
Life : Back Online
Kuron Tue 11:48
Showcase : Munky Blocks DX
Jayenkai Mon 07:06
Showcase : Little Nemo's Nightmare
Jayenkai Sat 04:14
News : Newsletter #234
rychan Fri 08:02
Showcase : Space Rocket Adventurers
HoboBen Thu 16:56
More

Who's Online
Jayenkai
Thu, at 10:31
Kuron
Thu, at 10:24
steve_ancell
Thu, at 09:49
rockford
Thu, at 09:34
shroom_monk
Thu, at 08:54
Krakatomato
Thu, at 04:55
rychan
Thu, at 04:15
spinal
Thu, at 02:11
blanko1324
Wed, at 18:30
dna
Wed, at 16:31
Link to this page
Site : Jayenkai 2006-Infinity | MudChat's origins, BBCode's former life, Image Scaler.