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
How's things?
Jayenkai Mon 06:28
NerdBlock
rockford Mon 06:01
RIP : Jay's Nan
rockford Mon 05:13
RIP : Lynda Bellingham
Kuron Mon 04:58
Games To Avoid
Kuron Sun 18:59
Happy Birthday, Rychan
Kuron Sun 11:32
AGameAWeek Progress Report
Kuron Sat 19:10
Holy Flying People, Batman!
Kuron Sat 17:11
Making An Advent Calendar Collection
Jayenkai Sat 09:47
Ah, the memories...
Jayenkai Sat 04:52
More

Latest Items
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
Techy : Back from Game Dev Con!
Jayenkai Sun 16:52
Family : Sunday
Jayenkai Wed 03:31
More

Who's Online
Kuron
Mon, at 06:47
Jayenkai
Mon, at 06:39
Afr0
Mon, at 06:13
rockford
Mon, at 06:13
spinal
Mon, at 05:49
Krakatomato
Mon, at 04:44
Dabz
Mon, at 03:47
rychan
Mon, at 02:23
shroom_monk
Mon, at 02:19
HoboBen
Sun, at 23:19
Link to this page
Site : Jayenkai 2006-Infinity | MudChat's origins, BBCode's former life, Image Scaler.