wiki:Docs/Prog/Manual/ApplicationLibraries/lib825ev/Display/CFont

CFont 825gen2

CFont is a C++ class that is provided to manage fonts for the 825gen2 indicator.

Constructors

CFont(void);
CFont(int num);

Parameters

  • num -

Examples

CFont fontBigLabel;
int err = fontBigLabel.Load("/usr/share/fonts/ttf/LiberationSans-Bold.ttf", 42,  62);
if(err)	{
   DEBUG_MSG("Big Font load label error %d\n", err);
}

Member Functions

CFreetypeFont& GetFont(int zoom)

Returns the contained CFreetypeFont for the specified zoom state.

Parameters

  • zoom -

Return Value

Remarks

Example

Load

int Load(const char* filename, int pixHeight1, int pixHeight2);

Parameters

  • filename - path and filename of the font file
  • pixHeight1 - height of the font for normal state
  • pixHeight2 - height of the font for zoom state

Return Value

0 if no error otherwise, freetype error value such as FT_Err_Unknown_File_Format.

SetPixelSize

int GetHeight(int zoom);

Parameters

  • zoom -

Return Value

Returns the pixel height for the specified zoom state

GetStrWidth

int GetStrWidth(const char* str, int len, int zoom);

Parameters

  • str - source string
  • len - number of characters of the string to evaluate
  • zoom - zoom state

Return Value

Returns the pixel height for the specified zoom state

DisplayText

Displays a string using the specified font.

void DisplayText(const char* str, CDspArea *dspArea = NULL, int len = 0, int shortcutChar = 0);
void DisplayText(std::string& str, CDspArea *dspArea = NULL, int len = 0, int shortcutChar = 0);
void DisplayText(int x, int y, const char* str, CDspArea *dspArea = NULL, int len = 0, int shortcutChar = 0);
void DisplayText(int x, int y, std::string& str, CDspArea *dspArea = NULL, int len = 0, int shortcutChar = 0);
void DisplayText(CFormRect& rect, const char* str, int flag = 0, CDspArea* dspArea = NULL, int shortcutChar = 0);
void DisplayText(CFormRect& rect, std::string& str, int flag = 0, CDspArea* dspArea = NULL, int shortcutChar = 0);

Parameters

  • str - source string
  • dspArea - specific display area or if NULL the default dspMain.
  • len - maximum characters to display
  • shortcut - character position to show underlined as shortcut.
  • flag - For versions that take a rect argument can be TEXT_ALIGN_LEFT, TEXT_ALIGN_CENTER, or TEXT_ALIGN_RIGHT.

Return Value

Returns the pixel height for the specified zoom state

Last modified 10 months ago Last modified on 02/13/24 12:00:52
Note: See TracWiki for help on using the wiki.