Gamestudio Links
Zorro Links
Newest Posts
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/22/24 13:41
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (NnamueN, 1 invisible), 1,489 guests, and 6 spiders.
Key: Admin, Global Mod, Mod
Newest Members
LucasJoshua, Baklazhan, Hanky27, firatv, wandaluciaia
19054 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
non fixed width fonts ? #84219
08/02/06 17:57
08/02/06 17:57
Joined: Apr 2005
Posts: 196
In a far, far away galaxy
EPATATA Offline OP
Member
EPATATA  Offline OP
Member

Joined: Apr 2005
Posts: 196
In a far, far away galaxy
how can I use non fixed width fonts to show text strings in the screen?

Re: non fixed width fonts ? [Re: EPATATA] #84220
08/02/06 18:23
08/02/06 18:23
Joined: May 2004
Posts: 1,510
Denmark
Claus_N Offline
Serious User
Claus_N  Offline
Serious User

Joined: May 2004
Posts: 1,510
Denmark
You mean True-type fonts?

Code:
// Example:
font Arial_font = "Arial",30,1;



non fixed width fonts ? [Re: Claus_N] #84221
08/09/06 19:58
08/09/06 19:58
Joined: Apr 2005
Posts: 196
In a far, far away galaxy
EPATATA Offline OP
Member
EPATATA  Offline OP
Member

Joined: Apr 2005
Posts: 196
In a far, far away galaxy
Im using font-generator to generate pcx images of fonts used, but when I write text strings in the screen, all letters have the same width.

example: dots "." have same width as "M".
How to make dots and other narrow letters use less space in the screen than wider letters ???

Re: non fixed width fonts ? [Re: EPATATA] #84222
08/09/06 20:54
08/09/06 20:54
Joined: May 2004
Posts: 1,510
Denmark
Claus_N Offline
Serious User
Claus_N  Offline
Serious User

Joined: May 2004
Posts: 1,510
Denmark
If you don't want fixed-width fonts, you need to use true-type fonts. 'M' and '.' will ALWAYS have the same width in "non-True-type fonts".

Re: non fixed width fonts ? [Re: Claus_N] #84223
08/10/06 10:00
08/10/06 10:00
Joined: Jul 2001
Posts: 6,904
H
HeelX Offline
Senior Expert
HeelX  Offline
Senior Expert
H

Joined: Jul 2001
Posts: 6,904
You can actually render fonts on a bitmap basis as non-fixedwidthfonts (so to say analog to TTFs). The trick is, to extract from the font bitmap each letter as single bitmap, whereas you clipped the left and right pixels which cover nothing, until the letter itself comes.

I did this before and its easy: I create an alphachannel for the font and analyzed tha alpha value. Example:

Let us say, this is a semicolon, the o's are solid and the #'s are transparent.

Code:

###o###
#######
###o###
##o####



When I want a minimum column of 1px before and after the last row in which one solid pixel is placed, I crop it like this:

Code:

##o#
####
##o#
#o##



Now, if you take a string and you stitch each (cropped) letter together your returning bitmap covers a string, rendered with no blank spaces and like a TTF - but basing on a bmap!

Re: non fixed width fonts ? [Re: HeelX] #84224
08/10/06 12:23
08/10/06 12:23
Joined: Apr 2005
Posts: 196
In a far, far away galaxy
EPATATA Offline OP
Member
EPATATA  Offline OP
Member

Joined: Apr 2005
Posts: 196
In a far, far away galaxy
thank you Claus_N, now I know I can use TT fonts

@HeelX I got your method, and already I think in that, but how can I show the string in the screen? each letter will be an image correct? so I will need to join all letters in a single string?

Re: non fixed width fonts ? [Re: EPATATA] #84225
08/10/06 13:58
08/10/06 13:58
Joined: Jul 2001
Posts: 6,904
H
HeelX Offline
Senior Expert
HeelX  Offline
Senior Expert
H

Joined: Jul 2001
Posts: 6,904
No, you should build a function like this:

bmap_for_str(bmap* font, string* string);
return: bmap*

Note: your font isnt declared as font*, but as a bitmap now!!! That is very important.

So you can easily let your script render a bitmap with your string build up on these bitmap chunks and then you can assign this bmap to a panel. Works pretty fast when I coded it that time and with those new bitmap features (bmap_blit) and so its much faster now.

Last edited by HeelX; 08/10/06 13:59.
Re: non fixed width fonts ? [Re: HeelX] #84226
08/11/06 11:09
08/11/06 11:09
Joined: Apr 2005
Posts: 196
In a far, far away galaxy
EPATATA Offline OP
Member
EPATATA  Offline OP
Member

Joined: Apr 2005
Posts: 196
In a far, far away galaxy
that is good
Ill try script it, if I found dificulties then will return here later.


If you dont believe in God then look at the sun. He makes blind those who only believe seeing.

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1