class EE::Graphics::FontSprite

Overview

Implementation of XNA Font Sprites. More…

#include <fontsprite.hpp>

class FontSprite: public EE::Graphics::Font {
public:
    // structs

    struct Page;

    // construction

    ~FontSprite();

    // methods

    static FontSprite* New(const std::string fontName);
    static FontSprite* New(const std::string fontName, const std::string& filename);
    bool loadFromFile(const std::string& filename, Color key = Color::Fuchsia, Uint32 firstChar = 32, int spacing = 0);
    bool loadFromMemory(const void* data, std::size_t sizeInBytes, Color key = Color::Fuchsia, Uint32 firstChar = 32, int spacing = 0);
    bool loadFromStream(IOStream& stream, Color key = Color::Fuchsia, Uint32 firstChar = 32, int spacing = 0);
    bool loadFromPack(Pack* pack, std::string filePackPath, Color key = Color::Fuchsia, Uint32 firstChar = 32, int spacing = 0);
    virtual bool isMonospace() const;
    virtual bool isScalable() const;
    virtual const Font::Info& getInfo() const;
    virtual const Glyph& getGlyph(Uint32 codePoint, unsigned int characterSize, bool bold, bool italic, Float outlineThickness = 0, Float maxWidth = 0) const;
    virtual GlyphDrawable* getGlyphDrawable(Uint32 codePoint, unsigned int characterSize, bool bold = false, bool italic = false, Float outlineThickness = 0, const Float& forzeSize = 0) const;
    virtual Float getKerning(Uint32 first, Uint32 second, unsigned int characterSize, bool bold, bool italic, Float outlineThickness = 0) const;
    virtual Float getLineSpacing(unsigned int characterSize) const;
    virtual Uint32 getFontHeight(const Uint32& characterSize) const;
    virtual Float getUnderlinePosition(unsigned int characterSize) const;
    virtual Float getUnderlineThickness(unsigned int characterSize) const;
    virtual Texture* getTexture(unsigned int characterSize) const;
    virtual bool loaded() const;
    FontSprite& operator=(const FontSprite& right);
};

Inherited Members

public:
    // typedefs

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

    // enums

    enum Event;

    // structs

    struct Info;

    // 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 getAscent(unsigned int characterSize) const;
    virtual Float getDescent(unsigned int) const;
    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

Implementation of XNA Font Sprites.

Methods

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

Returns:

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

virtual Uint32 getFontHeight(const Uint32& characterSize) const

Returns:

The current font height