1
0

add screen library

This commit is contained in:
2024-01-13 19:15:18 +01:00
parent 7b660f0fe2
commit 65ff5de90f
533 changed files with 113575 additions and 2 deletions

View File

@ -0,0 +1,68 @@
32
45
46
47
48
49
50
51
52
53
54
55
56
57
58
63
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122

View File

@ -0,0 +1,3 @@
43
45
63

View File

@ -0,0 +1 @@
{"typographies":[["Default","verdana.ttf",20,4],["Large","verdana.ttf",40,4],["Small","verdana.ttf",10,4]],"generate_font_format":"0"}

View File

@ -0,0 +1 @@
{"typographies":[["Default","verdana.ttf",20,4],["Large","verdana.ttf",40,4],["Small","verdana.ttf",10,4]],"generate_font_format":"0"}

View File

@ -0,0 +1,70 @@
BA
F0
32
45
46
47
48
49
50
51
52
53
54
55
56
57
58
63
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122

View File

@ -0,0 +1,3 @@
BA
F0
63

View File

@ -0,0 +1,5 @@
BA
F0
43
45
63

View File

@ -0,0 +1,38 @@
/* DO NOT EDIT THIS FILE */
/* This file is autogenerated by the text-database code generator */
#ifndef APPLICATIONFONTPROVIDER_HPP
#define APPLICATIONFONTPROVIDER_HPP
#include <touchgfx/FontManager.hpp>
namespace touchgfx
{
class FlashDataReader;
}
struct Typography
{
static const touchgfx::FontId DEFAULT = 0;
static const touchgfx::FontId LARGE = 1;
static const touchgfx::FontId SMALL = 2;
};
struct TypographyFontIndex
{
static const touchgfx::FontId DEFAULT = 0; // verdana_20_4bpp
static const touchgfx::FontId LARGE = 1; // verdana_40_4bpp
static const touchgfx::FontId SMALL = 2; // verdana_10_4bpp
static const uint16_t NUMBER_OF_FONTS = 3;
};
class ApplicationFontProvider : public touchgfx::FontProvider
{
public:
virtual touchgfx::Font* getFont(touchgfx::FontId typography);
static void setFlashReader(touchgfx::FlashDataReader* /* flashReader */) { }
static touchgfx::FlashDataReader* getFlashReader() { return 0; }
};
#endif // APPLICATIONFONTPROVIDER_HPP

View File

@ -0,0 +1,71 @@
/* DO NOT EDIT THIS FILE */
/* This file is autogenerated by the text-database code generator */
#ifndef CACHEDFONT_HPP
#define CACHEDFONT_HPP
#include <fonts/GeneratedFont.hpp>
#include <fonts/FontCache.hpp>
namespace touchgfx
{
class CachedFont : public GeneratedFont
{
public:
CachedFont(const struct touchgfx::BinaryFontData* data, FontId id, FontCache* _cache, const GeneratedFont* _flashFont)
: GeneratedFont(0, //GlyphNode*
data->numberOfGlyphs,
data->height,
data->pixBelowBase,
data->bitsPerPixel,
data->byteAlignRow,
data->maxLeft,
data->maxRight,
0, //glyphDataPointer
0, //Kerning table not used for cached font
data->fallbackChar,
data->ellipsisChar,
0), //gsubTablePointer
fontId(id),
cache(_cache),
flashFont(_flashFont)
{}
CachedFont() : GeneratedFont() {}
using GeneratedFont::getGlyph;
virtual const GlyphNode* getGlyph(Unicode::UnicodeChar unicode, const uint8_t*& pixelData, uint8_t& bitsPerPixel) const;
virtual const uint8_t* getPixelData(const GlyphNode* glyph) const;
virtual int8_t getKerning(Unicode::UnicodeChar prevChar, const GlyphNode* glyph) const;
void setFontCache(FontCache& cache);
FontId getFontId() const
{
return fontId;
}
virtual const uint16_t* getGSUBTable() const
{
if (gsubTable != 0)
{
return gsubTable;
}
return flashFont->getGSUBTable();
}
virtual void setGSUBTable(const uint16_t* table)
{
gsubTable = table;
}
private:
FontId fontId;
FontCache* cache;
const GeneratedFont* flashFont;
};
} // namespace touchgfx
#endif // CACHEDFONT_HPP

View File

@ -0,0 +1,94 @@
/* DO NOT EDIT THIS FILE */
/* This file is autogenerated by the text-database code generator */
#ifndef FONTCACHE_HPP
#define FONTCACHE_HPP
#include <fonts/ApplicationFontProvider.hpp>
#include <touchgfx/Font.hpp>
#include <touchgfx/TypedText.hpp>
namespace touchgfx
{
class CachedFont;
class FontDataReader
{
public:
virtual ~FontDataReader() { }
virtual void open() = 0;
virtual void close() = 0;
virtual void setPosition(uint32_t position) = 0;
virtual void readData(void* out, uint32_t numberOfBytes) = 0;
};
class FontCache
{
public:
FontCache();
void setReader(FontDataReader* reader);
void clear(bool keepGsubTable = false);
void setMemory(uint8_t* memory, uint32_t size);
void initializeCachedFont(TypedText t, CachedFont* font, bool loadGsubTable = false);
bool cacheString(TypedText t, const Unicode::UnicodeChar* string);
bool cacheLigatures(CachedFont* font, TypedText t, const Unicode::UnicodeChar* string);
const GlyphNode* getGlyph(Unicode::UnicodeChar unicode, FontId font) const;
uint32_t getMemoryUsage()
{
return memorySize - (gsubStart - top);
}
void open();
void close();
static inline const uint8_t* getPixelData(const GlyphNode* glyph)
{
return ((const uint8_t*)glyph) + SizeGlyphNode + 4;
}
static inline bool isCached(const GlyphNode* g)
{
return g->dataOffset == 0xFFFFFFFF;
}
private:
static const uint32_t SizeGlyphNode = 16;
bool contains(Unicode::UnicodeChar unicode, FontId font) const;
void insert(Unicode::UnicodeChar unicode, FontId font, uint32_t bpp, bool& outOfMemory);
uint8_t* copyGlyph(uint8_t* top, Unicode::UnicodeChar unicode, FontId font, uint32_t bpp, bool& outOfMemory);
void cacheData(uint32_t bpp, GlyphNode* first);
bool cacheSortedString(TypedText t);
bool createSortedString(const Unicode::UnicodeChar* string);
bool createSortedLigatures(CachedFont* font, TypedText t, const Unicode::UnicodeChar* string, ...);
bool sortSortedString(int n);
void setPosition(uint32_t position);
void readData(void* out, uint32_t numberOfBytes);
struct
{
uint8_t* first; //first glyphnode, glyph in cache;
uint8_t* last; //first glyphnode, glyph in cache;
} fontTable[MAX(TypographyFontIndex::NUMBER_OF_FONTS, 1)];
uint32_t memorySize;
uint8_t* memory; //start of memory
uint8_t* top; //first unused byte
uint8_t* gsubStart; //first address of GSUB tables, allocated in the end of the cache
FontDataReader* reader;
Unicode::UnicodeChar* sortedString;
//Must be bigger than BinaryFontData
static const uint32_t MAX_BUFFER_SIZE = 64;
char buffer[MAX_BUFFER_SIZE];
uint32_t glyphDataOffset;
uint16_t numGlyphs;
uint16_t currentFileGlyphNumber;
GlyphNode currentFileGlyphNode;
};
} // namespace touchgfx
#endif // FONTCACHE_HPP

View File

@ -0,0 +1,133 @@
/* DO NOT EDIT THIS FILE */
/* This file is autogenerated by the text-database code generator */
#ifndef GENERATEDFONT_HPP
#define GENERATEDFONT_HPP
#include <touchgfx/ConstFont.hpp>
namespace touchgfx
{
/**
* An GeneratedFont has both glyph table and glyph data placed in a flash which
* supports random access read (i.e. not a NAND flash)
*
* @see ConstFont
*/
class GeneratedFont : public ConstFont
{
public:
/**
* Construct the GeneratedFont.
*
* @param list The array of glyphs known to this font.
* @param size The number of glyphs in list.
* @param height The height in pixels of the highest character in this font.
* @param pixBelowBase The maximum number of pixels that can be drawn below the
* baseline in this font.
* @param bitsPerPixel The number of bits per pixel in this font.
* @param byteAlignRow Are glyphs encoded using A4 format
* @param maxLeft The maximum a character extends to the left.
* @param maxRight The maximum a character extends to the right.
* @param glyphDataInternalFlash Pointer to the glyph data for the font, placed in internal
* flash.
* @param kerningList pointer to the kerning data for the font, placed in internal
* flash.
* @param fallbackChar The fallback character for the typography in case no glyph is
* available.
* @param ellipsisChar The ellipsis character used for truncating long texts.
* @param gsubTable Pointer to GSUB table.
*/
GeneratedFont(const GlyphNode* list, uint16_t size, uint16_t height, uint8_t pixBelowBase, 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);
using ConstFont::getGlyph;
/**
* Obtains a RAM-based pointer to the pixel data for the specified glyph.
*
* @param glyph The glyph to get the pixels data of.
*
* @return The pixel data of the glyph.
*/
virtual const uint8_t* getPixelData(const GlyphNode* glyph) const;
/**
* Gets the kerning distance between two characters.
*
* @param prevChar The unicode value of the previous character.
* @param glyph the glyph object for the current character.
*
* @return The kerning distance between prevChar and glyph char.
*/
virtual int8_t getKerning(Unicode::UnicodeChar prevChar, const GlyphNode* glyph) const;
/**
* Gets GSUB table.
*
* @return The GSUB table or null if font has GSUB no table
*/
virtual const uint16_t* getGSUBTable() const
{
return gsubTable;
}
protected:
GeneratedFont() : ConstFont(0, 0, 0, 0, 0, 0, 0, 0, 0, 0), glyphData(0), kerningData(0), gsubTable(0) { }
const void* glyphData; ///< Information describing the glyphs
const KerningNode* kerningData; ///< Information describing the kerning
const uint16_t* gsubTable; ///< Information describing the GSUB tables
};
struct BinaryFontData
{
uint32_t fontIndex; // The font index (as used by TypedTextDatabase)
uint32_t sizeOfFontData; // Size of the complete BinaryFont
uint32_t offsetToTable; // GlyphNode[]
uint32_t offsetToKerning; // KerningNode[]
uint32_t offsetToGlyphs; // uint8_t[]
uint32_t offsetToGSUB; // uint16_t[]
uint16_t numberOfGlyphs; // Number of glyphs in Table and Glyphs
uint16_t height; // Font height from base
uint8_t pixBelowBase; // Max pixels below base
uint8_t bitsPerPixel: 7; // Bpp
uint8_t byteAlignRow: 1; // A4/A2/A1
uint8_t maxLeft; // The maximum a character extends to the left
uint8_t maxRight; // The maximum a character extends to the right
Unicode::UnicodeChar fallbackChar; // Fallback Character for the font
Unicode::UnicodeChar ellipsisChar; // Ellipsis Character for the font
};
class BinaryFont : public GeneratedFont
{
public:
BinaryFont(const struct touchgfx::BinaryFontData* data)
: GeneratedFont((const GlyphNode*)((const uint8_t*)data + data->offsetToTable),
data->numberOfGlyphs,
data->height,
data->pixBelowBase,
data->bitsPerPixel,
data->byteAlignRow,
data->maxLeft,
data->maxRight,
0,
(const KerningNode*)((const uint8_t*)data + data->offsetToKerning),
data->fallbackChar,
data->ellipsisChar,
(data->offsetToGSUB == 0) ? 0 : (const uint16_t*)((const uint8_t*)data + data->offsetToGSUB)),
glyphData((const uint8_t*)data + data->offsetToGlyphs)
{
}
BinaryFont() : GeneratedFont() {}
virtual const uint8_t* getPixelData(const GlyphNode* glyph) const
{
const uint8_t* data = (const uint8_t*)glyphData;
return &(data[glyph->dataOffset]);
}
protected:
const uint8_t* glyphData;
};
} // namespace touchgfx
#endif // GENERATEDFONT_HPP

View File

@ -0,0 +1,109 @@
/* DO NOT EDIT THIS FILE */
/* This file is autogenerated by the text-database code generator */
#ifndef UNMAPPEDDATAFONT_HPP
#define UNMAPPEDDATAFONT_HPP
#include <touchgfx/Font.hpp>
namespace touchgfx
{
/**
* An UnmappedDataFont has both glyph table and glyph data placed in a
* flash which does not support random access read (indirect
* access). A unicode table is located in a flash with random read
* access (direct access).
*
* @see Font, ConstFont
*/
class UnmappedDataFont : public Font
{
public:
/**
* Construct the UnmappedDataFont.
*
* @param list The array of glyphs known to this font (indirect).
* @param unicodes The array of unicodes known to this font (direct).
* @param size The number of glyphs in list.
* @param height The height in pixels of the highest character in this font.
* @param pixBelowBase The maximum number of pixels that can be drawn below the
* baseline in this font.
* @param bitsPerPixel The number of bits per pixel in this font.
* @param byteAlignRow Are glyphs encoded using A4 format
* @param maxLeft The maximum a character extends to the left.
* @param maxRight The maximum a character extends to the right.
* @param glyphDataList Pointer to pointers the glyph data for the font (indirect).
* @param kerningList pointer to the kerning data for the font (direct).
* @param fallbackChar The fallback character for the typography in case no glyph is
* available.
* @param ellipsisChar The ellipsis character used for truncating long texts.
* @param gsubTable Pointer to GSUB table (direct).
*/
UnmappedDataFont(const GlyphNode* list, const uint16_t* unicodes, uint16_t size, uint16_t height, uint8_t pixBelowBase, uint8_t bitsPerPixel, uint8_t byteAlignRow, uint8_t maxLeft, uint8_t maxRight, const uint8_t* const* glyphDataList, const KerningNode* kerningList, const Unicode::UnicodeChar fallbackChar, const Unicode::UnicodeChar ellipsisChar, const uint16_t* const gsubData);
using Font::getGlyph;
/**
* Gets the glyph data associated with the specified Unicode. The
GlyphNode is allocated in the buffer passed to the constructor.
*
* Please note that in case of Thai letters and Arabic letters
* where diacritics can be placed relative to the previous
* character(s), please use TextProvider::getNextLigature()
* instead as it will create a temporary GlyphNode that will be
* adjusted with respect to X/Y position.
*
* @param unicode The character to look up.
* @param pixelData Pointer to the pixel data for the glyph if the glyph is
* found. This is set by this method.
* @param [out] bitsPerPixel Reference where to place the number of bits per pixel.
*
* @return A pointer to the glyph node or null if the glyph was not found.
*/
virtual const GlyphNode* getGlyph(Unicode::UnicodeChar unicode, const uint8_t*& pixelData, uint8_t& bitsPerPixel) const;
/**
* Obtains the address to the pixel data for the specified glyph.
*
* @param glyph The glyph to get the pixels data of.
*
* @return The address of the pixel data of the glyph.
*/
virtual const uint8_t* getPixelData(const GlyphNode* glyph) const;
/**
* Gets the kerning distance between two characters.
*
* @param prevChar The unicode value of the previous character.
* @param glyph the glyph object for the current character.
*
* @return The kerning distance between prevChar and glyph char.
*/
virtual int8_t getKerning(Unicode::UnicodeChar prevChar, const GlyphNode* glyph) const;
/**
* Gets GSUB table.
*
* @return The GSUB table or null if font has GSUB no table
*/
virtual const uint16_t* getGSUBTable() const
{
return gsubTable;
}
protected:
UnmappedDataFont() : Font(0, 0, 0, 0, 0, 0, 0, 0), glyphList(0), unicodes(0), glyphDataList(0), kerningData(0), gsubTable(0) { }
int lookupUnicode(uint16_t unicode) const;
const GlyphNode* glyphList; ///< The list of glyphs
uint16_t listSize; ///< The size of the list of glyphs
const uint16_t* unicodes; ///< LookupTable with all unicodes in this font
const void* glyphDataList; ///< Information describing the glyphs (list of pointers)
const KerningNode* kerningData; ///< Information describing the kerning
const uint16_t* gsubTable; ///< Information describing the GSUB tables
static GlyphNode glyphNodeBuffer; ///< Buffer for GlyphNodes read from unmapped flash
};
} // namespace touchgfx
#endif // UNMAPPEDDATAFONT_HPP

View File

@ -0,0 +1,24 @@
/* DO NOT EDIT THIS FILE */
/* This file is autogenerated by the text-database code generator */
#include <fonts/ApplicationFontProvider.hpp>
#include <fonts/GeneratedFont.hpp>
#include <texts/TypedTextDatabase.hpp>
touchgfx::Font* ApplicationFontProvider::getFont(touchgfx::FontId typography)
{
switch (typography)
{
case Typography::DEFAULT:
// verdana_20_4bpp
return const_cast<touchgfx::Font*>(TypedTextDatabase::getFonts()[0]);
case Typography::LARGE:
// verdana_40_4bpp
return const_cast<touchgfx::Font*>(TypedTextDatabase::getFonts()[1]);
case Typography::SMALL:
// verdana_10_4bpp
return const_cast<touchgfx::Font*>(TypedTextDatabase::getFonts()[2]);
default:
return 0;
}
}

View File

@ -0,0 +1,58 @@
/* DO NOT EDIT THIS FILE */
/* This file is autogenerated by the text-database code generator */
#include <fonts/CachedFont.hpp>
namespace touchgfx
{
const uint8_t* CachedFont::getPixelData(const GlyphNode* glyph) const
{
//if glyph is cached, then data is present just after the GlyphNode
if (FontCache::isCached(glyph))
{
const uint8_t* data = FontCache::getPixelData(glyph);
return data;
}
else
{
return flashFont->getPixelData(glyph);
}
}
const GlyphNode* CachedFont::getGlyph(Unicode::UnicodeChar unicode, const uint8_t*& pixelData, uint8_t& bitsPerPixel) const
{
//look first in internal flash font
const GlyphNode* n = flashFont->find(unicode);
if ((n == 0) && (cache != 0))
{
//now look in FontCache table
n = cache->getGlyph(unicode, fontId);
}
//revert to normal behaviour if still not found
if (n == 0 && unicode != 0 && unicode != '\n')
{
Unicode::UnicodeChar fallbackChar = flashFont->getFallbackChar();
n = flashFont->find(fallbackChar);
if (n == 0)
{
n = cache->getGlyph(fallbackChar, fontId);
}
}
if (n != 0)
{
pixelData = getPixelData(n);
bitsPerPixel = getBitsPerPixel();
return n;
}
return (const GlyphNode*)0;
}
int8_t CachedFont::getKerning(Unicode::UnicodeChar prevChar, const GlyphNode* glyph) const
{
//Kerning is not supported by Font Caching
return 0;
}
}

View File

@ -0,0 +1,378 @@
/* DO NOT EDIT THIS FILE */
/* This file is autogenerated by the text-database code generator */
#include <fonts/FontCache.hpp>
#include <fonts/CachedFont.hpp>
#include <texts/TypedTextDatabase.hpp>
#include <touchgfx/TextProvider.hpp>
#include <touchgfx/Utils.hpp>
#include <cstring>
namespace touchgfx
{
FontCache::FontCache()
: memorySize(0), memory(0), top(0), gsubStart(0), reader(0)
{
}
void FontCache::clear(bool keepGsubTable /* = false */)
{
memset(fontTable, 0, sizeof(fontTable));
//top is beginning of memory, no glyphs are cached yet
top = memory;
if (!keepGsubTable)
{
//gsubStart points to end of memory (nothing loaded yet)
gsubStart = memory + memorySize;
}
}
void FontCache::setMemory(uint8_t* _memory, uint32_t size)
{
memory = _memory;
memorySize = size;
clear();
}
void FontCache::setReader(FontDataReader* _reader)
{
reader = _reader;
}
const GlyphNode* FontCache::getGlyph(Unicode::UnicodeChar unicode, FontId font) const
{
GlyphNode* g = (GlyphNode*)fontTable[font].first;
while (g)
{
if (g->unicode == unicode)
{
return g;
}
GlyphNode** next = (GlyphNode**)((uint8_t*)g + SizeGlyphNode);
g = *next;
}
return 0;
}
void FontCache::open()
{
if (reader)
{
reader->open();
}
}
void FontCache::close()
{
if (reader)
{
reader->close();
}
}
void FontCache::initializeCachedFont(TypedText t, CachedFont* font, bool loadGsubTable /*= false*/)
{
//get font index from typed text
FontId fontId = t.getFontId();
//reset to start of file
open();
setPosition(0);
assert(sizeof(touchgfx::BinaryFontData) < MAX_BUFFER_SIZE);
readData(buffer, sizeof(touchgfx::BinaryFontData));
const struct touchgfx::BinaryFontData* binaryFontData = reinterpret_cast<const struct touchgfx::BinaryFontData*>(buffer);
const Font** flashFonts = TypedTextDatabase::getFonts();
const GeneratedFont* flashFont = static_cast<const GeneratedFont*>(flashFonts[fontId]);
*font = CachedFont(reinterpret_cast<const struct touchgfx::BinaryFontData*>(buffer), fontId, this, flashFont);
if (loadGsubTable)
{
setPosition(binaryFontData->offsetToGSUB);
const uint32_t sizeOfGSUB = binaryFontData->sizeOfFontData - binaryFontData->offsetToGSUB;
if (top + sizeOfGSUB < gsubStart) //room for this GSUB table
{
uint8_t* const gsubPosition = gsubStart - sizeOfGSUB;
readData(gsubPosition, sizeOfGSUB);
font->setGSUBTable(reinterpret_cast<uint16_t*>(gsubPosition));
gsubStart -= sizeOfGSUB;
}
else
{
font->setGSUBTable(0);
}
}
close();
}
bool FontCache::cacheString(TypedText t, const Unicode::UnicodeChar* string)
{
open();
if (!createSortedString(string))
{
close();
return false;
}
const bool result = cacheSortedString(t);
close();
return result;
}
bool FontCache::cacheLigatures(CachedFont* font, TypedText t, const Unicode::UnicodeChar* string)
{
open();
if (!createSortedLigatures(font, t, string, 0, 0))
{
close();
return false;
}
const bool result = cacheSortedString(t);
close();
return result;
}
bool FontCache::cacheSortedString(TypedText t)
{
setPosition(8); //skip font index and size
uint32_t glyphNodeOffset;
uint32_t dummy;
readData(&glyphNodeOffset, sizeof(uint32_t));
readData(&dummy, sizeof(uint32_t));
readData(&glyphDataOffset, sizeof(uint32_t));
readData(&dummy, sizeof(uint32_t));
readData(&numGlyphs, sizeof(uint16_t));
FontId fontId = t.getFontId(); // Get font index from typed text
uint32_t bpp = t.getFont()->getBitsPerPixel(); // Get BPP from standard font
setPosition(glyphNodeOffset); // Go to glyph nodes for font
currentFileGlyphNumber = 0;
currentFileGlyphNode.unicode = 0; // Force reading of first glyph
const Unicode::UnicodeChar* string = sortedString;
Unicode::UnicodeChar last = 0;
GlyphNode* firstNewGlyph = 0;
bool outOfMemory = false;
while (*string)
{
Unicode::UnicodeChar ch = *string;
if (ch != last)
{
if (!contains(ch, fontId))
{
insert(ch, fontId, bpp, outOfMemory);
if (outOfMemory)
{
break;
}
if (firstNewGlyph == 0)
{
firstNewGlyph = (GlyphNode*)fontTable[fontId].last;
}
}
}
last = ch;
string++;
}
cacheData(bpp, firstNewGlyph);
return !outOfMemory;
}
bool FontCache::contains(Unicode::UnicodeChar unicode, FontId font) const
{
GlyphNode* g = (GlyphNode*)fontTable[font].first;
while (g)
{
if (g->unicode == unicode)
{
return true;
}
GlyphNode** next = (GlyphNode**)((uint8_t*)g + SizeGlyphNode);
g = *next;
}
return false;
}
void FontCache::insert(Unicode::UnicodeChar unicode, FontId font, uint32_t bpp, bool& outOfMemory)
{
//insert new glyphnode and glyph after last for font.
uint8_t* oldTop = top;
top = copyGlyph(top, unicode, font, bpp, outOfMemory);
if (top == oldTop)
{
return;
}
if (fontTable[font].last == 0)
{
//first glyph
fontTable[font].first = oldTop;
fontTable[font].last = oldTop;
}
else
{
//set next pointer of old last glyph
uint8_t** old_next = (uint8_t**)(fontTable[font].last + SizeGlyphNode);
*old_next = oldTop;
//save new glyph as last glyph
fontTable[font].last = oldTop;
}
}
uint8_t* FontCache::copyGlyph(uint8_t* top, Unicode::UnicodeChar unicode, FontId font, uint32_t bpp, bool& outOfMemory)
{
while (currentFileGlyphNumber < numGlyphs && currentFileGlyphNode.unicode < unicode)
{
readData(&currentFileGlyphNode, sizeof(GlyphNode));
currentFileGlyphNumber++;
}
if (currentFileGlyphNode.unicode != unicode)
{
//glyphnode not found
return top;
}
//glyphnode found
uint32_t glyphSize = ((currentFileGlyphNode.width() + 1) & ~1) * currentFileGlyphNode.height() * bpp / 8;
glyphSize = (glyphSize + 3) & ~0x03;
uint32_t requiredMem = SizeGlyphNode + 4 + glyphSize; // GlyphNode + next ptr + glyph
//is space available before sortedString
if (top + requiredMem > (uint8_t*)sortedString)
{
outOfMemory = true;
return top;
}
*(GlyphNode*)top = currentFileGlyphNode;
//clear next pointer
uint8_t** next = (uint8_t**)(top + SizeGlyphNode);
*next = 0;
top += requiredMem;
return top;
}
void FontCache::cacheData(uint32_t bpp, GlyphNode* first)
{
GlyphNode* gn = first;
while (gn)
{
uint8_t* p = (uint8_t*)gn;
if (gn->dataOffset != 0xFFFFFFFF)
{
p += SizeGlyphNode;
//next pointer
p += 4;
//seek and copy
setPosition(glyphDataOffset + gn->dataOffset);
uint32_t glyphSize = ((gn->width() + 1) & ~1) * gn->height() * bpp / 8;
readData(p, glyphSize);
//mark glyphNode as cached
gn->dataOffset = 0xFFFFFFFF;
}
GlyphNode** next = (GlyphNode**)((uint8_t*)gn + SizeGlyphNode);
gn = *next;
}
}
bool FontCache::createSortedString(const Unicode::UnicodeChar* string)
{
int length = Unicode::strlen(string);
//sorted string is allocated at end of buffer
sortedString = (Unicode::UnicodeChar*)(gsubStart - (length + 1) * 2);
if ((uint8_t*)sortedString < top)
{
//unable to allocate string buffer in end of memory
return false;
}
int n = 0;
Unicode::UnicodeChar* uc = sortedString;
while (*string)
{
*uc++ = *string++;
n++;
}
*uc = 0;
return sortSortedString(n);
}
bool FontCache::createSortedLigatures(CachedFont* font, TypedText t, const Unicode::UnicodeChar* string, ...)
{
va_list pArg;
va_start(pArg, string);
TextProvider tp;
tp.initialize(string, pArg, font->getGSUBTable());
va_end(pArg);
Unicode::UnicodeChar ligature;
sortedString = (Unicode::UnicodeChar*)(gsubStart);
if ((uint8_t*)(sortedString - 1) < top)
{
return false;
}
*--sortedString = 0;
int n = 0;
while ((ligature = tp.getNextLigature(t.getTextDirection())) != 0)
{
if ((uint8_t*)(sortedString - 1) < top)
{
return false;
}
*--sortedString = ligature;
n++;
}
return sortSortedString(n);
}
bool FontCache::sortSortedString(int n)
{
Unicode::UnicodeChar* uc = sortedString;
for (int i = 0; i < n - 1; i++)
{
bool swapped = false;
for (int j = 0; j < n - i - 1; j++)
{
if (uc[j] > uc[j + 1])
{
Unicode::UnicodeChar temp = uc[j];
uc[j] = uc[j + 1];
uc[j + 1] = temp;
swapped = true;
}
}
//if no two elements were swapped by inner loop, then break
if (!swapped)
{
break;
}
}
return true;
}
void FontCache::setPosition(uint32_t position)
{
if (reader)
{
reader->setPosition(position);
}
}
void FontCache::readData(void* out, uint32_t numberOfBytes)
{
if (reader)
{
reader->readData(out, numberOfBytes);
}
}
} // namespace touchgfx

View File

@ -0,0 +1,202 @@
#include <touchgfx/hal/Types.hpp>
FONT_GLYPH_LOCATION_FLASH_PRAGMA
KEEP extern const uint8_t unicodes_verdana_10_4bpp_0[] FONT_GLYPH_LOCATION_FLASH_ATTRIBUTE =
{
// Unicode: [0x0020]
// (Has no glyph data)
// Unicode: [0x002D]
0xE4, 0xBE,
// Unicode: [0x002E]
0x36, 0x6C,
// Unicode: [0x002F]
0x00, 0xC0, 0x01, 0x00, 0xA3, 0x00, 0x00, 0x49, 0x00, 0x00, 0x0C, 0x00, 0x50, 0x08, 0x00, 0xA0,
0x03, 0x00, 0xC1, 0x00, 0x00, 0x76, 0x00, 0x00, 0x1B, 0x00, 0x00, 0x06, 0x00, 0x00,
// Unicode: [0x0030]
0x40, 0xDC, 0x08, 0xD0, 0x02, 0x4B, 0xC3, 0x00, 0x86, 0xA5, 0x00, 0xA5, 0xA5, 0x00, 0xA5, 0xB3,
0x00, 0x96, 0xD0, 0x02, 0x5B, 0x40, 0xDD, 0x08,
// Unicode: [0x0031]
0x20, 0x0C, 0x00, 0xD7, 0x0C, 0x00, 0x20, 0x0C, 0x00, 0x20, 0x0C, 0x00, 0x20, 0x0C, 0x00, 0x20,
0x0C, 0x00, 0x20, 0x0C, 0x00, 0xC8, 0xCE, 0x04,
// Unicode: [0x0032]
0xB0, 0xEE, 0x08, 0x50, 0x10, 0x4C, 0x00, 0x00, 0x5A, 0x00, 0x10, 0x2D, 0x00, 0xB0, 0x06, 0x00,
0x7A, 0x00, 0xB1, 0x07, 0x00, 0xF3, 0xDD, 0x9D,
// Unicode: [0x0033]
0xA0, 0xED, 0x1A, 0x50, 0x00, 0x6B, 0x00, 0x10, 0x3B, 0x00, 0xF7, 0x08, 0x00, 0x00, 0x5A, 0x00,
0x00, 0x86, 0x42, 0x10, 0x5B, 0xB2, 0xDE, 0x08,
// Unicode: [0x0034]
0x00, 0x70, 0x0C, 0x00, 0xC4, 0x0C, 0x10, 0x3C, 0x0C, 0xB0, 0x24, 0x0C, 0x77, 0x20, 0x0C, 0xD9,
0xDD, 0xBF, 0x00, 0x20, 0x0C, 0x00, 0x20, 0x0C,
// Unicode: [0x0035]
0xC0, 0xEE, 0x8E, 0xC0, 0x03, 0x00, 0xC0, 0x03, 0x00, 0xC0, 0xDE, 0x09, 0x10, 0x10, 0x7A, 0x00,
0x00, 0x96, 0x41, 0x10, 0x6B, 0xB1, 0xDE, 0x08,
// Unicode: [0x0036]
0x00, 0xD8, 0x1E, 0x90, 0x09, 0x00, 0xD1, 0x00, 0x00, 0xD3, 0xDB, 0x1A, 0xB5, 0x01, 0x98, 0xB4,
0x00, 0xB3, 0xD1, 0x03, 0x87, 0x40, 0xDC, 0x1A,
// Unicode: [0x0037]
0xE3, 0xEE, 0xBE, 0x00, 0x00, 0x96, 0x00, 0x00, 0x2D, 0x00, 0x60, 0x09, 0x00, 0xD0, 0x02, 0x00,
0xA6, 0x00, 0x00, 0x2D, 0x00, 0x50, 0x0A, 0x00,
// Unicode: [0x0038]
0x60, 0xCC, 0x1A, 0xD1, 0x00, 0x78, 0xE2, 0x02, 0x68, 0x70, 0x9E, 0x0A, 0xC1, 0x53, 0x5D, 0x95,
0x00, 0xB5, 0xD3, 0x01, 0x87, 0x70, 0xCC, 0x1A,
// Unicode: [0x0039]
0x60, 0xDD, 0x08, 0xC3, 0x01, 0x4B, 0x96, 0x00, 0x95, 0xD4, 0x01, 0xA6, 0x70, 0xCD, 0x9B, 0x00,
0x00, 0x69, 0x00, 0x40, 0x1D, 0xA0, 0xBE, 0x02,
// Unicode: [0x003A]
0xD5, 0x62, 0x00, 0x00, 0x62, 0xD5,
// Unicode: [0x003F]
0xD2, 0xCE, 0x03, 0x21, 0x50, 0x0C, 0x00, 0x30, 0x0C, 0x00, 0xC1, 0x05, 0x00, 0x4D, 0x00, 0x00,
0x0C, 0x00, 0x00, 0x02, 0x00, 0x00, 0x0F, 0x00,
// Unicode: [0x0041]
0x00, 0xF6, 0x03, 0x00, 0x00, 0xAB, 0x08, 0x00, 0x10, 0x2D, 0x0D, 0x00, 0x60, 0x09, 0x3C, 0x00,
0xB0, 0x04, 0x88, 0x00, 0xF1, 0xDD, 0xDD, 0x00, 0x96, 0x00, 0xD0, 0x03, 0x4B, 0x00, 0x80, 0x08,
// Unicode: [0x0042]
0xDF, 0xDD, 0x04, 0x0E, 0x50, 0x0C, 0x0E, 0x60, 0x09, 0xDF, 0xFD, 0x06, 0x0E, 0x10, 0x4D, 0x0E,
0x00, 0x69, 0x0E, 0x10, 0x3D, 0xDF, 0xDD, 0x06,
// Unicode: [0x0043]
0x10, 0xE9, 0xBE, 0x04, 0xB0, 0x08, 0x40, 0x07, 0xD3, 0x00, 0x00, 0x00, 0x95, 0x00, 0x00, 0x00,
0x96, 0x00, 0x00, 0x00, 0xD3, 0x00, 0x00, 0x00, 0xC0, 0x08, 0x30, 0x06, 0x10, 0xDA, 0xBE, 0x04,
// Unicode: [0x0044]
0xDF, 0xCE, 0x05, 0x00, 0x0E, 0x30, 0x6C, 0x00, 0x0E, 0x00, 0xD3, 0x00, 0x0E, 0x00, 0xE0, 0x01,
0x0E, 0x00, 0xE0, 0x01, 0x0E, 0x00, 0xD3, 0x00, 0x0E, 0x30, 0x5C, 0x00, 0xDF, 0xCE, 0x05, 0x00,
// Unicode: [0x0045]
0xEF, 0xEE, 0x0B, 0x0E, 0x00, 0x00, 0x0E, 0x00, 0x00, 0xEF, 0xEE, 0x0A, 0x0E, 0x00, 0x00, 0x0E,
0x00, 0x00, 0x0E, 0x00, 0x00, 0xEF, 0xEE, 0x0B,
// Unicode: [0x0046]
0xEF, 0xEE, 0x09, 0x0E, 0x00, 0x00, 0x0E, 0x00, 0x00, 0xEF, 0xEE, 0x01, 0x0E, 0x00, 0x00, 0x0E,
0x00, 0x00, 0x0E, 0x00, 0x00, 0x0E, 0x00, 0x00,
// Unicode: [0x0047]
0x10, 0xD9, 0xCE, 0x07, 0xB0, 0x19, 0x20, 0x0A, 0xD3, 0x00, 0x00, 0x00, 0x96, 0x00, 0x00, 0x00,
0xA6, 0x00, 0xEC, 0x1E, 0xD3, 0x00, 0x00, 0x1E, 0xB0, 0x19, 0x10, 0x1E, 0x10, 0xD8, 0xCD, 0x07,
// Unicode: [0x0048]
0x0E, 0x00, 0x86, 0x0E, 0x00, 0x86, 0x0E, 0x00, 0x86, 0xEF, 0xEE, 0x8E, 0x0E, 0x00, 0x86, 0x0E,
0x00, 0x86, 0x0E, 0x00, 0x86, 0x0E, 0x00, 0x86,
// Unicode: [0x0049]
0xD4, 0x7E, 0x60, 0x09, 0x60, 0x09, 0x60, 0x09, 0x60, 0x09, 0x60, 0x09, 0x60, 0x09, 0xD4, 0x7E,
// Unicode: [0x004A]
0xB0, 0xAD, 0x00, 0xA5, 0x00, 0xA5, 0x00, 0xA5, 0x00, 0xA5, 0x00, 0xA5, 0x00, 0x88, 0xEA, 0x1B,
// Unicode: [0x004B]
0x0F, 0x10, 0x4C, 0x0F, 0xB0, 0x06, 0x0F, 0x89, 0x00, 0x7F, 0x0A, 0x00, 0xBF, 0x2D, 0x00, 0x0F,
0xC7, 0x00, 0x0F, 0xA0, 0x09, 0x0F, 0x10, 0x6C,
// Unicode: [0x004C]
0x0E, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x0E,
0x00, 0x00, 0x0E, 0x00, 0x00, 0xEF, 0xEE, 0x08,
// Unicode: [0x004D]
0x8F, 0x00, 0xF2, 0x07, 0xDE, 0x00, 0xC8, 0x07, 0x8D, 0x06, 0x8C, 0x07, 0x2D, 0x6C, 0x87, 0x07,
0x0D, 0xDA, 0x81, 0x07, 0x0D, 0x83, 0x80, 0x07, 0x0D, 0x00, 0x80, 0x07, 0x0D, 0x00, 0x80, 0x07,
// Unicode: [0x004E]
0xBF, 0x00, 0x86, 0xCD, 0x03, 0x86, 0x5D, 0x0A, 0x86, 0x0D, 0x2C, 0x86, 0x0D, 0xA5, 0x86, 0x0D,
0xD0, 0x88, 0x0D, 0x60, 0x8E, 0x0D, 0x00, 0x8D,
// Unicode: [0x004F]
0x10, 0xEA, 0x9E, 0x01, 0xB0, 0x07, 0x90, 0x0A, 0xC3, 0x00, 0x00, 0x1E, 0x96, 0x00, 0x00, 0x4B,
0x96, 0x00, 0x00, 0x4B, 0xC3, 0x00, 0x00, 0x1E, 0xC0, 0x07, 0x90, 0x0A, 0x10, 0xEA, 0x9E, 0x01,
// Unicode: [0x0050]
0xDF, 0xAD, 0x01, 0x0E, 0x90, 0x08, 0x0E, 0x50, 0x0A, 0x0E, 0xA1, 0x07, 0xDF, 0x8D, 0x00, 0x0E,
0x00, 0x00, 0x0E, 0x00, 0x00, 0x0E, 0x00, 0x00,
// Unicode: [0x0051]
0x10, 0xEA, 0x9E, 0x01, 0xB0, 0x07, 0x90, 0x0A, 0xC3, 0x00, 0x00, 0x1E, 0x96, 0x00, 0x00, 0x4B,
0x96, 0x00, 0x00, 0x4B, 0xC3, 0x00, 0x00, 0x1E, 0xC0, 0x07, 0x90, 0x0A, 0x10, 0xEA, 0xAF, 0x01,
0x00, 0x00, 0x88, 0x00, 0x00, 0x00, 0xC2, 0x6E,
// Unicode: [0x0052]
0xDF, 0xBD, 0x01, 0x0E, 0x80, 0x09, 0x0E, 0x50, 0x0B, 0x0E, 0xA0, 0x06, 0xDF, 0x9E, 0x00, 0x0E,
0xD4, 0x01, 0x0E, 0x70, 0x0B, 0x0E, 0x00, 0x9A,
// Unicode: [0x0053]
0x50, 0xED, 0x9D, 0x00, 0xD2, 0x02, 0x71, 0x00, 0xC4, 0x00, 0x00, 0x00, 0xC0, 0x8C, 0x15, 0x00,
0x00, 0x84, 0xDC, 0x00, 0x00, 0x00, 0xC0, 0x03, 0x74, 0x01, 0xD2, 0x01, 0xA2, 0xDE, 0x4C, 0x00,
// Unicode: [0x0054]
0xEE, 0xFE, 0xEE, 0x02, 0x00, 0x86, 0x00, 0x00, 0x00, 0x86, 0x00, 0x00, 0x00, 0x86, 0x00, 0x00,
0x00, 0x86, 0x00, 0x00, 0x00, 0x86, 0x00, 0x00, 0x00, 0x86, 0x00, 0x00, 0x00, 0x86, 0x00, 0x00,
// Unicode: [0x0055]
0xD2, 0x00, 0x80, 0x07, 0xD2, 0x00, 0x80, 0x07, 0xD2, 0x00, 0x80, 0x07, 0xD2, 0x00, 0x80, 0x07,
0xD2, 0x00, 0x80, 0x07, 0xD1, 0x00, 0x90, 0x05, 0xC0, 0x05, 0xD2, 0x02, 0x20, 0xDC, 0x5D, 0x00,
// Unicode: [0x0056]
0x5B, 0x00, 0x70, 0x08, 0xA6, 0x00, 0xC0, 0x03, 0xE1, 0x00, 0xD2, 0x00, 0xB0, 0x04, 0x86, 0x00,
0x60, 0x09, 0x3B, 0x00, 0x10, 0x1E, 0x0D, 0x00, 0x00, 0xAB, 0x08, 0x00, 0x00, 0xF6, 0x03, 0x00,
// Unicode: [0x0057]
0x86, 0x00, 0x8A, 0x00, 0x59, 0xC3, 0x00, 0xCC, 0x00, 0x1D, 0xE0, 0x10, 0xCA, 0x11, 0x0D, 0xB0,
0x54, 0x97, 0x54, 0x09, 0x70, 0x87, 0x53, 0x87, 0x06, 0x30, 0xBB, 0x20, 0xBA, 0x02, 0x00, 0xBD,
0x00, 0xDC, 0x00, 0x00, 0x8B, 0x00, 0xAA, 0x00,
// Unicode: [0x0058]
0xC5, 0x00, 0xC0, 0x03, 0xA0, 0x06, 0x97, 0x00, 0x20, 0x3D, 0x1D, 0x00, 0x00, 0xE7, 0x05, 0x00,
0x00, 0xE7, 0x05, 0x00, 0x20, 0x3D, 0x1D, 0x00, 0xB0, 0x05, 0x98, 0x00, 0xA5, 0x00, 0xD0, 0x03,
// Unicode: [0x0059]
0x6A, 0x00, 0xC3, 0xD2, 0x01, 0x4B, 0x90, 0x57, 0x0A, 0x10, 0xDD, 0x02, 0x00, 0x98, 0x00, 0x00,
0x86, 0x00, 0x00, 0x86, 0x00, 0x00, 0x86, 0x00,
// Unicode: [0x005A]
0xE3, 0xEE, 0xFE, 0x03, 0x00, 0x00, 0xB5, 0x00, 0x00, 0x20, 0x2D, 0x00, 0x00, 0xC0, 0x05, 0x00,
0x00, 0x98, 0x00, 0x00, 0x40, 0x0C, 0x00, 0x00, 0xD1, 0x02, 0x00, 0x00, 0xF6, 0xEE, 0xEE, 0x04,
// Unicode: [0x0061]
0xD0, 0xDD, 0x07, 0x20, 0x10, 0x1D, 0x60, 0xCB, 0x2E, 0xC5, 0x01, 0x2C, 0x86, 0x10, 0x2D, 0xB1,
0xBB, 0x2D,
// Unicode: [0x0062]
0xC1, 0x00, 0x00, 0xC1, 0x00, 0x00, 0xD1, 0xEA, 0x1B, 0xE1, 0x03, 0x7A, 0xC1, 0x00, 0xA4, 0xC1,
0x00, 0x95, 0xD1, 0x00, 0x5A, 0xE1, 0xDC, 0x09,
// Unicode: [0x0063]
0x50, 0xDC, 0x0A, 0xD2, 0x01, 0x04, 0x86, 0x00, 0x00, 0x86, 0x00, 0x00, 0xD3, 0x01, 0x04, 0x60,
0xDD, 0x0A,
// Unicode: [0x0064]
0x00, 0x00, 0x59, 0x00, 0x00, 0x59, 0x60, 0xDD, 0x5D, 0xD2, 0x01, 0x5A, 0x86, 0x00, 0x59, 0x86,
0x00, 0x59, 0xB3, 0x00, 0x5B, 0x80, 0xBC, 0x5C,
// Unicode: [0x0065]
0x50, 0xCC, 0x09, 0xB2, 0x00, 0x49, 0xD6, 0xBB, 0x6C, 0x86, 0x00, 0x00, 0xD2, 0x02, 0x32, 0x50,
0xDC, 0x3C,
// Unicode: [0x0066]
0x70, 0xBD, 0xD0, 0x00, 0xF8, 0x6C, 0xD1, 0x00, 0xD1, 0x00, 0xD1, 0x00, 0xD1, 0x00, 0xD1, 0x00,
// Unicode: [0x0067]
0x50, 0xDD, 0x5D, 0xD2, 0x01, 0x5A, 0x86, 0x00, 0x59, 0x86, 0x00, 0x59, 0xC3, 0x10, 0x5B, 0x80,
0xCE, 0x4C, 0x10, 0x10, 0x2C, 0xC0, 0xDD, 0x06,
// Unicode: [0x0068]
0xC1, 0x00, 0x00, 0xC1, 0x00, 0x00, 0xD1, 0xE9, 0x1B, 0xE1, 0x04, 0x5A, 0xC1, 0x00, 0x77, 0xC1,
0x00, 0x77, 0xC1, 0x00, 0x77, 0xC1, 0x00, 0x77,
// Unicode: [0x0069]
0xD2, 0x00, 0xC1, 0xC1, 0xC1, 0xC1, 0xC1, 0xC1,
// Unicode: [0x006A]
0x00, 0x97, 0x00, 0x00, 0x60, 0x8D, 0x00, 0x86, 0x00, 0x86, 0x00, 0x86, 0x00, 0x86, 0x00, 0x86,
0x00, 0x78, 0xD4, 0x1C,
// Unicode: [0x006B]
0xD1, 0x00, 0x00, 0xD1, 0x00, 0x00, 0xD1, 0x10, 0x4C, 0xD1, 0xB1, 0x05, 0xD1, 0x6A, 0x00, 0xF1,
0xBA, 0x00, 0xD1, 0x90, 0x09, 0xD1, 0x00, 0x7B,
// Unicode: [0x006C]
0xC1, 0xC1, 0xC1, 0xC1, 0xC1, 0xC1, 0xC1, 0xC1,
// Unicode: [0x006D]
0xD1, 0xCA, 0x7B, 0xDB, 0x04, 0xE1, 0x02, 0x8B, 0x30, 0x0B, 0xC1, 0x00, 0x59, 0x10, 0x0D, 0xC1,
0x00, 0x59, 0x10, 0x0D, 0xC1, 0x00, 0x59, 0x10, 0x0D, 0xC1, 0x00, 0x59, 0x10, 0x0D,
// Unicode: [0x006E]
0xD1, 0xCA, 0x1B, 0xE1, 0x02, 0x59, 0xC1, 0x00, 0x77, 0xC1, 0x00, 0x77, 0xC1, 0x00, 0x77, 0xC1,
0x00, 0x77,
// Unicode: [0x006F]
0x60, 0xDD, 0x07, 0xC3, 0x01, 0x3C, 0x86, 0x00, 0x77, 0x86, 0x00, 0x77, 0xC3, 0x01, 0x3C, 0x60,
0xDD, 0x07,
// Unicode: [0x0070]
0xE1, 0xCA, 0x1B, 0xD1, 0x01, 0x78, 0xC1, 0x00, 0xA4, 0xC1, 0x00, 0x95, 0xD1, 0x00, 0x5B, 0xE1,
0xDC, 0x09, 0xC1, 0x00, 0x00, 0xC1, 0x00, 0x00,
// Unicode: [0x0071]
0x60, 0xDD, 0x5D, 0xD2, 0x01, 0x5A, 0x86, 0x00, 0x59, 0x86, 0x00, 0x59, 0xC3, 0x11, 0x5C, 0x80,
0xCE, 0x5B, 0x00, 0x00, 0x59, 0x00, 0x00, 0x59,
// Unicode: [0x0072]
0xD1, 0xE9, 0x04, 0xE1, 0x04, 0x00, 0xC1, 0x00, 0x00, 0xC1, 0x00, 0x00, 0xC1, 0x00, 0x00, 0xC1,
0x00, 0x00,
// Unicode: [0x0073]
0xA1, 0xDD, 0x06, 0x96, 0x00, 0x03, 0xE3, 0x48, 0x00, 0x20, 0xB6, 0x09, 0x23, 0x40, 0x0B, 0xD4,
0xCD, 0x03,
// Unicode: [0x0074]
0x61, 0x00, 0xD1, 0x00, 0xF9, 0x9C, 0xD1, 0x00, 0xD1, 0x00, 0xD1, 0x00, 0xE0, 0x00, 0x80, 0x9D,
// Unicode: [0x0075]
0xC2, 0x00, 0x68, 0xC2, 0x00, 0x68, 0xC2, 0x00, 0x68, 0xC2, 0x00, 0x68, 0xD1, 0x00, 0x6A, 0x70,
0xBC, 0x6B,
// Unicode: [0x0076]
0x78, 0x00, 0x78, 0xC2, 0x00, 0x1D, 0xC0, 0x33, 0x0B, 0x60, 0x98, 0x05, 0x10, 0xDD, 0x00, 0x00,
0x9B, 0x00,
// Unicode: [0x0077]
0x77, 0x60, 0x0A, 0xA4, 0xA3, 0xA0, 0x0C, 0x67, 0xD0, 0xB1, 0x49, 0x3A, 0xB0, 0x76, 0x84, 0x0C,
0x80, 0x2D, 0xD0, 0x0A, 0x40, 0x0D, 0xA0, 0x07,
// Unicode: [0x0078]
0xC5, 0x00, 0x4C, 0xA0, 0x77, 0x08, 0x10, 0xBD, 0x00, 0x10, 0xCC, 0x00, 0xA0, 0x86, 0x09, 0xA5,
0x00, 0x4D,
// Unicode: [0x0079]
0x78, 0x00, 0x68, 0xD2, 0x00, 0x1D, 0xB0, 0x54, 0x09, 0x50, 0xBA, 0x03, 0x00, 0xCD, 0x00, 0x00,
0x7A, 0x00, 0x00, 0x1D, 0x00, 0x50, 0x0A, 0x00,
// Unicode: [0x007A]
0xC6, 0xDC, 0x0B, 0x00, 0xC0, 0x03, 0x00, 0x78, 0x00, 0x40, 0x0B, 0x00, 0xD1, 0x02, 0x00, 0xE8,
0xCC, 0x0B
};

View File

@ -0,0 +1,12 @@
#include <touchgfx/hal/Types.hpp>
FONT_GLYPH_LOCATION_FLASH_PRAGMA
KEEP extern const uint8_t unicodes_verdana_20_4bpp_0[] FONT_GLYPH_LOCATION_FLASH_ATTRIBUTE =
{
// Unicode: [0x003F]
0x93, 0xEC, 0xDE, 0x29, 0x00, 0xF7, 0xAD, 0xDA, 0xEF, 0x02, 0x33, 0x00, 0x00, 0xF9, 0x0A, 0x00,
0x00, 0x00, 0xF3, 0x0C, 0x00, 0x00, 0x00, 0xF5, 0x0A, 0x00, 0x00, 0x10, 0xFD, 0x03, 0x00, 0x00,
0xD5, 0x6F, 0x00, 0x00, 0xB0, 0xCF, 0x03, 0x00, 0x00, 0xE0, 0x0C, 0x00, 0x00, 0x00, 0xE0, 0x0C,
0x00, 0x00, 0x00, 0x40, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x0E, 0x00,
0x00, 0x00, 0xF0, 0x0E, 0x00, 0x00
};

View File

@ -0,0 +1,50 @@
#include <touchgfx/hal/Types.hpp>
FONT_GLYPH_LOCATION_FLASH_PRAGMA
KEEP extern const uint8_t unicodes_verdana_40_4bpp_0[] FONT_GLYPH_LOCATION_FLASH_ATTRIBUTE =
{
// Unicode: [0x002B]
0x00, 0x00, 0x00, 0x00, 0x00, 0xF4, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0xF4, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF4,
0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF4, 0xFF, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF4, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF4, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0xF4, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xF4, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF4, 0xFF, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF4, 0xFF, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x33, 0x33, 0x33, 0x33, 0x33, 0xF6, 0xFF, 0x33, 0x33, 0x33, 0x33, 0x33, 0x02, 0xFD,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x0A, 0xFD, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x0A, 0xFD, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x0A, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF4, 0xFF, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF4, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0xF4, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0xF4, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF4,
0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF4, 0xFF, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF4, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF4, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0xF4, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xF4, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF4, 0xFF, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00,
// Unicode: [0x002D]
0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x02, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x03, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0x03, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x03,
// Unicode: [0x003F]
0x00, 0x10, 0x53, 0x77, 0x57, 0x02, 0x00, 0x00, 0x00, 0x83, 0xFC, 0xFF, 0xFF, 0xFF, 0xDF, 0x17,
0x00, 0x00, 0xFD, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xDF, 0x02, 0x00, 0xFD, 0xFF, 0xFF, 0xEF, 0xFF,
0xFF, 0xFF, 0x2E, 0x00, 0xFD, 0x9E, 0x15, 0x00, 0x41, 0xFA, 0xFF, 0xBF, 0x00, 0x6B, 0x00, 0x00,
0x00, 0x00, 0x60, 0xFF, 0xFF, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFB, 0xFF, 0x07, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0xF7, 0xFF, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF6, 0xFF,
0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF7, 0xFF, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xFB, 0xFF, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0xFF, 0xEF, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0xC1, 0xFF, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0xFC, 0xFF, 0x0C, 0x00, 0x00, 0x00,
0x00, 0x00, 0xD3, 0xFF, 0xDF, 0x02, 0x00, 0x00, 0x00, 0x00, 0x81, 0xFF, 0xFF, 0x2C, 0x00, 0x00,
0x00, 0x00, 0x60, 0xFE, 0xFF, 0x9F, 0x00, 0x00, 0x00, 0x00, 0x00, 0xD0, 0xFF, 0xDF, 0x04, 0x00,
0x00, 0x00, 0x00, 0x00, 0xD0, 0xFF, 0x0B, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xD0, 0xFF, 0x09,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xD0, 0xFF, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xD0,
0xFF, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xD0, 0xFF, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x44, 0x03, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0xF1, 0xFF, 0x0E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF1, 0xFF,
0x0E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF1, 0xFF, 0x0E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xF1, 0xFF, 0x0E, 0x00, 0x00, 0x00, 0x00
};

View File

@ -0,0 +1,43 @@
/* 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* list, uint16_t size, uint16_t height, uint8_t pixBelowBase, 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) :
ConstFont(list, size, height, pixBelowBase, bitsPerPixel, byteAlignRow, maxLeft, maxRight, fallbackChar, ellipsisChar),
glyphData(glyphDataInternalFlash),
kerningData(kerningList),
gsubTable(gsubData)
{
}
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;
}
} // namespace touchgfx

View File

@ -0,0 +1,12 @@
#include <touchgfx/Font.hpp>
FONT_KERNING_LOCATION_FLASH_PRAGMA
KEEP extern const touchgfx::KerningNode kerning_verdana_10_4bpp[] FONT_KERNING_LOCATION_FLASH_ATTRIBUTE =
{
{ 0x0046, -1 }, // (First char = [0x0046, F], Second char = [0x002E, .], Kerning dist = -1)
{ 0x0050, -1 }, // (First char = [0x0050, P], Second char = [0x002E, .], Kerning dist = -1)
{ 0x0054, -1 }, // (First char = [0x0054, T], Second char = [0x002E, .], Kerning dist = -1)
{ 0x0056, -1 }, // (First char = [0x0056, V], Second char = [0x002E, .], Kerning dist = -1)
{ 0x0059, -1 }, // (First char = [0x0059, Y], Second char = [0x002E, .], Kerning dist = -1)
{ 0x0072, -1 }, // (First char = [0x0072, r], Second char = [0x002E, .], Kerning dist = -1)
};

View File

@ -0,0 +1,7 @@
#include <touchgfx/Font.hpp>
FONT_KERNING_LOCATION_FLASH_PRAGMA
KEEP extern const touchgfx::KerningNode kerning_verdana_20_4bpp[] FONT_KERNING_LOCATION_FLASH_ATTRIBUTE =
{
{ 0, 0 }
};

View File

@ -0,0 +1,7 @@
#include <touchgfx/Font.hpp>
FONT_KERNING_LOCATION_FLASH_PRAGMA
KEEP extern const touchgfx::KerningNode kerning_verdana_40_4bpp[] FONT_KERNING_LOCATION_FLASH_ATTRIBUTE =
{
{ 0, 0 }
};

View File

@ -0,0 +1,93 @@
// Autogenerated, do not edit
#include <fonts/GeneratedFont.hpp>
FONT_TABLE_LOCATION_FLASH_PRAGMA
KEEP extern const touchgfx::GlyphNode glyphs_verdana_10_4bpp[] FONT_TABLE_LOCATION_FLASH_ATTRIBUTE =
{
{ 0, 0x0020, 0, 0, 0, 0, 4, 0, 0, 0x00 },
{ 0, 0x002D, 4, 1, 4, 0, 5, 0, 0, 0x00 },
{ 2, 0x002E, 2, 2, 2, 1, 4, 0, 6, 0x00 },
{ 4, 0x002F, 5, 10, 8, 0, 5, 0, 0, 0x00 },
{ 34, 0x0030, 6, 8, 8, 0, 6, 0, 0, 0x00 },
{ 58, 0x0031, 5, 8, 8, 1, 6, 0, 0, 0x00 },
{ 82, 0x0032, 6, 8, 8, 0, 6, 0, 0, 0x00 },
{ 106, 0x0033, 6, 8, 8, 0, 6, 0, 0, 0x00 },
{ 130, 0x0034, 6, 8, 8, 0, 6, 0, 0, 0x00 },
{ 154, 0x0035, 6, 8, 8, 0, 6, 0, 0, 0x00 },
{ 178, 0x0036, 6, 8, 8, 0, 6, 0, 0, 0x00 },
{ 202, 0x0037, 6, 8, 8, 0, 6, 0, 0, 0x00 },
{ 226, 0x0038, 6, 8, 8, 0, 6, 0, 0, 0x00 },
{ 250, 0x0039, 6, 8, 8, 0, 6, 0, 0, 0x00 },
{ 274, 0x003A, 2, 6, 6, 1, 5, 0, 0, 0x00 },
{ 280, 0x003F, 5, 8, 8, 0, 5, 0, 0, 0x00 },
{ 304, 0x0041, 7, 8, 8, 0, 7, 0, 0, 0x00 },
{ 336, 0x0042, 6, 8, 8, 1, 7, 0, 0, 0x00 },
{ 360, 0x0043, 7, 8, 8, 0, 7, 0, 0, 0x00 },
{ 392, 0x0044, 7, 8, 8, 1, 8, 0, 0, 0x00 },
{ 424, 0x0045, 5, 8, 8, 1, 6, 0, 0, 0x00 },
{ 448, 0x0046, 5, 8, 8, 1, 6, 0, 0, 0x00 },
{ 472, 0x0047, 8, 8, 8, 0, 8, 0, 0, 0x00 },
{ 504, 0x0048, 6, 8, 8, 1, 8, 0, 0, 0x00 },
{ 528, 0x0049, 4, 8, 8, 0, 4, 0, 0, 0x00 },
{ 544, 0x004A, 4, 8, 8, 0, 5, 0, 0, 0x00 },
{ 560, 0x004B, 6, 8, 8, 1, 7, 0, 0, 0x00 },
{ 584, 0x004C, 5, 8, 8, 1, 6, 0, 0, 0x00 },
{ 608, 0x004D, 7, 8, 8, 1, 8, 0, 0, 0x00 },
{ 640, 0x004E, 6, 8, 8, 1, 7, 0, 0, 0x00 },
{ 664, 0x004F, 8, 8, 8, 0, 8, 0, 0, 0x00 },
{ 696, 0x0050, 5, 8, 8, 1, 6, 0, 0, 0x00 },
{ 720, 0x0051, 8, 10, 8, 0, 8, 0, 0, 0x00 },
{ 760, 0x0052, 6, 8, 8, 1, 7, 0, 0, 0x00 },
{ 784, 0x0053, 7, 8, 8, 0, 7, 0, 0, 0x00 },
{ 816, 0x0054, 7, 8, 8, 0, 6, 0, 0, 0x00 },
{ 848, 0x0055, 7, 8, 8, 0, 7, 0, 0, 0x00 },
{ 880, 0x0056, 7, 8, 8, 0, 7, 0, 0, 0x00 },
{ 912, 0x0057, 10, 8, 8, 0, 10, 0, 0, 0x00 },
{ 952, 0x0058, 7, 8, 8, 0, 7, 0, 0, 0x00 },
{ 984, 0x0059, 6, 8, 8, 0, 6, 0, 0, 0x00 },
{ 1008, 0x005A, 7, 8, 8, 0, 7, 0, 0, 0x00 },
{ 1040, 0x0061, 6, 6, 6, 0, 6, 0, 0, 0x00 },
{ 1058, 0x0062, 6, 8, 8, 0, 6, 0, 0, 0x00 },
{ 1082, 0x0063, 5, 6, 6, 0, 5, 0, 0, 0x00 },
{ 1100, 0x0064, 6, 8, 8, 0, 6, 0, 0, 0x00 },
{ 1124, 0x0065, 6, 6, 6, 0, 6, 0, 0, 0x00 },
{ 1142, 0x0066, 4, 8, 8, 0, 4, 0, 0, 0x00 },
{ 1158, 0x0067, 6, 8, 6, 0, 6, 0, 0, 0x00 },
{ 1182, 0x0068, 6, 8, 8, 0, 6, 0, 0, 0x00 },
{ 1206, 0x0069, 2, 8, 8, 0, 3, 0, 0, 0x00 },
{ 1214, 0x006A, 4, 10, 8, -1, 3, 0, 0, 0x00 },
{ 1234, 0x006B, 6, 8, 8, 0, 6, 0, 0, 0x00 },
{ 1258, 0x006C, 2, 8, 8, 0, 3, 0, 0, 0x00 },
{ 1266, 0x006D, 9, 6, 6, 0, 10, 0, 0, 0x00 },
{ 1296, 0x006E, 6, 6, 6, 0, 6, 0, 0, 0x00 },
{ 1314, 0x006F, 6, 6, 6, 0, 6, 0, 0, 0x00 },
{ 1332, 0x0070, 6, 8, 6, 0, 6, 0, 0, 0x00 },
{ 1356, 0x0071, 6, 8, 6, 0, 6, 0, 0, 0x00 },
{ 1380, 0x0072, 5, 6, 6, 0, 4, 0, 0, 0x00 },
{ 1398, 0x0073, 5, 6, 6, 0, 5, 0, 0, 0x00 },
{ 1416, 0x0074, 4, 8, 8, 0, 4, 0, 0, 0x00 },
{ 1432, 0x0075, 6, 6, 6, 0, 6, 0, 0, 0x00 },
{ 1450, 0x0076, 6, 6, 6, 0, 6, 0, 0, 0x00 },
{ 1468, 0x0077, 8, 6, 6, 0, 8, 0, 0, 0x00 },
{ 1492, 0x0078, 6, 6, 6, 0, 6, 0, 0, 0x00 },
{ 1510, 0x0079, 6, 8, 6, 0, 6, 0, 0, 0x00 },
{ 1534, 0x007A, 5, 6, 6, 0, 5, 0, 0, 0x00 }
};
// verdana_10_4bpp
extern const touchgfx::GlyphNode glyphs_verdana_10_4bpp[];
extern const uint8_t unicodes_verdana_10_4bpp_0[];
extern const uint8_t* const unicodes_verdana_10_4bpp[] =
{
unicodes_verdana_10_4bpp_0
};
extern const touchgfx::KerningNode kerning_verdana_10_4bpp[];
touchgfx::GeneratedFont& getFont_verdana_10_4bpp();
touchgfx::GeneratedFont& getFont_verdana_10_4bpp()
{
static touchgfx::GeneratedFont verdana_10_4bpp(glyphs_verdana_10_4bpp, 68, 10, 2, 4, 1, 1, 1, unicodes_verdana_10_4bpp, kerning_verdana_10_4bpp, 63, 0, 0);
return verdana_10_4bpp;
}

View File

@ -0,0 +1,26 @@
// Autogenerated, do not edit
#include <fonts/GeneratedFont.hpp>
FONT_TABLE_LOCATION_FLASH_PRAGMA
KEEP extern const touchgfx::GlyphNode glyphs_verdana_20_4bpp[] FONT_TABLE_LOCATION_FLASH_ATTRIBUTE =
{
{ 0, 0x003F, 9, 14, 14, 1, 11, 0, 0, 0x00 }
};
// verdana_20_4bpp
extern const touchgfx::GlyphNode glyphs_verdana_20_4bpp[];
extern const uint8_t unicodes_verdana_20_4bpp_0[];
extern const uint8_t* const unicodes_verdana_20_4bpp[] =
{
unicodes_verdana_20_4bpp_0
};
extern const touchgfx::KerningNode kerning_verdana_20_4bpp[];
touchgfx::GeneratedFont& getFont_verdana_20_4bpp();
touchgfx::GeneratedFont& getFont_verdana_20_4bpp()
{
static touchgfx::GeneratedFont verdana_20_4bpp(glyphs_verdana_20_4bpp, 1, 20, 0, 4, 1, 0, 0, unicodes_verdana_20_4bpp, kerning_verdana_20_4bpp, 63, 0, 0);
return verdana_20_4bpp;
}

View File

@ -0,0 +1,28 @@
// Autogenerated, do not edit
#include <fonts/GeneratedFont.hpp>
FONT_TABLE_LOCATION_FLASH_PRAGMA
KEEP extern const touchgfx::GlyphNode glyphs_verdana_40_4bpp[] FONT_TABLE_LOCATION_FLASH_ATTRIBUTE =
{
{ 0, 0x002B, 25, 25, 26, 4, 33, 0, 0, 0x00 },
{ 325, 0x002D, 13, 4, 15, 3, 18, 0, 0, 0x00 },
{ 353, 0x003F, 17, 31, 31, 3, 22, 0, 0, 0x00 }
};
// verdana_40_4bpp
extern const touchgfx::GlyphNode glyphs_verdana_40_4bpp[];
extern const uint8_t unicodes_verdana_40_4bpp_0[];
extern const uint8_t* const unicodes_verdana_40_4bpp[] =
{
unicodes_verdana_40_4bpp_0
};
extern const touchgfx::KerningNode kerning_verdana_40_4bpp[];
touchgfx::GeneratedFont& getFont_verdana_40_4bpp();
touchgfx::GeneratedFont& getFont_verdana_40_4bpp()
{
static touchgfx::GeneratedFont verdana_40_4bpp(glyphs_verdana_40_4bpp, 3, 40, 0, 4, 1, 0, 0, unicodes_verdana_40_4bpp, kerning_verdana_40_4bpp, 63, 0, 0);
return verdana_40_4bpp;
}

View File

@ -0,0 +1,148 @@
/* DO NOT EDIT THIS FILE */
/* This file is autogenerated by the text-database code generator */
#include <fonts/UnmappedDataFont.hpp>
#include <fonts/ApplicationFontProvider.hpp>
#include <touchgfx/hal/FlashDataReader.hpp>
namespace touchgfx
{
GlyphNode UnmappedDataFont::glyphNodeBuffer;
UnmappedDataFont::UnmappedDataFont(const GlyphNode* list, const uint16_t* unicodeList, uint16_t size, uint16_t height, uint8_t pixBelowBase, uint8_t bitsPerPixel, uint8_t byteAlignRow, uint8_t maxLeft, uint8_t maxRight, const uint8_t* const* glyphDataList, const KerningNode* kerningList, const Unicode::UnicodeChar fallbackChar, const Unicode::UnicodeChar ellipsisChar, const uint16_t* const gsubData) :
Font(height, pixBelowBase, bitsPerPixel, byteAlignRow, maxLeft, maxRight, fallbackChar, ellipsisChar),
glyphList(list),
listSize(size),
unicodes(unicodeList),
glyphDataList(glyphDataList),
kerningData(kerningList),
gsubTable(gsubData)
{
}
const GlyphNode* UnmappedDataFont::getGlyph(Unicode::UnicodeChar unicode, const uint8_t*& pixelData, uint8_t& bitsPerPixel) const
{
int index = lookupUnicode(unicode);
if (index != -1)
{
//Read glyphNode from unmapped flash
touchgfx::FlashDataReader* const flashReader = ApplicationFontProvider::getFlashReader();
flashReader->copyData(glyphList + index, &glyphNodeBuffer, sizeof(GlyphNode));
pixelData = getPixelData(const_cast<const GlyphNode*>(&glyphNodeBuffer));
bitsPerPixel = getBitsPerPixel();
return &glyphNodeBuffer;
}
return 0;
}
const uint8_t* UnmappedDataFont::getPixelData(const GlyphNode* glyph) const
{
const uint8_t* const* table = (const uint8_t* const*)glyphDataList;
return &(table[glyph->unicode / 2048][glyph->dataOffset]);
}
int8_t UnmappedDataFont::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;
}
int UnmappedDataFont::lookupUnicode(uint16_t unicode) const
{
int32_t min = 0;
int32_t max = listSize - 1;
int32_t mid = min + (unicode - unicodes[min]); // Linear up from [min].unicode
if (mid < min)
{
// Unicode < unicodes[min] => not found
return -1;
}
if (mid > max)
{
// Linear up ends too high
mid = max - (unicodes[max] - unicode); // Linear down from [max].unicode
if (mid > max)
{
// Unicode > unicodes[max] => not found
return -1;
}
if (mid < min)
{
// Linear down ends too low, take the middle element
mid = (min + max) / 2;
}
}
while (min <= max)
{
if (unicode == unicodes[mid])
{
// Found at [mid]
return mid;
}
if (unicode < unicodes[mid])
{
// Unicode is in lower half
max = mid - 1;
if (max < min)
{
// Range is empty => not found
break;
}
// We adjusted max, try linear down from [max].unicode
mid = max - (unicodes[max] - unicode);
if (mid > max)
{
// Unicode > [max].unicode => not found
break;
}
if (mid < min)
{
// Linear down ends too low, take the middle element
mid = (min + max) / 2;
}
}
else
{
// Unicode is in upper half
min = mid + 1;
if (min > max)
{
// Range is empty => not found
break;
}
// We adjusted min, try linear up from [min].unicode
mid = min + (unicode - unicodes[min]);
if (mid < min)
{
// Unicode < [min].unicode => not found
break;
}
if (mid > max)
{
// Linear up ends too high, take the middle element
mid = (min + max) / 2;
}
}
}
return -1;
}
} // namespace touchgfx