OldSchool Library
text.h File Reference

Text handling functions in OSLib. More...

#include "intraFont/intraFont.h"

Data Structures

struct  OSL_FONT
 Loaded font structure. More...
 
struct  OSL_FONTINFO
 Font information type. More...
 
struct  OSL_FONT_FORMAT_HEADER
 Header of a .oft file (Oslib FonT). More...
 

Macros

#define oslSetFont(f)
 Sets the current font.
 
#define OSL_FONT_OFT   1
 Font type for OFT.
 
#define OSL_FONT_INTRA   2
 Font type for INTRA.
 
#define OSL_TEXT_CHARPOSXY(f, i)
 Returns the position of a character 'i' in the font 'f' texture as a pair (x, y).
 
#define oslDrawStringf(x, y, ...)
 Draws a formatted string literal at the specified position.
 

Functions

void oslInitConsole ()
 Initializes the console.
 
OSL_FONToslLoadFontFile (const char *filename)
 Loads a font from a file.
 
OSL_FONToslLoadFont (OSL_FONTINFO *fi)
 Loads a font from a OSL_FONTINFO file (located in RAM).
 
void oslDrawChar (int x, int y, unsigned char c)
 Draws a character at the specified position.
 
void oslDrawString (int x, int y, const char *str)
 Draws a string literal at the specified position.
 
void oslDrawStringLimited (int x, int y, int width, const char *str)
 Draws a string literal at the specified position, limited to a given width.
 
void oslConsolePrint (const char *str)
 Outputs a text to the console at the current cursor position.
 
void oslSetTextColor (OSL_COLOR color)
 Sets the current text color.
 
void oslSetBkColor (OSL_COLOR color)
 Sets the text background color.
 
void oslDrawTextBox (int x0, int y0, int x1, int y1, const char *text, int format)
 Draws a text box with automatic line wrapping.
 
void oslDrawTextBoxByWords (int x0, int y0, int x1, int y1, const char *text, int format)
 Draws a text box with automatic word wrapping.
 
void oslDeleteFont (OSL_FONT *f)
 Deletes a font.
 
int oslGetStringWidth (const char *str)
 Returns the width of a string in pixels.
 
int oslGetTextBoxHeight (int width, int maxHeight, const char *text, int format)
 Returns the height of a text box.
 
int oslIntraFontInit (unsigned int options)
 Initializes intraFont.
 
OSL_FONToslLoadIntraFontFile (const char *filename, unsigned int options)
 Loads a font from a pgf file (intraFont).
 
void oslLoadAltIntraFontFile (OSL_FONT *font, const char *filename)
 Loads an alternative intraFont file.
 
void oslIntraFontSetStyle (OSL_FONT *f, float size, unsigned int color, unsigned int shadowColor, float angle, unsigned int options)
 Sets the style for a pgf font.
 
float oslIntraFontPrintColumn (OSL_FONT *f, float x, float y, float width, const char *text)
 Draws text along the baseline starting at x, y.
 
void oslIntraFontShutdown ()
 Shuts down intraFont.
 

Variables

OSL_FONTosl_curFont
 
int osl_consolePosX
 
int osl_consolePosY
 
OSL_FONTosl_sceFont
 System OSLib font.
 
OSL_FONTINFO osl_sceFontInfo
 Font to be loaded.
 

Detailed Description

Text handling functions in OSLib.

This file provides all text-related functions, structures, and macros necessary for rendering and managing fonts in OSLib, including loading custom fonts, handling intraFont, and drawing text on the screen.

Don't forget to check the 'Debug Console' section (subsection of the 'Main' section) for further debugging-related functions.