steering-wheel/Middlewares/ST/touchgfx/framework/tools/textconvert/Templates/GeneratedFont.cpp.temp

60 lines
2.1 KiB
Plaintext
Raw Normal View History

2023-03-06 21:21:00 +01:00
/* DO NOT EDIT THIS FILE */
/* This file is autogenerated by the text-database code generator */
#include <fonts/GeneratedFont.hpp>
namespace touchgfx
{
GeneratedFont::GeneratedFont(const GlyphNode* glyphs, uint16_t numGlyphs, uint16_t height, uint16_t baseline, uint8_t pixAboveTop, uint8_t pixBelowBottom, uint8_t bitsPerPixel, uint8_t byteAlignRow, uint8_t maxLeft, uint8_t maxRight, const uint8_t* const* glyphDataInternalFlash, const KerningNode* kerningList, const Unicode::UnicodeChar fallbackChar, const Unicode::UnicodeChar ellipsisChar, const uint16_t* const gsubData, const FontContextualFormsTable* formsTable)
: ConstFont(glyphs, numGlyphs, height, baseline, pixAboveTop, pixBelowBottom, bitsPerPixel, byteAlignRow, maxLeft, maxRight, fallbackChar, ellipsisChar),
glyphData(glyphDataInternalFlash),
kerningData(kerningList),
gsubTable(gsubData),
arabicTable(formsTable)
{
}
const uint8_t* GeneratedFont::getPixelData(const GlyphNode* glyph) const
{
const uint8_t* const* table = (const uint8_t* const*)glyphData;
return &(table[glyph->unicode / 2048][glyph->dataOffset]);
}
int8_t GeneratedFont::getKerning(Unicode::UnicodeChar prevChar, const GlyphNode* glyph) const
{
if (!glyph || glyph->kerningTableSize == 0)
{
return 0;
}
const KerningNode* kerndata = kerningData + glyph->kerningTablePos();
for (uint16_t i = glyph->kerningTableSize; i > 0; i--, kerndata++)
{
if (prevChar == kerndata->unicodePrevChar)
{
return kerndata->distance;
}
if (prevChar < kerndata->unicodePrevChar)
{
break;
}
}
return 0;
}
2023-07-24 18:54:12 +02:00
const GlyphNode* FusedFont::getGlyph(Unicode::UnicodeChar unicode, const uint8_t*& pixelData, uint8_t& bitsPerPixel) const
{
if (unicode < 0xAC00 || unicode > 0xD7A3)
{
return GeneratedFont::getGlyph(unicode, pixelData, bitsPerPixel);
}
else
{
fusedNode.unicode = unicode;
bitsPerPixel = 1;
pixelData = 0;
return const_cast<const GlyphNode*>(&fusedNode);
}
}
2023-03-06 21:21:00 +01:00
} // namespace touchgfx