AllegroGL  0.4.4
Macros | Typedefs | Functions | Variables
fontconv.c File Reference

Allegro FONT conversion routines. More...

#include <math.h>
#include <string.h>
#include <stdio.h>
#include <allegro.h>
#include <allegro/internal/aintern.h>
#include "alleggl.h"
#include "allglint.h"
#include <GL/glu.h>

Go to the source code of this file.

Macros

#define PREFIX_I   "agl-font INFO: "
 
#define PREFIX_W   "agl-font WARNING: "
 
#define PREFIX_E   "agl-font ERROR: "
 
#define FONT_CHARACTER_SPACING   2
 
#define MIN_TEXTURE_SIZE   2
 
#define NUM_TEXTURE_SIZE   13
 

Typedefs

typedef struct texture_size texture_size
 

Functions

static int agl_get_font_height (AL_CONST FONT *f)
 
static int agl_char_length (const FONT *f, int ch)
 
static int agl_text_length (const FONT *f, const char *str)
 
static int agl_get_font_ranges (FONT *f)
 
static int agl_get_font_range_begin (FONT *f, int range)
 
static int agl_get_font_range_end (FONT *f, int range)
 
static FONT * agl_extract_font_range (FONT *f, int start, int end)
 
static FONT * agl_merge_fonts (FONT *f1, FONT *f2)
 
static void aglf_convert_allegro_font_to_bitmap (FONT_AGL_DATA *dest, FONT *f, void *src, int *height)
 
static void aglf_convert_allegro_font_to_texture (FONT_AGL_DATA **dest, FONT *f, void *src, int *height, float scale, GLint format)
 
static GLuint aglf_upload_texture (BITMAP *bmp, GLint format, int has_alpha)
 
static int aglf_check_texture (BITMAP *bmp, GLint format, int has_alpha)
 
static BITMAP * look_for_texture (int beg, int end, AGL_GLYPH *glyphs, int max_w, int max_h, int total_area, GLint format, int has_alpha)
 
static int iroundf (float v)
 
static float agl_char_length_fractional (const FONT *f, int ch)
 
static int create_textured_font_call_lists (AGL_GLYPH *coords, int max, BITMAP *bmp, float scale, int *height)
 
static FONT_AGL_DATA * copy_glyph_range (FONT_AGL_DATA *fad, int start, int end, int *height)
 
FONT * allegro_gl_convert_allegro_font (FONT *f, int type, float scale)
 Equivalent to: More...
 
FONT * allegro_gl_convert_allegro_font_ex (FONT *f, int type, float scale, GLint format)
 Converts a regular Allegro FONT to the AGL format for 3D display. More...
 
static int sort_glyphs (const void *c1, const void *c2)
 
static int unsort_glyphs (const void *c1, const void *c2)
 
static int sort_textures (const void *c1, const void *c2)
 
static int aglf_sort_out_glyphs (BITMAP *bmp, AGL_GLYPH *glyphs, const int beg, const int end)
 
static int split_font (FONT *f, void *source, void **dest1, void **dest2)
 
static void destroy_split_font (FONT *f, union mixed_ptr range1, union mixed_ptr range2)
 
static int do_crop_font_range (FONT *f, AGL_GLYPH *glyphs, int beg, int end)
 
static int crop_font_range (FONT *f, void *src, int beg, int end, AGL_GLYPH *glyphs, int *net_area, int *gross_area, int *max_w, int *max_h)
 
static int draw_glyphs (BITMAP *bmp, FONT *f, GLint format, int beg, int end, AGL_GLYPH *glyphs)
 

Variables

FONT_VTABLE _agl_font_vtable
 
FONT_VTABLE * font_vtable_agl = &_agl_font_vtable
 

Detailed Description

Allegro FONT conversion routines.

Notes: - Depends on the Allegro's FONT structure remaining intact. Bugs: - Bitmapped font support is flakey at best.

Definition in file fontconv.c.

Variable Documentation

FONT_VTABLE _agl_font_vtable
Initial value:
= {
agl_get_font_height,
agl_char_length,
agl_text_length,
NULL,
NULL,
agl_get_font_ranges,
agl_get_font_range_begin,
agl_get_font_range_end,
agl_extract_font_range,
agl_merge_fonts,
}
void allegro_gl_destroy_font(FONT *f)
void allegro_gl_destroy_font(FONT *usefont)
Definition: aglf.c:573

Definition at line 64 of file fontconv.c.