class EE::Graphics::FontTrueType

Overview

#include <fonttruetype.hpp>

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

    struct Page;
    struct Row;

    // construction

    ~FontTrueType();

    // methods

    static FontTrueType* New(const std::string& FontName);
    static FontTrueType* New(const std::string& FontName, const std::string& filename);
    bool loadFromFile(const std::string& filename);
    bool loadFromMemory(const void* data, std::size_t sizeInBytes, bool copyData = true);
    bool loadFromStream(IOStream& stream);
    bool loadFromPack(Pack* pack, std::string filePackPath);
    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;
    const Glyph& getGlyphByIndex(Uint32 index, unsigned int characterSize, bool bold, bool italic, Float outlineThickness = 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;
    FontTrueType& operator=(const FontTrueType& right);
    bool getBoldAdvanceSameAsRegular() const;
    void setBoldAdvanceSameAsRegular(bool boldAdvanceSameAsRegular);
    bool isColorEmojiFont() const;
    virtual bool isMonospace() const;
    virtual bool isScalable() const;
    bool isEmojiFont() const;
    bool hasGlyph(Uint32 codePoint) const;
    void setIsColorEmojiFont(bool isColorEmojiFont);
    void setIsEmojiFont(bool isEmojiFont);
    void setForceIsMonospace(bool isMonospace);
    bool isEmojiFallbackEnabled() const;
    void setEnableEmojiFallback(bool enableEmojiFallback);
    const Uint32& getFontInternalId() const;
    bool isFallbackFontEnabled() const;
    void setEnableFallbackFont(bool enableFallbackFont);
    bool getEnableDynamicMonospace() const;
    void setEnableDynamicMonospace(bool enableDynamicMonospace);
    FontHinting getHinting() const;
    void setHinting(FontHinting hinting);
    FontAntialiasing getAntialiasing() const;
    void setAntialiasing(FontAntialiasing antialiasing);
    virtual bool isBold() const;
    virtual bool isItalic() const;
    virtual bool isBoldItalic() const;
    virtual bool hasBold() const;
    virtual bool hasItalic() const;
    virtual bool hasBoldItalic() const;
    FontTrueType* getBoldFont() const;
    FontTrueType* getItalicFont() const;
    FontTrueType* getBoldItalicFont() const;
    void setBoldFont(FontTrueType* fontBold);
    void setItalicFont(FontTrueType* fontItalic);
    void setBoldItalicFont(FontTrueType* fontBoldItalic);
};

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 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

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

void setBoldAdvanceSameAsRegular(bool boldAdvanceSameAsRegular)

You can enable this to not add more space in the advance properties for bold fonts, so they advance like a regular glyph (useful for monospaced fonts).