Open Font Render 1.2
Loading...
Searching...
No Matches
OpenFontRender Class Reference

#include <OpenFontRender.h>

Classes

struct  Cursor
 Structure for handling cursor position. More...
 

Public Member Functions

 OpenFontRender ()
 
void setUseRenderTask (bool enable)
 Set whether the rendering task should be performed independently or not.
 
void setRenderTaskStackSize (unsigned int stack_size)
 Specify the stack size for independent rendering tasks.
 
void setCursor (int32_t x, int32_t y)
 Set cursor positions.
 
int32_t getCursorX ()
 Get current cursor x-coordinate.
 
int32_t getCursorY ()
 Get current cursor y-coordinate.
 
void seekCursor (int32_t delta_x, int32_t delta_y)
 Move cursor position.
 
void setFontColor (uint16_t font_color)
 Specify the text color.
 
void setBackgroundColor (uint16_t font_bgcolor)
 Specify the background color.
 
void setFontColor (uint16_t font_color, uint16_t font_bgcolor)
 Specify the text color and background color.
 
void setFontColor (uint8_t r, uint8_t g, uint8_t b)
 Specify the text color.
 
void setBackgroundColor (uint8_t r, uint8_t g, uint8_t b)
 Specify the background color.
 
void setFontColor (uint8_t fr, uint8_t fg, uint8_t fb, uint8_t br, uint8_t bg, uint8_t bb)
 Specify the text color and background color..
 
uint16_t getFontColor ()
 Get the current text color.
 
uint16_t getBackgroundColor ()
 Get the current background color.
 
void setFontSize (unsigned int pixel)
 Set the font size for rendering.
 
unsigned int getFontSize ()
 Get the current font size.
 
double setLineSpaceRatio (double line_space_ratio)
 Adjusts the width between lines of text.
 
double getLineSpaceRatio ()
 Get the current line space ratio.
 
void setBackgroundFillMethod (BgFillMethod method)
 Set the background fill method.
 
BgFillMethod getBackgroundFillMethod ()
 Get the current background fill method.
 
void setLayout (Layout layout)
 Set the direction of text writing.
 
Layout getLayout ()
 Get the current direction of text writing.
 
void setAlignment (Align align)
 Set the text alignment.
 
Align getAlignment ()
 Get the current text alignment.
 
void setCacheSize (unsigned int max_faces, unsigned int max_sizes, unsigned long max_bytes)
 Set FreeType cache size.
 
FT_Error loadFont (const unsigned char *data, size_t size, uint8_t target_face_index=0)
 Load font from memory.
 
FT_Error loadFont (const char *fpath, uint8_t target_face_index=0)
 Load font from external memory.
 
void unloadFont ()
 Unload font data.
 
uint16_t drawHString (const char *str, int32_t x, int32_t y, uint16_t fg, uint16_t bg, Align align, Drawing drawing, FT_BBox &abbox, FT_Error &error)
 Renders text horizontally.
 
FT_Error drawChar (char character, int32_t x=0, int32_t y=0, uint16_t fg=0xFFFF, uint16_t bg=0x0000, Align align=Align::Left)
 Render single character.
 
uint16_t drawString (const char *str, int32_t x=0, int32_t y=0, uint16_t fg=0xFFFF, uint16_t bg=0x0000, Layout layout=Layout::Horizontal)
 Renders text.
 
uint16_t cdrawString (const char *str, int32_t x=0, int32_t y=0, uint16_t fg=0xFFFF, uint16_t bg=0x0000, Layout layout=Layout::Horizontal)
 Renders text as Top-Center.
 
uint16_t rdrawString (const char *str, int32_t x=0, int32_t y=0, uint16_t fg=0xFFFF, uint16_t bg=0x0000, Layout layout=Layout::Horizontal)
 Renders text as Top-Right.
 
uint16_t printf (const char *fmt,...)
 Renders text with format specifier.
 
uint16_t cprintf (const char *fmt,...)
 Renders text as Top-Center with format specifier.
 
uint16_t rprintf (const char *fmt,...)
 Renders text as Top-Right with format specifier.
 
FT_BBox calculateBoundingBoxFmt (int32_t x, int32_t y, unsigned int font_size, Align align, Layout layout, const char *fmt,...)
 Calculate text bounding box with format specifier.
 
FT_BBox calculateBoundingBox (int32_t x, int32_t y, unsigned int font_size, Align align, Layout layout, const char *str)
 Calculate text bounding box.
 
uint32_t getTextWidth (const char *fmt,...)
 Calculate text width.
 
uint32_t getTextHeight (const char *fmt,...)
 Calculate text height.
 
unsigned int calculateFitFontSizeFmt (uint32_t limit_width, uint32_t limit_height, Layout layout, const char *fmt,...)
 Calculates the maximum font size that will fit the specified format string and the specified rectangle.
 
unsigned int calculateFitFontSize (uint32_t limit_width, uint32_t limit_height, Layout layout, const char *str)
 Calculates the maximum font size that will fit the specified string and the specified rectangle.
 
void showFreeTypeVersion ()
 Show using FreeType version.
 
void showCredit ()
 Show FreeType credit.
 
void getFreeTypeVersion (char *str)
 Get using FreeType version text.
 
void getCredit (char *str)
 Get using FreeType credit text.
 
void setDebugLevel (uint8_t level)
 Set debug output level.
 
template<typename T >
void setDrawer (T &drawer)
 Collectively set up screen control functions.
 
void set_drawPixel (std::function< void(int32_t, int32_t, uint16_t)> user_func)
 
void set_drawFastHLine (std::function< void(int32_t, int32_t, int32_t, uint16_t)> user_func)
 
void set_startWrite (std::function< void(void)> user_func)
 
void set_endWrite (std::function< void(void)> user_func)
 

Static Public Member Functions

template<typename T >
static void setSerial (T &output)
 Set up serial output control functions.
 
static void set_printFunc (std::function< void(const char *)> user_func)
 

Static Public Attributes

static const unsigned char MAIN_VERSION = 1
 Open Font Render library main version.
 
static const unsigned char MINOR_VERSION = 2
 Open Font Render library minor version.
 
static const unsigned char CACHE_SIZE_NO_LIMIT = 0
 FreeType cache size alias.
 
static const unsigned char CACHE_SIZE_MINIMUM = 1
 FreeType cache size alias.
 
static const unsigned char FT_VERSION_STRING_SIZE = 32
 Minimum string length for FreeType version.
 
static const unsigned char CREDIT_STRING_SIZE = 128
 Minimum string length for FreeType credit.
 

Constructor & Destructor Documentation

◆ OpenFontRender()

OpenFontRender::OpenFontRender ( )

Member Function Documentation

◆ set_drawFastHLine()

void OpenFontRender::set_drawFastHLine ( std::function< void(int32_t, int32_t, int32_t, uint16_t)>  user_func)
Here is the caller graph for this function:

◆ set_drawPixel()

void OpenFontRender::set_drawPixel ( std::function< void(int32_t, int32_t, uint16_t)>  user_func)
Here is the caller graph for this function:

◆ set_endWrite()

void OpenFontRender::set_endWrite ( std::function< void(void)>  user_func)
Here is the caller graph for this function:

◆ set_printFunc()

static void OpenFontRender::set_printFunc ( std::function< void(const char *)>  user_func)
static
Here is the caller graph for this function:

◆ set_startWrite()

void OpenFontRender::set_startWrite ( std::function< void(void)>  user_func)
Here is the caller graph for this function:

Member Data Documentation

◆ CACHE_SIZE_MINIMUM

const unsigned char OpenFontRender::CACHE_SIZE_MINIMUM = 1
static

FreeType cache size alias.

◆ CACHE_SIZE_NO_LIMIT

const unsigned char OpenFontRender::CACHE_SIZE_NO_LIMIT = 0
static

FreeType cache size alias.

◆ CREDIT_STRING_SIZE

const unsigned char OpenFontRender::CREDIT_STRING_SIZE = 128
static

Minimum string length for FreeType credit.

◆ FT_VERSION_STRING_SIZE

const unsigned char OpenFontRender::FT_VERSION_STRING_SIZE = 32
static

Minimum string length for FreeType version.

◆ MAIN_VERSION

const unsigned char OpenFontRender::MAIN_VERSION = 1
static

Open Font Render library main version.

◆ MINOR_VERSION

const unsigned char OpenFontRender::MINOR_VERSION = 2
static

Open Font Render library minor version.


The documentation for this class was generated from the following files: