www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/01/22/11:45:16

Message-ID: <000101be4626$29275e20$9b6f19c4@default>
From: rylan AT intekom DOT co DOT za (StefanViljoen,6599)
To: "Toby Craig" <tobza AT hotmail DOT com>
Cc: <djgpp AT delorie DOT com>
Subject: Re: Clueless bloke looking for help
Date: Fri, 22 Jan 1999 07:11:37 +0200
MIME-Version: 1.0
X-Priority: 3
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook Express 4.72.2106.4
X-MimeOLE: Produced By Microsoft MimeOLE V4.72.2106.4
Reply-To: djgpp AT delorie DOT com

-----Original Message-----
From: Toby Craig <tobza AT hotmail DOT com>
Newsgroups: comp.os.msdos.djgpp
Date: Thursday, January 21, 1999 9:51 PM
Subject: Clueless bloke looking for help


>Hi there,
>
>I have just started using DJGPP & Allegro, and have run into a problem
using
>different fonts. Here is a snippet of my code, which returns an error
message
>somethinmg like 'Incompatible pointer type'
>
>#include <stdio.h>
>#include <allegro.h>
>#include <stdlib.h>
>
>int main()
>{
>    FONT *myfont="c:/djgpp/fonts/ncen22.fnt";
               ^^^^^^^
Hi!

The problem here is that you cannot assign a file name to the FONT struct in
Allegro - it explicitly expects a pointer to a FONT structure that resides
in an Allegro DATAFILE structure or somewhere else. That is the reason for
the "incompatible pointer type" compiler error. Another problem is that
Allegro cannot use *.FNT files - do import foreign fonts into allegro see
the add on pages on the Allegro web site
http://www.talula.demon.co.uk/allegro/ for a utility that takes windows .TTF
(TrueType) fonts and converts them into a format that Allegro can read. To
get a new font into Allegro, you need to use the grabber utility. Here is
how I got a new font into Allegro for my currenty game project - note that
it is unneccesarily complex since I did not know of the TTF->Allegro font
converter that was available on the Allegro WWW site:

1. I went into Windows paint and typed out all the characters (see the
Allegro.DOC file for the ASCII range you need) with the selected Windows
font.

2. Then, I wrote a program in Allegro with DJGPP that drew a grid for me
with enough cells horizontally and vertically to contain all the
characters - this is needed because the grabber uses these grid boxes to
"scan in" the font into Allegro.

3. This fontgrid was taken and imported into the .BMP (all done using
Windows paint) which already contained the characters typed out in (1).

4. Then (this was the hard, tedious part) I moved all the characters into
each of the cells that I had had Allegro draw for me.

5. Finally, when all the characters where in their own cells, I saved the
file.

6. Then I started up the grabber and fed it this file, then told it to make
a font from it.

7. Viola! It worked.

8. This code:
FONT *myfont="c:/djgpp/fonts/ncen22.fnt";
has to look like this. Say that the font is "Impact_Font" in the Allegro
datafile:

FONT *myfont = datafile[Impact_Font].dat;

Mail me if you want code and a sample Allegro font - hope this explain
helped!

Kind Regards,

Rylan
Is truth beauty or is beauty truth?
http://home.intekom.com/rylan/index.html
(NASM examples, NASM - TASM, DJGPP gfx source, semi-tuts)
Also Povray Raytracing - PovTeam Lives!!


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019