PS2SDK
PS2 Homebrew Libraries
Loading...
Searching...
No Matches
font.h
Go to the documentation of this file.
1
6#ifndef __FONT_H__
7#define __FONT_H__
8
9#include <draw.h>
10#include <tamtypes.h>
11
13#define SINGLE_BYTE 0
14#define DOUBLE_BYTE 1
15
16typedef struct {
18 char name[9];
20 char bold;
30 int offset;
32 char *font;
33} fontx_t;
34
36typedef struct {
37 char A;
38 char B;
39 char C;
40 char ox;
41 char oy;
42 char width;
43 char height;
44 unsigned short u1;
45 unsigned short v1;
46 unsigned short u2;
47 unsigned short v2;
48} inidata_t;
49
50typedef struct {
51 float scale;
52 char height;
53 unsigned short *charmap;
54 int totalchars;
55 int spacewidth;
56 inidata_t *chardata;
57} fsfont_t;
58
60#define LEFT_ALIGN 0
61#define CENTER_ALIGN 1
62#define RIGHT_ALIGN 2
63
64#ifdef __cplusplus
65extern "C" {
66#endif
67
68// FontX2 type fonts
69
70// README: dma heavy
71// A 16x16 pt font with a character that consists of nothing but points
72// would take roughly 2 kilobytes to draw (16x16)*8 bytes
73
77int fontx_load(const char *path, fontx_t* fontx, int type, int wmargin, int hmargin, int bold);
78
80void fontx_unload(fontx_t *fontx);
81
83qword_t *fontx_print_ascii(qword_t *q, int context, const unsigned char *str, int alignment, const vertex_t *v0, color_t *c0, fontx_t *fontx);
84
86qword_t *fontx_print_sjis(qword_t *q, int context, const unsigned char *str, int alignment, const vertex_t *v0, color_t *c0, fontx_t *ascii, fontx_t *kanji);
87
88// FontStudio type fonts
89
90// README:
91// Make sure to setup the texture buffer with the font texture prior to printing
92
94fsfont_t *fontstudio_init(int height);
95
96void fontstudio_free(fsfont_t *font);
97
99int fontstudio_parse_ini(fsfont_t *font, char *ini, float tex_width, float tex_height);
100
102char *fontstudio_load_ini(const char *path);
103
106
108qword_t *fontstudio_print_string(qword_t *q, int context, const unsigned char *string, int alignment, const vertex_t *v0, color_t *c0, fsfont_t *font);
109
110#ifdef __cplusplus
111}
112#endif
113
114#endif /* __FONT_H__ */
int fontstudio_parse_ini(fsfont_t *font, char *ini, float tex_width, float tex_height)
Definition fsfont.c:91
int offset
Definition font.h:30
void fontx_unload(fontx_t *fontx)
Definition fontx.c:382
int charsize
Definition font.h:28
qword_t * fontstudio_print_string(qword_t *q, int context, const unsigned char *string, int alignment, const vertex_t *v0, color_t *c0, fsfont_t *font)
Definition fsfont.c:456
int fontx_load(const char *path, fontx_t *fontx, int type, int wmargin, int hmargin, int bold)
Definition fontx.c:262
fsfont_t * fontstudio_init(int height)
Definition fsfont.c:22
char * font
Definition font.h:32
qword_t * fontx_print_ascii(qword_t *q, int context, const unsigned char *str, int alignment, const vertex_t *v0, color_t *c0, fontx_t *fontx)
Definition fontx.c:559
void fontstudio_unload_ini(fsfont_t *font)
Definition fsfont.c:313
char bold
Definition font.h:20
qword_t * fontx_print_sjis(qword_t *q, int context, const unsigned char *str, int alignment, const vertex_t *v0, color_t *c0, fontx_t *ascii, fontx_t *kanji)
Definition fontx.c:735
int rowsize
Definition font.h:26
char w_margin
Definition font.h:22
char * fontstudio_load_ini(const char *path)
Definition fsfont.c:53
char h_margin
Definition font.h:24
Definition font.h:16