MPLABĀ® Harmony Graphics Suite
Data Structures | Typedefs | Enumerations | Functions
legato_font.h File Reference

Font functions and definitions. More...

#include "gfx/legato/common/legato_color.h"
#include "gfx/legato/core/legato_stream.h"
Include dependency graph for legato_font.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  leFontGlyph
 This struct represents a font glyph. More...
 
struct  leFont
 This struct represents a font object. More...
 
struct  leRasterFont
 This struct represents a rasterized font object. More...
 

Typedefs

typedef enum leFontBPP leFontBPP
 This enum represents a font. More...
 
typedef struct leFontGlyph leFontGlyph
 This struct represents a font glyph. More...
 
typedef enum leFontType leFontType
 This enum represents a font type. More...
 
typedef struct leFont leFont
 This struct represents a font object. More...
 
typedef struct leRasterFont leRasterFont
 This struct represents a rasterized font object. More...
 

Enumerations

enum  leFontBPP { LE_FONT_BPP_1, LE_FONT_BPP_8 }
 This enum represents a font. More...
 
enum  leFontType { LE_RASTER_FONT, LE_VECTOR_FONT }
 This enum represents a font type. More...
 

Functions

leResult leFont_GetGlyphInfo (const leFont *fnt, uint32_t codepoint, leFontGlyph *glyph)
 Get glyph info. More...
 
leResult leFont_GetGlyphRect (const leFontGlyph *glyph, leRect *rect)
 Get glyph rectangle. More...
 
void leFont_DrawUnknownGlyph (int32_t x, int32_t y, const leFontGlyph *glyph, leColor clr, uint32_t a)
 Drawn unknown glyph. More...
 
leResult leFont_DrawGlyph (const leFont *fnt, const leFontGlyph *glyph, int32_t x, int32_t y, leColor clr, uint32_t a)
 Draws a glyph. More...
 
leResult leFont_DrawGlyphData (const leFont *fnt, const leFontGlyph *glyph, const uint8_t *data, int32_t x, int32_t y, leColor clr, uint32_t a)
 Draws a glyph. More...
 
void leFont_DrawGlyphRow (leFontBPP bpp, const uint8_t *data, int32_t x, int32_t y, int32_t colStart, int32_t colEnd, leColor clr, uint32_t a)
 Draws a glyph from a raw data buffer. More...
 

Detailed Description

Font functions and definitions.

Describes font assets and type definitions.

Typedef Documentation

◆ leFont

typedef struct leFont leFont

This struct represents a font object.

All fonts have a header and font type.

◆ leFontBPP

typedef enum leFontBPP leFontBPP

This enum represents a font.

This is used to provide possible font types either standard or antialized.

◆ leFontGlyph

typedef struct leFontGlyph leFontGlyph

This struct represents a font glyph.

This is used describe a individual character of a font. Each glyph contains kerning data and options unique to itself. This data is used for proper glyph positioning when rendering text.

◆ leFontType

typedef enum leFontType leFontType

This enum represents a font type.

Currently only raster fonts are supported but this differentiation will allow for future expansion into vector font support.

◆ leRasterFont

typedef struct leRasterFont leRasterFont

This struct represents a rasterized font object.

A raster font asset is a series of raster images that represent linguistic characters. These characters are referenced by an index called a 'code point'. This code point is 1-2 bytes in length. Code points may be encoded to save space. Fonts also contain general kerning data that describes character positioning data.

Enumeration Type Documentation

◆ leFontBPP

enum leFontBPP

This enum represents a font.

This is used to provide possible font types either standard or antialized.

Enumerator
LE_FONT_BPP_1 

standard

LE_FONT_BPP_8 

antialiased

◆ leFontType

enum leFontType

This enum represents a font type.

Currently only raster fonts are supported but this differentiation will allow for future expansion into vector font support.

Function Documentation

◆ leFont_DrawGlyph()

leResult leFont_DrawGlyph ( const leFont fnt,
const leFontGlyph glyph,
int32_t  x,
int32_t  y,
leColor  clr,
uint32_t  a 
)

Draws a glyph.

Draws a glyph glyph to location x, y with color clr and alpha a.

leResult res = leFont_DrawGlyph(x, y, glyph, clr, a);
Parameters
xthe screen x location to draw
ythe screen y location to draw
glyphthe glyph kerning information
clrthe glyph render color
aglobal alpha value to apply
Returns
LE_SUCCESS if set, otherwise LE_FAILURE.

◆ leFont_DrawGlyphData()

leResult leFont_DrawGlyphData ( const leFont fnt,
const leFontGlyph glyph,
const uint8_t *  data,
int32_t  x,
int32_t  y,
leColor  clr,
uint32_t  a 
)

Draws a glyph.

Draws a glyph glyph from data to location x, y with color clr and alpha a.

leResult res = leFont_DrawGlyphData(fnt, glyph, data, x, y, clr, a);
Parameters
xthe screen x location to draw
ythe screen y location to draw
glyphthe glyph kerning information
clrthe glyph render color
aglobal alpha value to apply
Returns
LE_SUCCESS if set, otherwise LE_FAILURE.

◆ leFont_DrawGlyphRow()

void leFont_DrawGlyphRow ( leFontBPP  bpp,
const uint8_t *  data,
int32_t  x,
int32_t  y,
int32_t  colStart,
int32_t  colEnd,
leColor  clr,
uint32_t  a 
)

Draws a glyph from a raw data buffer.

Draws a glyph from a raw data buffer.

leResult res = leFont_DrawGlyphRow(bpp, data, x, y, colStart, colEnd, clr, a);
Parameters
xthe screen x location to draw
ythe screen y location to draw
glyphthe glyph kerning information
clrthe glyph render color
aglobal alpha value to apply
Returns
void.

◆ leFont_DrawUnknownGlyph()

void leFont_DrawUnknownGlyph ( int32_t  x,
int32_t  y,
const leFontGlyph glyph,
leColor  clr,
uint32_t  a 
)

Drawn unknown glyph.

Draws the 'unknown glyph' glyph to location x, y with color clr and alpha a.

leResult res = leFont_DrawUnknownGlyph(x, y, glyph, clr, a);
Parameters
xthe screen x location to draw
ythe screen y location to draw
glyphthe glyph kerning information
clrthe glyph render color
aglobal alpha value to apply
Returns
void.

◆ leFont_GetGlyphInfo()

leResult leFont_GetGlyphInfo ( const leFont fnt,
uint32_t  codepoint,
leFontGlyph glyph 
)

Get glyph info.

Get glyph info glyph by fnt and codepoint.

uint32_t lessor = leFont_GetGlyphInfo(fnt, codepoint, glyph);
Parameters
fntthe font to query
codepointthe codepoint to lookup
glyphthe glyph data that was retrieved.
Returns
LE_SUCCESS if set, otherwise LE_FAILURE.

◆ leFont_GetGlyphRect()

leResult leFont_GetGlyphRect ( const leFontGlyph glyph,
leRect rect 
)

Get glyph rectangle.

Gets a glyph rectangle rect by glyph.

leFontGlyph* glyph;
leRect* rect;
leResult res = leFont_GetGlyphRect(glyph, rect);
Parameters
glyphis an integer.
rectis an integer.
Returns
LE_SUCCESS if set, otherwise LE_FAILURE.
leResult
leResult
This enum represents function call results.
Definition: legato_common.h:134
leRect
This struct represents a rectangle.
Definition: legato_common.h:405
leFont_DrawGlyphData
leResult leFont_DrawGlyphData(const leFont *fnt, const leFontGlyph *glyph, const uint8_t *data, int32_t x, int32_t y, leColor clr, uint32_t a)
Draws a glyph.
Definition: legato_font.c:290
leFont_GetGlyphRect
leResult leFont_GetGlyphRect(const leFontGlyph *glyph, leRect *rect)
Get glyph rectangle.
Definition: legato_font.c:227
leFont_DrawGlyph
leResult leFont_DrawGlyph(const leFont *fnt, const leFontGlyph *glyph, int32_t x, int32_t y, leColor clr, uint32_t a)
Draws a glyph.
Definition: legato_font.c:349
leFontGlyph
This struct represents a font glyph.
Definition: legato_font.h:90
leFont_GetGlyphInfo
leResult leFont_GetGlyphInfo(const leFont *fnt, uint32_t codepoint, leFontGlyph *glyph)
Get glyph info.
Definition: legato_font.c:171
leFont_DrawGlyphRow
void leFont_DrawGlyphRow(leFontBPP bpp, const uint8_t *data, int32_t x, int32_t y, int32_t colStart, int32_t colEnd, leColor clr, uint32_t a)
Draws a glyph from a raw data buffer.
Definition: legato_font.c:159
leFont_DrawUnknownGlyph
void leFont_DrawUnknownGlyph(int32_t x, int32_t y, const leFontGlyph *glyph, leColor clr, uint32_t a)
Drawn unknown glyph.
Definition: legato_font.c:241