Make setters return reference to self: Font

This commit is contained in:
Dmitry Marakasov 2015-01-19 00:44:15 +03:00
parent f9ef31c4b2
commit 739629354b
2 changed files with 20 additions and 8 deletions

View File

@ -68,32 +68,36 @@ int Font::GetStyle() const {
return TTF_GetFontStyle(font_); return TTF_GetFontStyle(font_);
} }
void Font::SetStyle(int style) { Font& Font::SetStyle(int style) {
TTF_SetFontStyle(font_, style); TTF_SetFontStyle(font_, style);
return *this;
} }
int Font::GetOutline() const { int Font::GetOutline() const {
return TTF_GetFontOutline(font_); return TTF_GetFontOutline(font_);
} }
void Font::SetOutline(int outline) { Font& Font::SetOutline(int outline) {
TTF_SetFontOutline(font_, outline); TTF_SetFontOutline(font_, outline);
return *this;
} }
int Font::GetHinting() const { int Font::GetHinting() const {
return TTF_GetFontHinting(font_); return TTF_GetFontHinting(font_);
} }
void Font::SetHinting(int hinting) { Font& Font::SetHinting(int hinting) {
TTF_SetFontHinting(font_, hinting); TTF_SetFontHinting(font_, hinting);
return *this;
} }
bool Font::GetKerning() const { bool Font::GetKerning() const {
return TTF_GetFontKerning(font_); return TTF_GetFontKerning(font_);
} }
void Font::SetKerning(bool allowed) { Font& Font::SetKerning(bool allowed) {
TTF_SetFontKerning(font_, allowed); TTF_SetFontKerning(font_, allowed);
return *this;
} }
int Font::GetHeight() const { int Font::GetHeight() const {

View File

@ -177,10 +177,12 @@ public:
/// In this case, you should probably turn off these styles and draw your /// In this case, you should probably turn off these styles and draw your
/// own strikethroughs and underlines. /// own strikethroughs and underlines.
/// ///
/// \returns Reference to self
///
/// \see https://www.libsdl.org/projects/SDL_ttf/docs/SDL_ttf.html#SEC22 /// \see https://www.libsdl.org/projects/SDL_ttf/docs/SDL_ttf.html#SEC22
/// ///
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
void SetStyle(int style = TTF_STYLE_NORMAL); Font& SetStyle(int style = TTF_STYLE_NORMAL);
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// \brief Get the current outline size of the loaded font /// \brief Get the current outline size of the loaded font
@ -202,10 +204,12 @@ public:
/// glyphs, even if there is no change in outline size, so it may be best /// glyphs, even if there is no change in outline size, so it may be best
/// to check the current outline size by using GetOutline() first /// to check the current outline size by using GetOutline() first
/// ///
/// \returns Reference to self
///
/// \see https://www.libsdl.org/projects/SDL_ttf/docs/SDL_ttf.html#SEC24 /// \see https://www.libsdl.org/projects/SDL_ttf/docs/SDL_ttf.html#SEC24
/// ///
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
void SetOutline(int outline = 0); Font& SetOutline(int outline = 0);
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// \brief Get the current hinting setting of the loaded font /// \brief Get the current hinting setting of the loaded font
@ -235,10 +239,12 @@ public:
/// glyphs, even if there is no change in hinting, so it may be best /// glyphs, even if there is no change in hinting, so it may be best
/// to check the current hinting by using GetHinting() first /// to check the current hinting by using GetHinting() first
/// ///
/// \returns Reference to self
///
/// \see https://www.libsdl.org/projects/SDL_ttf/docs/SDL_ttf.html#SEC26 /// \see https://www.libsdl.org/projects/SDL_ttf/docs/SDL_ttf.html#SEC26
/// ///
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
void SetHinting(int hinting = TTF_HINTING_NORMAL); Font& SetHinting(int hinting = TTF_HINTING_NORMAL);
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// \brief Get the current kerning setting of the loaded font /// \brief Get the current kerning setting of the loaded font
@ -264,10 +270,12 @@ public:
/// is not working for a specific font, resulting in overlapping /// is not working for a specific font, resulting in overlapping
/// glyphs or abnormal spacing within words. /// glyphs or abnormal spacing within words.
/// ///
/// \returns Reference to self
///
/// \see https://www.libsdl.org/projects/SDL_ttf/docs/SDL_ttf.html#SEC28 /// \see https://www.libsdl.org/projects/SDL_ttf/docs/SDL_ttf.html#SEC28
/// ///
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
void SetKerning(bool allowed = true); Font& SetKerning(bool allowed = true);
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// \brief Get the maximum pixel height of all glyphs of the loaded font /// \brief Get the maximum pixel height of all glyphs of the loaded font