Sha256: 06b21e22ffab66b854e0f953bb88443ad484c4a4f3c15b1987e09f97e1249c8c

Contents?: true

Size: 1.93 KB

Versions: 3

Compression:

Stored size: 1.93 KB

Contents

//! \file Text.hpp
//! Functions to output text on bitmaps.

#ifndef GOSU_TEXT_HPP
#define GOSU_TEXT_HPP

#include <Gosu/Fwd.hpp>
#include <Gosu/GraphicsBase.hpp>
#include <string>

namespace Gosu
{
    //! Returns the name of a neutral font that is available on the current
    //! platform.
    std::wstring defaultFontName();

    //! Returns the width a text would span on a bitmap if it were drawn
    //! using drawText with the same arguments.
    //! \param fontName Name of a system font, or a filename to a TTF file (must contain '/').
    unsigned textWidth(const std::wstring& text,
        const std::wstring& fontName, unsigned fontHeight,
        unsigned fontFlags = 0);

    //! Draws a line of text on a bitmap.
    //! \param fontName Name of a system font, or a filename to a TTF file (must contain '/').
    //! \param fontHeight Height, in pixels, of the text.
    //! \param fontFlags Binary combination of members of the FontFlags
    //! enum.
    void drawText(Bitmap& bitmap, const std::wstring& text, int x, int y,
        Color c, const std::wstring& fontName, unsigned fontHeight,
        unsigned fontFlags = 0);

    //! Creates a bitmap that is filled with the text given to the function.
    //! The text may contain line breaks.
    //! \param fontName Name of a system font, or a filename to a TTF file (must contain '/').
    //! \param fontHeight Height of the font in pixels.
    //! \param lineSpacing Spacing between two lines of text in pixels.
    //! \param maxWidth Maximal width of the bitmap that will be returned. Text
    //! will be split into multiple lines to avoid drawing over the right
    //! border. When a single word is too long, it will be truncated.
    Bitmap createText(const std::wstring& text,
        const std::wstring& fontName, unsigned fontHeight, 
        unsigned lineSpacing, unsigned maxWidth, TextAlign align,
        unsigned fontFlags = 0);
}

#endif

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
gosu-0.7.10.1 Gosu/Text.hpp
gosu-0.7.10.2 Gosu/Text.hpp
gosu-0.7.10.3 Gosu/Text.hpp