Latest Uploads
Invasion V ... tup screen

rychan

image-07-1 ... -20-59.jpg

Jayenkai

PixeLink - ... oween 2014

rockford

PixeLink P ... zle Editor

rockford

PixeLink

rockford

image-21-0 ... -21-29.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
VideoTools
rychan Sat 04:37
Making An Advent Calendar Collection
Kuron Fri 19:45
NerdBlock
rockford Fri 11:39
Image recognition
steve_ancell Fri 05:28
Ffffffffreeeeezinnggg ffffffeck!
steve_ancell Fri 03:58
RIP : Jimmy Ruffin
rockford Thu 08:20
Wwelcome Zzoom
rockford Thu 08:19
Saying Sorry
rockford Wed 16:01
Still using Blitz
Afr0 Wed 03:11
Insomnia
zzoom Tue 05:58
More

Latest Items
Life : Health Update
rockford Thu 12:41
Dev-Diary : Scaling Back
rychan Thu 03:55
Blog : Powerball Hack
steve_ancell Tue 18:47
Showcase : GPS Fun Runner 3D
zzoom Tue 06:03
Hols : Advent Calendars
rychan Wed 04:56
Life : MIA until better
Jayenkai Mon 07:03
News : Newsletter #241
steve_ancell Thu 20:46
Snippet : Monkey Framework - HTML Layout
steve_ancell Thu 08:35
Woot : Update on hand issues
rychan Fri 10:00
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
:
Wed 17:00
More

Who's Online
Jayenkai
Sat, at 06:38
Afr0
Sat, at 06:28
steve_ancell
Sat, at 05:45
rychan
Sat, at 04:37
rockford
Sat, at 04:16
Kuron
Sat, at 02:32
9572AD
Sat, at 02:02
spinal
Sat, at 00:19
zzoom
Sat, at 00:03
blanko1324
Fri, at 20:29
Link to this page
Site : Jayenkai 2006-Infinity | MudChat's origins, BBCode's former life, Image Scaler.