Open source remastering of the Freespace 2 engine
Go to the documentation of this file.
1 /*
2  * Copyright (C) Volition, Inc. 1999. All rights reserved.
3  *
4  * All source code herein is the property of Volition, Inc. You may not sell
5  * or otherwise commercially exploit the source or things you created based on the
6  * source.
7  *
8 */
12 #ifndef _FONT_H
13 #define _FONT_H
15 #include "globalincs/pstypes.h"
17 #define MAX_FONTS 5
19 #define FONT_VERSION 0
20 #define WIDEST_DIGIT "4" // the widest number character
21 #define WIDEST_CHAR "W" // the widest character
23 typedef struct font_char {
24  int spacing;
26  int offset;
28  short user_data;
29 } font_char;
31 typedef struct font_kernpair {
32  char c1,c2;
33  signed char offset;
36 typedef struct font {
38  int id; // Should be 'VFNT'
39  int version; // font version
40  int num_chars;
42  int w;
43  int h;
52  // Data for 3d cards
53  int bitmap_id; // A bitmap representing the font data
54  int bm_w, bm_h; // Bitmap width and height
55  ubyte *bm_data; // The actual font data
56  int *bm_u; // U offset of each character
57  int *bm_v; // V offset of each character
59 } font;
61 extern int Num_fonts;
62 extern font Fonts[MAX_FONTS];
63 extern font *Current_font;
65 #define FONT1 0 // font01.vf
66 #define FONT2 1 // font02.vf
67 #define FONT3 2 // font03.vf
69 // extern definitions for basic font functions
70 extern void gr_stuff_first_font(char *first_font, size_t first_font_size);
71 extern int gr_get_current_fontnum();
72 extern int gr_get_fontnum(const char *filename);
73 extern void gr_set_font(int fontnum);
75 void gr_print_timestamp(int x, int y, fix timestamp, int resize_mode);
76 int gr_force_fit_string(char *str, int max_str, int max_width);
77 void gr_font_init();
78 void gr_font_close();
81 extern int get_char_width(ubyte c1,ubyte c2,int *width,int *spacing);
82 extern int get_centered_x(const char *s, bool scaled);
84 #endif
Definition: pstypes.h:324
int timestamp(int delta_ms)
Definition: timer.cpp:226
int pixel_data_size
Definition: font.h:47
struct font_kernpair font_kernpair
int gr_get_current_fontnum()
Definition: font.cpp:545
int char_data_size
Definition: font.h:46
int first_ascii
Definition: font.h:41
int byte_width
Definition: font.h:25
GLint GLsizei width
Definition: Gl.h:1505
int gr_force_fit_string(char *str, int max_str, int max_width)
Definition: font.cpp:48
Definition: font.h:36
struct font font
void gr_set_font(int fontnum)
Definition: font.cpp:566
int spacing
Definition: font.h:24
font_kernpair * kern_data
Definition: font.h:48
ubyte * bm_data
Definition: font.h:55
int kern_data_size
Definition: font.h:45
int * bm_v
Definition: font.h:57
char * filename
#define MAX_FONTS
Definition: font.h:17
char c2
Definition: font.h:32
void gr_font_close()
Definition: font.cpp:356
short kerning_entry
Definition: font.h:27
ubyte * pixel_data
Definition: font.h:50
GLdouble s
Definition: Glext.h:5321
int w
Definition: font.h:42
int gr_get_fontnum(const char *filename)
Definition: font.cpp:554
short user_data
Definition: font.h:28
int offset
Definition: font.h:26
int id
Definition: font.h:38
GLint GLint GLint GLint GLint x
Definition: Glext.h:5182
long fix
Definition: pstypes.h:54
unsigned char ubyte
Definition: pstypes.h:62
int h
Definition: font.h:43
struct font_char font_char
Definition: font.h:23
int get_centered_x(const char *s, bool scaled)
Definition: font.cpp:114
int get_char_width(ubyte c1, ubyte c2, int *width, int *spacing)
Definition: font.cpp:75
int bm_h
Definition: font.h:54
char c1
Definition: font.h:32
void gr_print_timestamp(int x, int y, fix timestamp, int resize_mode)
Definition: font.cpp:143
int version
Definition: font.h:39
int bitmap_id
Definition: font.h:53
font Fonts[MAX_FONTS]
Definition: font.cpp:35
int num_kern_pairs
Definition: font.h:44
int * bm_u
Definition: font.h:56
int Num_fonts
Definition: font.cpp:34
void gr_stuff_first_font(char *first_font, size_t first_font_size)
Definition: font.cpp:694
int num_chars
Definition: font.h:40
font * Current_font
Definition: font.h:80
font_char * char_data
Definition: font.h:49
GLint y
Definition: Gl.h:1505
void gr_font_init()
Definition: font.cpp:699
signed char offset
Definition: font.h:33
char filename[MAX_FILENAME_LEN]
Definition: font.h:37
int bm_w
Definition: font.h:54