Btk
Btk::Font Class Reference

Font Class. More...

#include <font.hpp>

Public Member Functions

 Font (const Font &font)
 
 Font (Font &&f)
 
 Font (std::string_view fontname, int ptsize)
 Construct a new Font object. More...
 
PixBuf render_solid (std::string_view text, Color color)
 Render solid text. More...
 
PixBuf render_solid (std::u16string_view text, Color color)
 
PixBuf render_shaded (std::string_view text, Color fg, Color bg)
 Render shaded text. More...
 
PixBuf render_shaded (std::u16string_view text, Color fg, Color bg)
 
PixBuf render_blended (std::string_view text, Color color)
 Render blended text. More...
 
PixBuf render_blended (std::u16string_view text, Color color)
 
int kerning_size (char16_t prev_ch, char16_t ch) const
 Get Kerning Size in two chars. More...
 
bool has_glyph (char16_t ch) const
 Check the font has the glyph. More...
 
int height () const
 Get font height. More...
 
int ptsize () const noexcept
 Get font ptsize. More...
 
int refcount () const noexcept
 Get font refcount. More...
 
void set_ptsize (int new_ptsize)
 Set the font ptsize. More...
 
Size size (std::string_view text)
 Get The text's w and h. More...
 
Size size (std::u16string_view text)
 
void close ()
 Close font. More...
 
void open (std::string_view fontname, int ptsize)
 Open font by its name. More...
 
void openfile (std::string_view filename, int ptsize)
 Open font by its filename. More...
 
Font clone () const
 Clone a font. More...
 
FontStyle style () const
 Get this font's style. More...
 
void set_style (FontStyle style)
 Set the style. More...
 
FontImplimpl () const noexcept
 
std::string family () const
 Get font family name. More...
 
std::string style_name () const
 
Fontoperator= (const Font &)
 Assign font. More...
 
Fontoperator= (Font &&)
 
bool empty () const noexcept
 

Static Public Member Functions

static Font FromFile (std::string_view filename, int ptsize)
 Open font by its filename. More...
 

Detailed Description

Font Class.

Constructor & Destructor Documentation

◆ Font()

Btk::Font::Font ( std::string_view  fontname,
int  ptsize 
)

Construct a new Font object.

Parameters
fontnameFont name
ptsizeFont ptsize

Member Function Documentation

◆ clone()

Font Btk::Font::clone ( ) const

Clone a font.

Returns
Font

◆ close()

void Btk::Font::close ( )

Close font.

◆ family()

std::string Btk::Font::family ( ) const

Get font family name.

Returns
family name

◆ FromFile()

Font Btk::Font::FromFile ( std::string_view  filename,
int  ptsize 
)
static

Open font by its filename.

Parameters
filenameFont filename
ptsizeFont ptsize
Returns
Font

◆ has_glyph()

bool Btk::Font::has_glyph ( char16_t  ch) const

Check the font has the glyph.

Parameters
chThe utf16 char
Returns
true
false

◆ height()

int Btk::Font::height ( ) const

Get font height.

Returns
int

◆ kerning_size()

int Btk::Font::kerning_size ( char16_t  prev_ch,
char16_t  ch 
) const

Get Kerning Size in two chars.

Parameters
prev_chThe first char
chThe next char
Returns
The kerning

◆ open()

void Btk::Font::open ( std::string_view  fontname,
int  ptsize 
)

Open font by its name.

Parameters
fontnameFont name
ptsizeFont ptsize

◆ openfile()

void Btk::Font::openfile ( std::string_view  filename,
int  ptsize 
)

Open font by its filename.

Parameters
filenameFont filename
ptsizeFont ptsize

◆ operator=()

Font & Btk::Font::operator= ( const Font f)

Assign font.

Returns
*this

◆ ptsize()

int Btk::Font::ptsize ( ) const
noexcept

Get font ptsize.

Returns
int

◆ refcount()

int Btk::Font::refcount ( ) const
noexcept

Get font refcount.

Returns
int

◆ render_blended()

PixBuf Btk::Font::render_blended ( std::string_view  text,
Color  color 
)

Render blended text.

Note
This one is slowest
Parameters
textYour text
colorText color
Returns
PixBuf

◆ render_shaded()

PixBuf Btk::Font::render_shaded ( std::string_view  text,
Color  fg,
Color  bg 
)

Render shaded text.

Note
This one is middle speed
Parameters
textYour text
fgText color
bgBackGround color
Returns
PixBuf

◆ render_solid()

PixBuf Btk::Font::render_solid ( std::string_view  text,
Color  color 
)

Render solid text.

Note
This one is fastest
Parameters
textYour text
colorText color
Returns
PixBuf

◆ set_ptsize()

void Btk::Font::set_ptsize ( int  new_ptsize)

Set the font ptsize.

Parameters
new_ptsizeNew ptsize

◆ set_style()

void Btk::Font::set_style ( FontStyle  style)

Set the style.

Parameters
styleThe style you want to set

◆ size()

Size Btk::Font::size ( std::string_view  text)

Get The text's w and h.

Parameters
textThe text
Returns
w and h (-1 if failed)

◆ style()

FontStyle Btk::Font::style ( ) const

Get this font's style.

Returns
FontStyle

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