165 lines
6.9 KiB
C++

/* DO NOT EDIT THIS FILE */
/* This file is autogenerated by the text-database code generator */
#include <stdarg.h>
#include <touchgfx/TextProvider.hpp>
#include <touchgfx/Texts.hpp>
#include <touchgfx/TypedText.hpp>
#include <touchgfx/Unicode.hpp>
#include <touchgfx/hal/HAL.hpp>
#include <touchgfx/lcd/LCD.hpp>
#include <texts/TypedTextDatabase.hpp>
uint16_t touchgfx::Font::getStringWidth(const touchgfx::Unicode::UnicodeChar* text, ...) const
{
va_list pArg;
va_start(pArg, text);
uint16_t width = getStringWidthLTR(TEXT_DIRECTION_LTR, text, pArg);
va_end(pArg);
return width;
}
uint16_t touchgfx::Font::getStringWidth(touchgfx::TextDirection textDirection, const touchgfx::Unicode::UnicodeChar* text, ...) const
{
va_list pArg;
va_start(pArg, text);
uint16_t width = getStringWidthLTR(textDirection, text, pArg);
va_end(pArg);
return width;
}
touchgfx::Unicode::UnicodeChar touchgfx::TextProvider::getNextLigature(TextDirection direction)
{
if (fontGsubTable && nextCharacters.peekChar())
{
substituteGlyphs();
if (nextCharacters.peekChar(1) == 0x093F) // Hindi I-matra
{
nextCharacters.replaceAt1(nextCharacters.peekChar());
nextCharacters.replaceAt0(0x093F);
}
}
return getNextChar();
}
void touchgfx::TextProvider::initializeInternal()
{
fillInputBuffer();
}
void touchgfx::LCD::drawString(touchgfx::Rect widgetArea, const touchgfx::Rect& invalidatedArea, const touchgfx::LCD::StringVisuals& stringVisuals, const touchgfx::Unicode::UnicodeChar* format, ...)
{
va_list pArg;
va_start(pArg, format);
drawStringLTR(widgetArea, invalidatedArea, stringVisuals, format, pArg);
va_end(pArg);
}
// Default TypedTextDatabase
extern const touchgfx::TypedText::TypedTextData* const typedTextDatabaseArray[];
TEXT_LOCATION_FLASH_PRAGMA
KEEP extern const touchgfx::Unicode::UnicodeChar texts_all_languages[] TEXT_LOCATION_FLASH_ATTRIBUTE = {
0x43, 0x68, 0x6f, 0x6f, 0x73, 0x65, 0x20, 0x61, 0x20, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x0, // @0 "Choose a mission"
0x43, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x20, 0x4d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x3a, 0x0, // @17 "Current Mission:"
0x49, 0x6e, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x20, 0x4d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x21, 0x0, // @34 "Invalid Mission!"
0x49, 0x6e, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x20, 0x4d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x0, // @51 "Invalid Mission"
0x52, 0x32, 0x44, 0x20, 0x5b, 0x2, 0x2f, 0x38, 0x5d, 0x0, // @67 "R2D [<>/8]"
0x4d, 0x61, 0x6e, 0x75, 0x61, 0x6c, 0x20, 0x44, 0x72, 0x69, 0x76, 0x69, 0x6e, 0x67, 0x0, // @77 "Manual Driving"
0x41, 0x63, 0x63, 0x65, 0x6c, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x0, // @92 "Acceleration"
0x49, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x0, // @105 "Inspection"
0x50, 0x41, 0x52, 0x41, 0x4d, 0x45, 0x54, 0x45, 0x52, 0x53, 0x0, // @116 "PARAMETERS"
0x54, 0x72, 0x61, 0x63, 0x6b, 0x64, 0x72, 0x69, 0x76, 0x65, 0x0, // @127 "Trackdrive"
0x41, 0x75, 0x74, 0x6f, 0x63, 0x72, 0x6f, 0x73, 0x73, 0x0, // @138 "Autocross"
0x50, 0x52, 0x45, 0x43, 0x48, 0x41, 0x52, 0x47, 0x45, 0x0, // @148 "PRECHARGE"
0x45, 0x42, 0x53, 0x20, 0x54, 0x65, 0x73, 0x74, 0x0, // @158 "EBS Test"
0x2, 0x0, // @167 "<>"
0x41, 0x53, 0x53, 0x54, 0x41, 0x54, 0x45, 0x0, // @169 "ASSTATE"
0x49, 0x43, 0x53, 0x54, 0x41, 0x54, 0x45, 0x0, // @177 "ICSTATE"
0x49, 0x4e, 0x56, 0x4c, 0x52, 0x44, 0x59, 0x0, // @185 "INVLRDY"
0x49, 0x4e, 0x56, 0x52, 0x52, 0x44, 0x59, 0x0, // @193 "INVRRDY"
0x4d, 0x49, 0x53, 0x53, 0x49, 0x4f, 0x4e, 0x0, // @201 "MISSION"
0x52, 0x32, 0x44, 0x50, 0x52, 0x4f, 0x47, 0x0, // @209 "R2DPROG"
0x53, 0x6b, 0x69, 0x64, 0x70, 0x61, 0x64, 0x0, // @217 "Skidpad"
0x54, 0x53, 0x53, 0x54, 0x41, 0x54, 0x45, 0x0, // @225 "TSSTATE"
0x54, 0x53, 0x56, 0x42, 0x41, 0x54, 0x0, // @233 "TSVBAT"
0x54, 0x53, 0x56, 0x56, 0x45, 0x48, 0x0, // @240 "TSVVEH"
0x45, 0x52, 0x52, 0x4f, 0x52, 0x0, // @247 "ERROR"
0x4c, 0x56, 0x53, 0x4f, 0x43, 0x0, // @253 "LVSOC"
0x53, 0x50, 0x45, 0x45, 0x44, 0x0, // @259 "SPEED"
0x54, 0x49, 0x52, 0x45, 0x53, 0x0, // @265 "TIRES"
0x54, 0x53, 0x53, 0x4f, 0x43, 0x0, // @271 "TSSOC"
0x42, 0x42, 0x41, 0x4c, 0x0, // @277 "BBAL"
0x4c, 0x41, 0x50, 0x53, 0x0, // @282 "LAPS"
0x54, 0x4d, 0x41, 0x58, 0x0, // @287 "TMAX"
0x54, 0x54, 0x46, 0x4c, 0x0, // @292 "TTFL"
0x54, 0x54, 0x46, 0x52, 0x0, // @297 "TTFR"
0x54, 0x54, 0x52, 0x4c, 0x0, // @302 "TTRL"
0x54, 0x54, 0x52, 0x52, 0x0, // @307 "TTRR"
0x56, 0x4d, 0x49, 0x4e, 0x0, // @312 "VMIN"
0x49, 0x54, 0x53, 0x0, // @317 "ITS"
0x53, 0x44, 0x43, 0x0, // @321 "SDC"
0x4c, 0x56, 0x0 // @325 "LV"
};
TEXT_LOCATION_FLASH_PRAGMA
KEEP extern const uint32_t indicesGb[] TEXT_LOCATION_FLASH_ATTRIBUTE;
// Array holding dynamically installed languages
struct TranslationHeader
{
uint32_t offset_to_texts;
uint32_t offset_to_indices;
uint32_t offset_to_typedtext;
};
static const TranslationHeader* languagesArray[1] = { 0 };
// Compiled and linked in languages
static const uint32_t* const staticLanguageIndices[] = {
indicesGb
};
touchgfx::LanguageId touchgfx::Texts::currentLanguage = static_cast<touchgfx::LanguageId>(0);
static const touchgfx::Unicode::UnicodeChar* currentLanguagePtr = 0;
static const uint32_t* currentLanguageIndices = 0;
void touchgfx::Texts::setLanguage(touchgfx::LanguageId id)
{
const touchgfx::TypedText::TypedTextData* currentLanguageTypedText = 0;
if (id < 1)
{
if (languagesArray[id] != 0)
{
// Dynamic translation is added
const TranslationHeader* translation = languagesArray[id];
currentLanguagePtr = (const touchgfx::Unicode::UnicodeChar*)(((const uint8_t*)translation) + translation->offset_to_texts);
currentLanguageIndices = (const uint32_t*)(((const uint8_t*)translation) + translation->offset_to_indices);
currentLanguageTypedText = (const touchgfx::TypedText::TypedTextData*)(((const uint8_t*)translation) + translation->offset_to_typedtext);
}
else
{
// Compiled and linked in languages
currentLanguagePtr = texts_all_languages;
currentLanguageIndices = staticLanguageIndices[id];
currentLanguageTypedText = typedTextDatabaseArray[id];
}
}
if (currentLanguageTypedText)
{
currentLanguage = id;
touchgfx::TypedText::registerTypedTextDatabase(currentLanguageTypedText,
TypedTextDatabase::getFonts(), TypedTextDatabase::getInstanceSize());
}
}
void touchgfx::Texts::setTranslation(touchgfx::LanguageId id, const void* translation)
{
languagesArray[id] = (const TranslationHeader*)translation;
}
const touchgfx::Unicode::UnicodeChar* touchgfx::Texts::getText(TypedTextId id) const
{
return &currentLanguagePtr[currentLanguageIndices[id]];
}