Gamestudio Links
Zorro Links
Newest Posts
Z9 getting Error 058
by k_ivan. 04/20/26 15:57
Stooq now requires an API key
by jcl. 04/13/26 09:42
Strange "Alien" Skull created with >Knubber<
by NeoDumont. 04/10/26 18:58
400 free seamless texture pack downl. here !
by NeoDumont. 04/08/26 19:55
ZorroGPT
by TipmyPip. 04/08/26 17:08
AUM Magazine
Latest Screens
Dorifto samurai
Shadow 2
Rocker`s Revenge
Stug 3 Stormartillery
Who's Online Now
1 registered members (alibaba), 3,592 guests, and 4 spiders.
Key: Admin, Global Mod, Mod
Newest Members
valino, juergenwue, VladMak, Geir, ondrej
19209 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
[SOLVED] font_create -> invisible text #453759
08/11/15 10:55
08/11/15 10:55
Joined: Dec 2011
Posts: 1,823
Netherlands
Reconnoiter Offline OP
Serious User
Reconnoiter  Offline OP
Serious User

Joined: Dec 2011
Posts: 1,823
Netherlands
Hi JCL,

I couldn't find much about it so I am asking it here. I have a problem with font_create. When I use other fonts (e.g. FONT* calibri18_font = "Calibri#18"; ) it works correctly, but when I use my custom font:

Code:
FONT* font_customcalibri = font_create("font_customcalibri.bmp");


the text becomes invisible. I have made the .bmp with FontGenerator (by Harry Potter from this forum) and the .bmp itself looks fine (it is just a green calibri 12 for testing purposes, nothing special). I have also tried other custom fonts but that did not work too.

Is my code wrong?
Thanks for taking the time.

ps: I have windows 10 (probably doesn't matter)

Last edited by Reconnoiter; 08/12/15 20:33.
Re: font_create -> invisible text [Re: Reconnoiter] #453763
08/11/15 12:49
08/11/15 12:49
Joined: Jul 2000
Posts: 28,093
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 28,093
Frankfurt
Maybe the vertical or horizontal bitmap size is wrong in some way? Or your BMP is in fact invisible by 100% transparency? There are some example font bitmaps included, so you can check your code with them and identify the problem.

Re: font_create -> invisible text [Re: jcl] #453765
08/11/15 13:58
08/11/15 13:58
Joined: Dec 2011
Posts: 1,823
Netherlands
Reconnoiter Offline OP
Serious User
Reconnoiter  Offline OP
Serious User

Joined: Dec 2011
Posts: 1,823
Netherlands
Thanks for your quick reply. The samples also don't work. I have also tried for several texts. My suspicion is that there is something wrong with font_create.

Doing this also does not work (font1_red.pcx is in the game folder):

Code:
function create_text()
{
  ...
  my_text.font = font_create("font1_red.pcx");
}



but the following does work:

Code:
function create_text()
{
  ...
  my_text.font = LucidaConsole14;
}



Last edited by Reconnoiter; 08/11/15 13:59.
Re: font_create -> invisible text [Re: Reconnoiter] #453781
08/12/15 14:46
08/12/15 14:46
Joined: Jul 2000
Posts: 28,093
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 28,093
Frankfurt
Then I don't know where the problem lies, but look into font_create() examples - the digital clock sample uses it if I remember right. Compare it with your code and check what's different. font_create() supports both TTF and bitmap fonts, so you can theoretically just swap one for the other.

Re: font_create -> invisible text [Re: jcl] #453787
08/12/15 20:32
08/12/15 20:32
Joined: Dec 2011
Posts: 1,823
Netherlands
Reconnoiter Offline OP
Serious User
Reconnoiter  Offline OP
Serious User

Joined: Dec 2011
Posts: 1,823
Netherlands
I have found what the problem was, I thought FONT* font_customcalibri = font_create("my_font.bmp"); needed to be declared globally (outside a function), but it needs to be declared within a function (just in the Digital.c sample). Thanks for that digital sample tip.


Moderated by  old_bill, Tobias 

Gamestudio download | 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