Latest Uploads
PixeLink P ... zle Editor

rockford

PixeLink

rockford

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

Jayenkai

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

Jayenkai

image-15-0 ... -20-07.jpg

Jayenkai

Bumble Bee

dna

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
Laptop vs Sims 4
Kuron Sat 13:09
Sweets
Kuron Sat 11:40
Zero Hour Jam
Jayenkai Sat 06:55
Merchandising : Window Shopping
Kuron Sat 04:58
New Mac woes
Kuron Fri 16:12
Corner Gas : The Movie
Jayenkai Fri 16:00
RIP : Jay's Nan
blanko1324 Fri 15:35
HoverBoards FTW!
steve_ancell Fri 15:04
Facebook Rooms
Jayenkai Fri 10:37
Grrrrr Nintendo!....
rockford Fri 09:17
More

Latest Items
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
Blog : Health Update : August 2014
Jayenkai Sat 11:31
More

Who's Online
Kuron
Sat, at 13:25
rychan
Sat, at 12:49
Jayenkai
Sat, at 12:36
rockford
Sat, at 12:04
Krakatomato
Sat, at 11:01
shroom_monk
Sat, at 10:14
blanko1324
Sat, at 08:44
steve_ancell
Sat, at 06:45
spinal
Sat, at 00:17
dna
Fri, at 12:53
Link to this page
Site : Jayenkai 2006-Infinity | MudChat's origins, BBCode's former life, Image Scaler.