/* _______ __ __ __ ______ __ __ _______ __ __ * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\ * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / / * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / / * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / / * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ / * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/ * * Copyright (c) 2004, 2005, 2006, 2007 Olof Naessén and Per Larsson * * Js_./ * Per Larsson a.k.a finalman _RqZ{a<^_aa * Olof Naessén a.k.a jansem/yakslem _asww7!uY`> )\a// * _Qhm`] _f "'c 1!5m * Visit: http://guichan.darkbits.org )Qk

ws?a-?' ._/L #' * binary forms, with or without )4d[#7r, . ' )d`)[ * modification, are permitted provided _Q-5'5W..j/?' -?!\)cam' * that the following conditions are met: j<. a J@\ * this list of conditions and the j(]1u #include "guisan/platform.hpp" namespace gcn { class Graphics; /** * Holder of a font. Fonts should inherit from this class and * implements it's functions. * * @see ImageFont */ class GCN_CORE_DECLSPEC Font { public: /** * Destructor. */ virtual ~Font() = default; /** * Gets the width of a string. The width of a string is not necesserily * the sum of all the widths of it's glyphs. * * @param text the string to return the width of. * @return the width of a string. */ [[nodiscard]] virtual int getWidth(const std::string& text) const = 0; /** * Gets the height of the glyphs in the font. * * @return the height of the glyphs int the font. */ [[nodiscard]] virtual int getHeight() const = 0; /** * Gets a string index in a string providing an x coordinate. * Used to retrive a string index (for a character in a * string) at a certain x position. It is especially useful * when a mouse clicks in a TextField and you want to know which * character was clicked. * * @return a string index in a string providing an x coordinate. */ virtual int getStringIndexAt(const std::string& text, int x); /** * Draws a string. * * NOTE: You normally won't use this function to draw text since * Graphics contains better functions for drawing text. * * @param graphics a Graphics object to use for drawing. * @param text the string to draw. * @param x the x coordinate where to draw the string. * @param y the y coordinate where to draw the string. */ virtual void drawString(Graphics* graphics, const std::string& text, int x, int y) = 0; }; } #endif // end GCN_FONT_HPP