Mail Archives: djgpp/1999/01/22/11:45:16
-----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 -