Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages

  
 
  

home | help
load_dat_font(3)		 Allegro manual 		load_dat_font(3)

NAME
     load_dat_font - Loads a FONT from an Allegro datafile.

SYNOPSIS
     #include <allegro.h>

     FONT *load_dat_font(const char *filename, RGB *pal, void *param)

DESCRIPTION
     Loads a FONT from an Allegro datafile. You can set param parameter to point
     to  an  array that holds two strings that identify the font and the palette
     in the datafile by name.  The first string in this list is the name of  the
     font.  You  can  pass  NULL  here	to just load the first font found in the
     datafile. The second string can be used to specify the name of the  palette
     associated  with  the  font.  This is only returned if the pal parameter is
     not NULL. If you pass NULL for the name of the palette,  the  last  palette
     found  before  the  font was found is returned.  You can also pass NULL for
     param, which is treated as if you had passed NULL for  both  strings  sepa-
     rately. In this case, the function will simply load the first font it finds
     from the datafile and the palette that precedes it.

     For example, suppose you have a datafile named `fonts.dat' with the follow-
     ing contents:

	FONT  FONT_1_DATA
	FONT  FONT_2_DATA
	FONT  FONT_3_DATA
	PAL   FONT_1_PALETTE
	PAL   FONT_2_PALETTE

     Then  the	following  code  will  load  FONT_1_DATA  as  a  FONT and return
     FONT_1_PALETTE as the palette:

	FONT *f;
	PALETTE pal;
	char *names[] = { "FONT_1_DATA", "FONT_1_PALETTE" }

	f = load_dat_font("fonts.dat", pal, names);

     If instead you want to load the second font, FONT_2, from the datafile, you
     would use:

	FONT *f;
	PALETTE pal;
	char *names[] = { "FONT_2_DATA", "FONT_2_PALETTE" }

	f = load_dat_font("fonts.dat", pal, names);

     If you want to load the third font, but not bother with a palette, use:

	FONT *f;
	char *names[] = { "FONT_3_DATA", NULL }

	f = load_dat_font("fonts.dat", NULL, names);

RETURN VALUE
     Returns a pointer to the font or NULL on error. Remember that you	are  re-
     sponsible	for  destroying  the font when you are finished with it to avoid
     memory leaks.

SEE ALSO
     register_font_file_type(3), load_font(3)

Allegro 			  version 4.4.3 		load_dat_font(3)

Want to link to this manual page? Use this URL:
<https://man.freebsd.org/cgi/man.cgi?query=load_dat_font&sektion=3&manpath=FreeBSD+Ports+15.1.quarterly>

home | help