Gamestudio Links
Zorro Links
Newest Posts
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
1 registered members (M_D), 1,430 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
Newest Members
firatv, wandaluciaia, Mega_Rod, EternallyCurious, howardR
19050 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Using truetype font from game folder? #355233
01/25/11 16:46
01/25/11 16:46
Joined: Nov 2003
Posts: 433
The Netherlands
T
Toon Offline OP
Senior Member
Toon  Offline OP
Senior Member
T

Joined: Nov 2003
Posts: 433
The Netherlands
Is it possible to use a truetype font from the game folder instead of installing the font in the c:\windows\fonts directory?

Re: Using truetype font from game folder? [Re: Toon] #355242
01/25/11 17:41
01/25/11 17:41
Joined: Nov 2007
Posts: 2,568
Germany, BW, Stuttgart
MasterQ32 Offline
Expert
MasterQ32  Offline
Expert

Joined: Nov 2007
Posts: 2,568
Germany, BW, Stuttgart
maybe this will work:

AddFontResource(char* )

http://msdn.microsoft.com/en-us/library/dd183326%28v=vs.85%29.aspx

you need to include windows.h


Visit my site: www.masterq32.de
Re: Using truetype font from game folder? [Re: MasterQ32] #355331
01/26/11 16:26
01/26/11 16:26
Joined: Nov 2003
Posts: 433
The Netherlands
T
Toon Offline OP
Senior Member
Toon  Offline OP
Senior Member
T

Joined: Nov 2003
Posts: 433
The Netherlands
Hi Richi007, thanks for your reply! Unfortunately I tryed the code without any luck grin This is what I tryed, maybe you know what I'm doing wrong;

Code:
#include <acknex.h>
#include <default.c>
#include <windows.h>
#include <stdio.h>

FONT* my_font;


TEXT* test_txt = 
{
	flags = SHOW;
	string = "Comic letter";
	pos_x = 100;
	pos_y = 100;
}

void main()
{
	if(AddFontResource("comic_andy.ttf")!=0)
	{
		my_font = font_create("comic andy#100");
		
		if(my_font == NULL)
		{
			sys_exit("");
		}
		else
		{
			beep();
			wait(-10);
			test_txt.font = my_font;
		}	
	}
	else
	{
		beep();beep();beep();
	}
}



Re: Using truetype font from game folder? [Re: Toon] #355355
01/26/11 17:42
01/26/11 17:42
Joined: Jan 2011
Posts: 120
United States
Logan Offline
Member
Logan  Offline
Member

Joined: Jan 2011
Posts: 120
United States
It seems like you might just be better off using a bitmap font. If you're going to try to package a Truetype font with your game, then it seems almost identical to packaging the game with an identical bitmap font... the only difference is the variable width/fixed width thing, but another pro is that bitmap fonts are faster. So you might just do that.

You may have already thought about this, in which case ignore all this.

Re: Using truetype font from game folder? [Re: Toon] #368062
04/21/11 07:58
04/21/11 07:58
Joined: Jun 2009
Posts: 43
MCKiller Offline
Newbie
MCKiller  Offline
Newbie

Joined: Jun 2009
Posts: 43
Originally Posted By: Toon
Hi Richi007, thanks for your reply! Unfortunately I tryed the code without any luck grin This is what I tryed, maybe you know what I'm doing wrong;

Code:
#include <acknex.h>
#include <default.c>
#include <windows.h>
#include <stdio.h>

FONT* my_font;


TEXT* test_txt = 
{
	flags = SHOW;
	string = "Comic letter";
	pos_x = 100;
	pos_y = 100;
}

void main()
{
	if(AddFontResource("comic_andy.ttf")!=0)
	{
		my_font = font_create("comic andy#100");
		
		if(my_font == NULL)
		{
			sys_exit("");
		}
		else
		{
			beep();
			wait(-10);
			test_txt.font = my_font;
		}	
	}
	else
	{
		beep();beep();beep();
	}
}



This will not work, because font_create() will use a standard font if the new one (added with AddFontResource) was not found. This means that font_create() give you back a pointer and not a NULL!

You can not be 100% sure if the new font is really used!

Re: Using truetype font from game folder? [Re: MCKiller] #368150
04/22/11 01:34
04/22/11 01:34
Joined: Jun 2007
Posts: 1,337
Hiporope and its pain
txesmi Offline
Serious User
txesmi  Offline
Serious User

Joined: Jun 2007
Posts: 1,337
Hiporope and its pain
this works good for me...

Code:
#include <acknex.h>
#include <windows.h>

FONT* my_font;

TEXT* test_txt = 
{
	flags = SHOW;
	string = "Comic letter";
}

void main()
{
	AddFontResource("Aarvark_Cafe.ttf");

	my_font = font_create("Aarvark Cafe#100");

	test_txt.font = my_font;
	
	while ( !key_any ) wait(1);
	
	sys_exit ( NULL );
}



Salud!


Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

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