Latest Uploads
isometric test

realtime

dungeon ma ... litz basic

realtime

Crystal Ca ... een So Far

rychan

Crystal Ca ... Screen V1

rychan

Day 5 Graphic

rychan

Mutanty Mo ... Workfiles.

steve_ancell

Forum Home

Txt within a field

UserMessage
Posted : Monday, 17 October 2011, 15: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, 19: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, 19:22 | Permalink | Mark Here
dna


Hey all.

I found the solution. Use Stringwidth()


thanks


-----
DNA
Latest Posts
Little Lever News
Jayenkai Wed 06:50
Rooting for OUYA
9572AD Tue 19:07
Scene Demos
rockford Tue 07:46
AGameAWeek Progress Report
Kuron Mon 17:21
Happy Easter
rockford Mon 11:10
Jay gets a Wii U
Jayenkai Sun 07:14
Win7 Installing
dna Sat 13:32
A New Theme!?
Jayenkai Sat 05:30
Ramble ramble/finishing stuff
therevillsgames Fri 19:41
Mint
Dabz Fri 01:02
More

Latest Items
Dev-Diary : Another Evening Of Coding Approaches!
rychan Tue 16:45
Blog : DX9Engine
Kuron Tue 05:22
Family : :c(
Kuron Tue 04:27
Dev-Diary : Yet another one...
Jayenkai Tue 00:01
Blog : EmuMenu
rickdangerous Fri 04:16
Showcase : BambooBasic
Dabz Thu 18:46
Blog : FInally Some Game Dev Time
rychan Thu 15:35
Showcase : isometric prototype
Jayenkai Thu 04:31
Showcase : dungeon maker algorithm
Jayenkai Wed 01:42
Dev-Diary : More Screens
Kuron Sat 09:01
News : Newsletter #221
Dabz Fri 10:07
Dev-Diary : Crystal Catch Development
rychan Thu 14:38
Link : Sfxr
rychan Thu 04:16
Showcase : SpringySquirrel
Jayenkai Tue 22:58
Dev-Diary : More Planning and Framework Learning
rychan Tue 17:23
More

Who's Online
steve_ancell
Wed, at 08:07
Jayenkai
Wed, at 07:40
spinal
Wed, at 07:21
rychan
Wed, at 06:33
Dabz
Wed, at 04:30
Mog
Wed, at 03:02
shroom_monk
Wed, at 02:56
rockford
Wed, at 02:03
MetalMan
Tue, at 23:43
dna
Tue, at 20:37
Link to this page
Site : Jayenkai 2006-Infinity | MudChat's origins, BBCode's former life, Image Scaler.