Latest Uploads
Kuron Cap Get!

rychan

Merry Christmas

Jayenkai

Invasion V ... tup screen

rychan

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

Jayenkai

PixeLink - ... oween 2014

rockford

PixeLink P ... zle Editor

rockford

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
Daily Doodles
Jayenkai Sun 03:05
RIP : Leonard Nimoy
Jayenkai Sun 01:46
GTA 5 PC Screenshot
Hotshot Sat 12:57
Happy Birthday Pakz
Hotshot Sat 12:54
Happy Birthday Jayenkai and Toaster!
Hotshot Sat 12:53
Scary Outdoors
steve_ancell Sat 09:52
FauxLego
Kuron Thu 18:11
Great Big Youtube thread
Jayenkai Thu 14:51
Beating the Invading Army
rockford Thu 07:05
What Have You Done - Feb 2015
Jayenkai Thu 05:40
More

Latest Items
Snippet : IFS Fractal Viewer
Andy_A Mon 14:20
Snippet : Rotating Sphere
Andy_A Tue 14:25
Showcase : Futrino
Jayenkai Thu 06:16
Showcase : Millenipede
Steve Elliott Mon 17:44
Showcase : Flappy New Year
rychan Wed 02:49
Snippet : Simple stack-based interpreter
tbohon Wed 12:08
Link : Protolol
Afr0 Tue 10:53
Showcase : Santa's Workout 2
jayparker Tue 00:43
Dev-Diary : Stripping it All Away
Jayenkai Mon 01:57
News : Newsletter #245
rychan Fri 06:36
Showcase : GPS Fun Runner 3D
zzoom Wed 15:35
Showcase : The Biggest Snowman
rychan Mon 01:06
News : Newsletter #243
Dabz Thu 03:29
Dev-Diary : Scaling Back
rychan Wed 14:33
Showcase : Alpha Collexion
rychan Wed 06:23
More

Who's Online
Jayenkai
Sun, at 03:38
rockford
Sun, at 03:13
Dabz
Sun, at 02:33
steve_ancell
Sat, at 21:19
blanko1324
Sat, at 16:35
Hotshot
Sat, at 15:53
zzoom
Sat, at 15:06
Pakz
Sat, at 14:40
rychan
Sat, at 12:23
HoboBen
Sat, at 06:56
Link to this page
Site : Jayenkai 2006-Infinity | MudChat's origins, BBCode's former life, Image Scaler.