Make Text::getFont return a reference

because a the m_font pointer cannot be null.
This commit is contained in:
kimci86 2023-08-05 20:19:37 +02:00 committed by Chris Thrasher
parent 623d0f67ea
commit 3d2944998d
2 changed files with 5 additions and 6 deletions

View File

@ -283,16 +283,15 @@ public:
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// \brief Get the text's font /// \brief Get the text's font
/// ///
/// If the text has no font attached, a null pointer is returned. /// The returned reference is const, which means that you
/// The returned pointer is const, which means that you
/// cannot modify the font when you get it from this function. /// cannot modify the font when you get it from this function.
/// ///
/// \return Pointer to the text's font /// \return Reference to the text's font
/// ///
/// \see setFont /// \see setFont
/// ///
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
const Font* getFont() const; const Font& getFont() const;
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// \brief Get the character size /// \brief Get the character size

View File

@ -241,9 +241,9 @@ const String& Text::getString() const
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
const Font* Text::getFont() const const Font& Text::getFont() const
{ {
return m_font; return *m_font;
} }