The Battle for Wesnoth  1.15.2+dev
Public Member Functions | Private Member Functions | Private Attributes | List of all members
font::text_surface Class Reference

#include <text_surface.hpp>

Public Member Functions

 text_surface (const std::string &str, int size, color_t color, int style)
 
 text_surface (int size, color_t color, int style)
 
void set_text (const std::string &str)
 
void measure () const
 
std::size_t width () const
 
std::size_t height () const
 
const std::vector< surface > & get_surfaces () const
 
bool operator== (const text_surface &t) const
 
bool operator!= (const text_surface &t) const
 

Private Member Functions

void hash ()
 

Private Attributes

int hash_
 
int font_size_
 
color_t color_
 
int style_
 
int w_
 
int h_
 
std::string str_
 
bool initialized_
 
std::vector< text_chunkchunks_
 
std::vector< surfacesurfs_
 

Detailed Description

Definition at line 32 of file text_surface.hpp.

Constructor & Destructor Documentation

◆ text_surface() [1/2]

font::text_surface::text_surface ( const std::string &  str,
int  size,
color_t  color,
int  style 
)

Definition at line 72 of file text_surface.cpp.

References hash().

◆ text_surface() [2/2]

font::text_surface::text_surface ( int  size,
color_t  color,
int  style 
)

Definition at line 94 of file text_surface.cpp.

Member Function Documentation

◆ get_surfaces()

const std::vector< surface > & font::text_surface::get_surfaces ( ) const

◆ hash()

void font::text_surface::hash ( )
private

Definition at line 123 of file text_surface.cpp.

References c, h, hash_, and str_.

Referenced by set_text(), and text_surface().

◆ height()

std::size_t font::text_surface::height ( ) const

◆ measure()

void font::text_surface::measure ( ) const

Definition at line 132 of file text_surface.cpp.

References chunks_, font_size_, font::sdl_ttf::get_font(), h, h_, style_, w, and w_.

Referenced by height(), and width().

◆ operator!=()

bool font::text_surface::operator!= ( const text_surface t) const
inline

Definition at line 48 of file text_surface.hpp.

References operator==().

◆ operator==()

bool font::text_surface::operator== ( const text_surface t) const

Definition at line 195 of file text_surface.cpp.

References color_, font_size_, hash_, str_, and style_.

Referenced by operator!=().

◆ set_text()

void font::text_surface::set_text ( const std::string &  str)

Definition at line 111 of file text_surface.cpp.

References h_, hash(), initialized_, str_, and w_.

Referenced by font::render_text().

◆ width()

std::size_t font::text_surface::width ( ) const

Member Data Documentation

◆ chunks_

std::vector<text_chunk> font::text_surface::chunks_
mutableprivate

Definition at line 57 of file text_surface.hpp.

Referenced by get_surfaces(), height(), measure(), and width().

◆ color_

color_t font::text_surface::color_
private

Definition at line 52 of file text_surface.hpp.

Referenced by get_surfaces(), and operator==().

◆ font_size_

int font::text_surface::font_size_
private

Definition at line 51 of file text_surface.hpp.

Referenced by get_surfaces(), measure(), and operator==().

◆ h_

int font::text_surface::h_
mutableprivate

Definition at line 54 of file text_surface.hpp.

Referenced by height(), measure(), and set_text().

◆ hash_

int font::text_surface::hash_
private

Definition at line 50 of file text_surface.hpp.

Referenced by hash(), and operator==().

◆ initialized_

bool font::text_surface::initialized_
mutableprivate

Definition at line 56 of file text_surface.hpp.

Referenced by get_surfaces(), and set_text().

◆ str_

std::string font::text_surface::str_
private

Definition at line 55 of file text_surface.hpp.

Referenced by hash(), height(), operator==(), set_text(), and width().

◆ style_

int font::text_surface::style_
private

Definition at line 53 of file text_surface.hpp.

Referenced by get_surfaces(), measure(), and operator==().

◆ surfs_

std::vector<surface> font::text_surface::surfs_
mutableprivate

Definition at line 58 of file text_surface.hpp.

Referenced by get_surfaces().

◆ w_

int font::text_surface::w_
mutableprivate

Definition at line 54 of file text_surface.hpp.

Referenced by measure(), set_text(), and width().


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