C

QSafeFont Class

class SafeRenderer::QSafeFont

QSafeFont class reads the QPF2 font file. More...

Header: #include <QSafeFont>
Since: QtSafeRenderer 1.1
Inherited By:

SafeRenderer::QSafeFontLoader

This class was introduced in QtSafeRenderer 1.1.

Public Types

enum BlockTag { CMapBlock, GMapBlock, GlyphBlock }
enum FontHeaderOffset { HeaderMagicQ, HeaderMagicP, HeaderMagicF, HeaderMagic2, HeaderLock, …, HeaderDataSize }
enum FontReaderException { UnsupportedCmapFormat, InvalidFontHeader, InvalidGlyphMap, GlyphNotFound, InvalidCmapTable, …, DataSizeMismatch }
enum HeaderTag { Tag_FontName, Tag_FileName, Tag_FileIndex, Tag_FontRevision, Tag_FreeText, …, Tag_NumTags }
enum TagType { StringType, FixedType, UInt8Type, UInt32Type, BitFieldType }
enum anonymous { CurrentMajorVersion, CurrentMinorVersion }

Public Functions

SafeRenderer::quint32 averageCharWidth() const
SafeRenderer::quint32 descent() const
const SafeRenderer::Glyph *glyphForCharacter(const SafeRenderer::quint32 chrArg) const
SafeRenderer::quint32 pixelSize() const

Protected Functions

QSafeFont()
void load(const SafeRenderer::quchar *const fontData, const SafeRenderer::quint32 dataSize)

Detailed Description

The QSafeFont class reads the QPF2 font file.

Member Type Documentation

enum QSafeFont::BlockTag

ConstantValue
SafeRenderer::QSafeFont::CMapBlock0
SafeRenderer::QSafeFont::GMapBlock1
SafeRenderer::QSafeFont::GlyphBlock2

enum QSafeFont::FontHeaderOffset

ConstantValue
SafeRenderer::QSafeFont::HeaderMagicQ0U
SafeRenderer::QSafeFont::HeaderMagicP1U
SafeRenderer::QSafeFont::HeaderMagicF2U
SafeRenderer::QSafeFont::HeaderMagic23U
SafeRenderer::QSafeFont::HeaderLock4U
SafeRenderer::QSafeFont::HeaderMajorVersion8U
SafeRenderer::QSafeFont::HeaderMinorVersion9U
SafeRenderer::QSafeFont::HeaderDataSize10U

enum QSafeFont::FontReaderException

This enum describes the exception values in the QSafeFont class.

ConstantValueDescription
SafeRenderer::QSafeFont::UnsupportedCmapFormat0Cmap format in the font file is not supported.
SafeRenderer::QSafeFont::InvalidFontHeader1Header in font file is invalid.
SafeRenderer::QSafeFont::InvalidGlyphMap2Glyph map in the font file is invalid.
SafeRenderer::QSafeFont::GlyphNotFound3Glyph not found for the requested character.
SafeRenderer::QSafeFont::InvalidCmapTable4Cmap table in the font file is invalid.
SafeRenderer::QSafeFont::GlyphMapNotFound5Glyph map is missing in the font file.
SafeRenderer::QSafeFont::DataSizeMismatch6Data index is out of boundary.

enum QSafeFont::HeaderTag

ConstantValue
SafeRenderer::QSafeFont::Tag_FontName0
SafeRenderer::QSafeFont::Tag_FileName1
SafeRenderer::QSafeFont::Tag_FileIndex2
SafeRenderer::QSafeFont::Tag_FontRevision3
SafeRenderer::QSafeFont::Tag_FreeText4
SafeRenderer::QSafeFont::Tag_Ascent5
SafeRenderer::QSafeFont::Tag_Descent6
SafeRenderer::QSafeFont::Tag_Leading7
SafeRenderer::QSafeFont::Tag_XHeight8
SafeRenderer::QSafeFont::Tag_AverageCharWidth9
SafeRenderer::QSafeFont::Tag_MaxCharWidth10
SafeRenderer::QSafeFont::Tag_LineThickness11
SafeRenderer::QSafeFont::Tag_MinLeftBearing12
SafeRenderer::QSafeFont::Tag_MinRightBearing13
SafeRenderer::QSafeFont::Tag_UnderlinePosition14
SafeRenderer::QSafeFont::Tag_GlyphFormat15
SafeRenderer::QSafeFont::Tag_PixelSize16
SafeRenderer::QSafeFont::Tag_Weight17
SafeRenderer::QSafeFont::Tag_Style18
SafeRenderer::QSafeFont::Tag_EndOfHeader19
SafeRenderer::QSafeFont::Tag_WritingSystems20
SafeRenderer::QSafeFont::Tag_NumTags21

enum QSafeFont::TagType

ConstantValue
SafeRenderer::QSafeFont::StringType0
SafeRenderer::QSafeFont::FixedType1
SafeRenderer::QSafeFont::UInt8Type2
SafeRenderer::QSafeFont::UInt32Type3
SafeRenderer::QSafeFont::BitFieldType4

enum QSafeFont::anonymous

ConstantValue
SafeRenderer::QSafeFont::CurrentMajorVersion2
SafeRenderer::QSafeFont::CurrentMinorVersion0

Member Function Documentation

[protected] QSafeFont::QSafeFont()

Constructs a QSafeFont object.

SafeRenderer::quint32 QSafeFont::averageCharWidth() const

Returns the average character width in font.

SafeRenderer::quint32 QSafeFont::descent() const

Returns the descent size in pixels.

const SafeRenderer::Glyph *QSafeFont::glyphForCharacter(const SafeRenderer::quint32 chrArg) const

Returns a pointer to the Glyph object which contains the alpha map for the requested characher chrArg character, for example 'c'.

Throws QSafeFont::FontReaderException::GlyphNotFound if the glyph was not found.

[protected] void QSafeFont::load(const SafeRenderer::quchar *const fontData, const SafeRenderer::quint32 dataSize)

Loads, validates, and parses the fontData with size dataSize.

In case of a invalid font data, one of the following exceptions are thrown:

ConstantValue
SafeRenderer::QSafeFont::FontReaderException::UnsupportedCmapFormat
SafeRenderer::QSafeFont::FontReaderException::InvalidFontHeader
SafeRenderer::QSafeFont::FontReaderException::InvalidGlyphMap
SafeRenderer::QSafeFont::FontReaderException::InvalidCmapTable
SafeRenderer::QSafeFont::FontReaderException::DataSizeMismatch

SafeRenderer::quint32 QSafeFont::pixelSize() const

Returns the pixel size.

Available under certain Qt licenses.
Find out more.