PS2SDK
PS2 Homebrew Libraries
Loading...
Searching...
No Matches
font.h File Reference
#include <draw.h>
#include <tamtypes.h>
+ Include dependency graph for font.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  fontx_t
 
struct  inidata_t
 
struct  fsfont_t
 

Macros

#define SINGLE_BYTE   0
 
#define DOUBLE_BYTE   1
 
#define LEFT_ALIGN   0
 
#define CENTER_ALIGN   1
 
#define RIGHT_ALIGN   2
 

Functions

int fontx_load (const char *path, fontx_t *fontx, int type, int wmargin, int hmargin, int bold)
 
void fontx_unload (fontx_t *fontx)
 
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)
 
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)
 
fsfont_tfontstudio_init (int height)
 
void fontstudio_free (fsfont_t *font)
 
int fontstudio_parse_ini (fsfont_t *font, char *ini, float tex_width, float tex_height)
 
char * fontstudio_load_ini (const char *path)
 
void fontstudio_unload_ini (fsfont_t *font)
 
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)
 

Detailed Description

Font library.

Definition in file font.h.


Data Structure Documentation

◆ fontx_t

struct fontx_t

Definition at line 16 of file font.h.

Data Fields
char name[9]

Name of font

char bold

Enable/Disable bold effect

char w_margin

Margin width between characters

char h_margin

Margin height between lines

int rowsize

Size in byte of each row

int charsize

Size in bytes of each character

int offset

Offset from beginning of font to character

char * font

The font data

◆ inidata_t

struct inidata_t

FontStudio type fonts

Definition at line 36 of file font.h.

Data Fields
char A
char B
char C
char ox
char oy
char width
char height
unsigned short u1
unsigned short v1
unsigned short u2
unsigned short v2

◆ fsfont_t

struct fsfont_t

Definition at line 50 of file font.h.

+ Collaboration diagram for fsfont_t:
Data Fields
float scale
char height
unsigned short * charmap
int totalchars
int spacewidth
inidata_t * chardata

Macro Definition Documentation

◆ SINGLE_BYTE

#define SINGLE_BYTE   0

FontX2 types

Definition at line 13 of file font.h.

◆ DOUBLE_BYTE

#define DOUBLE_BYTE   1

Definition at line 14 of file font.h.

◆ LEFT_ALIGN

#define LEFT_ALIGN   0

Alignments

Definition at line 60 of file font.h.

◆ CENTER_ALIGN

#define CENTER_ALIGN   1

Definition at line 61 of file font.h.

◆ RIGHT_ALIGN

#define RIGHT_ALIGN   2

Definition at line 62 of file font.h.

Function Documentation

◆ fontx_load()

int fontx_load ( const char *  path,
fontx_t fontx,
int  type,
int  wmargin,
int  hmargin,
int  bold 
)

Loads a FontX2 type font with set characteristics Use "rom0:KROM" as the path to load the PS2's internal FontX2 font

Definition at line 262 of file fontx.c.

References fontx_t::bold, fontx_t::charsize, fontx_t::font, fontx_load(), fontx_t::h_margin, fontx_hdr::height, fontx_hdr::id, fontx_t::name, fontx_hdr::name, fontx_t::offset, fontx_t::rowsize, SINGLE_BYTE, fontx_hdr::table_num, fontx_hdr::type, fontx_t::w_margin, and fontx_hdr::width.

Referenced by fontx_load().

◆ fontx_unload()

void fontx_unload ( fontx_t fontx)

Frees memory if a font is loaded

Definition at line 382 of file fontx.c.

References fontx_t::font, and fontx_unload().

Referenced by fontx_unload().

◆ fontx_print_ascii()

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 
)

◆ fontx_print_sjis()

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 
)

◆ fontstudio_init()

fsfont_t * fontstudio_init ( int  height)

Loads the FontStudio ini file that contains the font texture's characteristics

Definition at line 22 of file fsfont.c.

References fontstudio_init().

Referenced by fontstudio_init().

◆ fontstudio_free()

void fontstudio_free ( fsfont_t font)

Definition at line 36 of file fsfont.c.

◆ fontstudio_parse_ini()

int fontstudio_parse_ini ( fsfont_t font,
char *  ini,
float  tex_width,
float  tex_height 
)

Parses a font's ini for the font. The content of ini is no longer required afterwards and can be discarded.

Definition at line 91 of file fsfont.c.

References fontstudio_parse_ini().

Referenced by fontstudio_parse_ini().

◆ fontstudio_load_ini()

char * fontstudio_load_ini ( const char *  path)

Loads an ini file into memory and returns pointer to it

Definition at line 53 of file fsfont.c.

References fontstudio_load_ini().

Referenced by fontstudio_load_ini().

◆ fontstudio_unload_ini()

void fontstudio_unload_ini ( fsfont_t font)

Unloads a parsed font's ini file.

Definition at line 313 of file fsfont.c.

References fontstudio_unload_ini().

Referenced by fontstudio_unload_ini().

◆ fontstudio_print_string()

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 
)

Prints a unicode formatted string (UTF+8)

Definition at line 456 of file fsfont.c.

References draw_prim_end(), draw_prim_start(), fontstudio_print_string(), and LEFT_ALIGN.

Referenced by fontstudio_print_string().