Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site











SourceForge.net Logo

Font and Text Routines

 

void SetStdFont(Font font)

Sets the standard font. This is the default font used to draw most GUI texts. Standard font is normally set during GUI startup and application rarely need to call this function.

 


 

Font GetStdFont()

Returns the standard font.

 


 

int GetStdFontCy()

Returns the standard font height (in pixels or dots).

 


 

Font StdFont()

Same as GetStdFont().

 


 

Font StdFont(int h)

Returns standard font with height changed to h.

 


 

Font Serif(int n)

Returns default serif font with height n.

 


 

Font SansSerif(int n = -32000)

Returns default sans-serif font with height n.

 


 

Font Monospace(int n = -32000)

Returns default monospace font with height n.

 


 

bool Compose(Font font, int chr, ComposedGlyph& cg)

This function is used by DrawText implementation when unicode point chr is missing in font. Function tries to find two glyphs, one from original font and second possibly from other font which, when composed, result in character corresponding to required codepoint (e.g. C + ˇ = Č). If such glyphs exist, they are returned in cg and function returns true.

 


 

Size GetTextSize(const wchar *text, Font font, int n = -1)

Size GetTextSize(const WString& text, Font font)

Size GetTextSize(const char *text, byte charset, Font font, int n = -1)

Size GetTextSize(const char *text, Font font, int n = -1)

Size GetTextSize(const String& text, Font font)

Computes the graphical size of text if drawn with font, using font metrics. Returned height is the height of font (ascent+descent), returned with is the total advance width of text. No overhangs are considered. n is a number of characters; if negative (default value), it is obtained using [w]strlen. Text can either be unicode or in 8-bit encoding; in that case either charset is provided or it is assumed to be default charset.

 


 

void DrawTextEllipsis(Draw& w, int x, int y, int cx, const char *text, const char *ellipsis, Font font = StdFont(), Color ink = SColorText(), int n = -1)

void DrawTextEllipsis(Draw& w, int x, int y, int cx, const wchar *text, const char *ellipsis, Font font = StdFont(), Color ink = SColorText(), int n = -1)

Draws a text line limited in width to cx. If the text is longer than what could be fitted to cx , it is it is truncated so that it fits together with ellipsis text appended into cx, then drawn with ellipsis appended. n is the number of characters to be drawn, if -1, [w]strlen(text) is used instead.

 


 

void DrawTLText(Draw& draw, int x, int y, int cx, const wchar *text, Font font = StdFont(), Color ink = SColorText(), int accesskey = 0)

This function draws multiline text with tabs (contains '\n' and '\t'), possibly underline single character accesskey in the text. Width is limited by cx and text is word - wrapped if line is longer.

 


 

Size GetTLTextSize(const wchar *text, Font font = StdFont())

Returns the size of multiline text with tabs.

 


 

int GetTLTextHeight(const wchar *s, Font font)

Same as GetTLTextSize(s, font).cy.

 

 

Last edit by cxl on 03/27/2020. Do you want to contribute?. T++