class Core::Portable::BitmapFont

Overview

#include <corefont.h>

class BitmapFont
{
public:
    // structs

    struct CharDescriptor;
    struct CharMap;
    struct ColorEntry;
    struct InplaceMap;
    struct KerningPair;
    struct LoadedMap;
    struct RenderScope;

    // fields

    static const Color kInvertColor;
     fontNumber;

    // construction

    BitmapFont(CStringPtr name, Bitmap* bitmap, bool ownBitmap = true);

    // methods

    PROPERTY_CSTRING_BUFFER(32, name, Name);
    FontNumber bool loadDescriptor(IO::Stream& stream);
    bool loadInplace(const uint8* fontFileData, uint32 fontFileLength);
    int getLineHeight() const;
    int getStringWidth(CStringPtr string, int length) const;

    void render(
        Graphics& graphics,
        Point pos,
        CStringPtr string,
        int length,
        ColorRef color
    ) const;
};

// direct descendants

class BitmapInplaceFont;

Detailed Documentation

Fields

static const Color kInvertColor

special color to invert monochrome fonts (inconsistent, but so be it)

Methods

FontNumber bool loadDescriptor(IO::Stream& stream)

< optional, for external use

load descriptor from .fnt file

bool loadInplace(const uint8* fontFileData, uint32 fontFileLength)

load inplace, doesn’t copy or allocate memory