class EE::Graphics::Font

Overview

Font interface class. More…

#include <font.hpp>

class Font {
public:
    // typedefs

    typedef std::function<void(Uint32, Event, Font*)> FontEventCallback;

    // enums

    enum Event;

    // structs

    struct Info;

    // construction

    virtual ~Font();

    // methods

    static Uint32 getHorizontalAlign(const Uint32& flags);
    static Uint32 getVerticalAlign(const Uint32& flags);
    static bool isEmojiCodePoint(const Uint32& codePoint);
    static bool containsEmojiCodePoint(const String& string);
    static std::vector<std::size_t> emojiCodePointsPositions(const String& string);
    virtual Uint32 getFontHeight(const Uint32& characterSize) const = 0;
    const FontType& getType() const;
    const std::string& getName() const;
    void setName(const std::string& setName);
    const String::HashType& getId();
    virtual bool isMonospace() const = 0;
    virtual bool isScalable() const = 0;
    virtual const Info& getInfo() const = 0;
    virtual const Glyph& getGlyph(Uint32 codePoint, unsigned int characterSize, bool bold, bool italic, Float outlineThickness = 0, Float maxWidth = 0) const = 0;
    virtual GlyphDrawable* getGlyphDrawable(Uint32 codePoint, unsigned int characterSize, bool bold = false, bool italic = false, Float outlineThickness = 0, const Float& forzeSize = 0) const = 0;
    virtual Float getKerning(Uint32 first, Uint32 second, unsigned int characterSize, bool bold, bool italic, Float outlineThickness = 0) const = 0;
    virtual Float getLineSpacing(unsigned int characterSize) const = 0;
    virtual Float getUnderlinePosition(unsigned int characterSize) const = 0;
    virtual Float getUnderlineThickness(unsigned int characterSize) const = 0;
    virtual Texture* getTexture(unsigned int characterSize) const = 0;
    virtual Uint32 getFontStyle() const;
    virtual bool isRegular() const;
    virtual bool isBold() const;
    virtual bool isItalic() const;
    virtual bool isBoldItalic() const;
    virtual bool hasBold() const;
    virtual bool hasItalic() const;
    virtual bool hasBoldItalic() const;
    virtual bool loaded() const = 0;
    Uint32 pushFontEventCallback(const FontEventCallback& cb);
    void popFontEventCallback(const Uint32& callbackId);
};

Detailed Documentation

Font interface class.

Methods

virtual Uint32 getFontHeight(const Uint32& characterSize) const = 0

Returns:

The current font height

const FontType& getType() const

Returns:

The type of the instance of the font

const std::string& getName() const

Returns:

The font name

void setName(const std::string& setName)

Change the font name ( and id, because it’s the font name hash )

const String::HashType& getId()

Returns:

The font id

virtual GlyphDrawable* getGlyphDrawable(Uint32 codePoint, unsigned int characterSize, bool bold = false, bool italic = false, Float outlineThickness = 0, const Float& forzeSize = 0) const = 0

Returns:

The glyph drawable that represents the glyph in a texture. The glyph drawable allocation is managed by the font.

Uint32 pushFontEventCallback(const FontEventCallback& cb)

Push a new on resource change callback.

Returns:

The Callback Id

void popFontEventCallback(const Uint32& callbackId)

Pop the on resource change callback id indicated.