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

Jayenkai

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

Jayenkai

Bumble Bee

dna

Tires

dna

Guess The Remake

rychan

Julia Set Visualer

Andy_A

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
Ocular Rape
Kuron Thu 19:37
AGameAWeek iOS Bundle
rychan Thu 08:46
Ex XBox
rychan Thu 07:54
Watch Out! Car!
steve_ancell Thu 06:34
''Unique''
spinal Wed 02:20
Legitimate Logo Services
spinal Tue 13:26
Coming soon, to a printer near you!
steve_ancell Tue 12:22
RIP : Douglas E Smith
steve_ancell Tue 12:16
Telly Picks
HoboBen Tue 09:38
Microbricks aka BingCraft aka XBlocks
spinal Tue 02:25
More

Latest Items
Blog : Bedroom 2.0
rychan Thu 14:06
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
Family : Good News (for once)
Kuron Tue 15:37
Showcase : Don't Tap The Zombies
therevillsgames Mon 16:26
Showcase : Mutant Monty
steve_ancell Wed 19:26
Techy : New Laptop!?
Kuron Fri 15:52
Showcase : Ascension 2 Live Wallpaper
CodersRule Fri 13:48
More

Who's Online
Kuron
Thu, at 19:40
dna
Thu, at 18:52
steve_ancell
Thu, at 18:35
HoboBen
Thu, at 17:39
Jayenkai
Thu, at 17:38
rychan
Thu, at 16:14
spinal
Thu, at 15:36
shroom_monk
Thu, at 09:48
brdtt12
Thu, at 09:08
rockford
Thu, at 05:38
Link to this page
Site : Jayenkai 2006-Infinity | MudChat's origins, BBCode's former life, Image Scaler.