|
Pokered Save Editor 2
Pokemon Red & Blue save file editor - Qt 6 C++/QML
|
The font database – the in-game character set and the text codec. More...
#include <fontsdb.h>
Public Member Functions | |
| const QVector< FontDBEntry * > | getStore () const |
| All glyphs. | |
| const QHash< QString, FontDBEntry * > | getInd () const |
| Name->glyph index. | |
| int | getStoreSize () const |
| Glyph count. | |
| FontDBEntry * | getStoreAt (const int ind) const |
| Glyph by store index (for QML). | |
| FontDBEntry * | getIndAt (const QString val) const |
| Glyph by name key (for QML). | |
| const FontDBEntry * | getStoreByVal (int ind) const |
| Glyph by its font-code value. | |
| FontDBEntry * | fontAt (int ind) const |
| Alias for getStoreAt (1-based-friendly UI accessor). | |
| int | fontCount () const |
| Alias for getStoreSize. | |
| FontSearch * | searchRaw () const |
| Raw finder for QML (caller must delete; see note). | |
| QScopedPointer< FontSearch, QScopedPointerDeleteLater > | search () const |
| C++-owned finder (smart pointer). | |
| const QVector< int > | convertToCode (QString str, int maxLen=11, const bool autoEnd=true) const |
| String -> font codes (see note; expensive). | |
| const QString | convertFromCode (const QVector< int > codes, const int maxLen=11) const |
| Font codes -> string (fast). | |
| const QString | expandStr (const QString msg, const int maxLen, const QString rival, const QString player) const |
| Expand English text to in-game form (substitutes rival/player). | |
| int | countSizeOf (const QString val) const |
Rendered length of val (expensive). | |
| int | countSizeOfExpanded (const QString val) const |
| Rendered length after expandStr (expensive). | |
| void | load () |
| Load glyphs from JSON. | |
| void | index () |
| Build the name->glyph index. | |
| void | qmlProtect (const QQmlEngine *const engine) const |
| Pin to C++ ownership. | |
Static Public Member Functions | |
| static FontsDB * | inst () |
| < Number of font glyphs. | |
The font database – the in-game character set and the text codec.
More than a lookup table: FontsDB owns the glyph entries (keyed by name) AND the conversion between human-readable strings and the game's font-code bytes. This is what powers the name editors and the on-screen keyboard. Beyond the standard DB-singleton accessors it exposes:
| const QString FontsDB::convertFromCode | ( | const QVector< int > | codes, |
| const int | maxLen = 11 ) const |
Font codes -> string (fast).
Definition at line 174 of file fontsdb.cpp.
Referenced by expandStr(), and SaveFileToolset::getStr().
| const QVector< int > FontsDB::convertToCode | ( | QString | str, |
| int | maxLen = 11, | ||
| const bool | autoEnd = true ) const |
String -> font codes (see note; expensive).
Definition at line 109 of file fontsdb.cpp.
References FontDBEntry::ind, and FontDBEntry::name.
Referenced by countSizeOf(), countSizeOfExpanded(), expandStr(), FontPreviewInstance::getResultingText(), and SaveFileToolset::setStr().
| int FontsDB::countSizeOf | ( | const QString | val | ) | const |
Rendered length of val (expensive).
Definition at line 423 of file fontsdb.cpp.
References convertToCode().
| int FontsDB::countSizeOfExpanded | ( | const QString | val | ) | const |
Rendered length after expandStr (expensive).
Definition at line 429 of file fontsdb.cpp.
References convertToCode(), and expandStr().
| const QString FontsDB::expandStr | ( | const QString | msg, |
| const int | maxLen, | ||
| const QString | rival, | ||
| const QString | player ) const |
Expand English text to in-game form (substitutes rival/player).
Definition at line 205 of file fontsdb.cpp.
References convertFromCode(), and convertToCode().
Referenced by countSizeOfExpanded(), and FontPreviewInstance::getResultingText().
| FontDBEntry * FontsDB::fontAt | ( | int | ind | ) | const |
Alias for getStoreAt (1-based-friendly UI accessor).
Definition at line 413 of file fontsdb.cpp.
References getStoreByVal().
| int FontsDB::fontCount | ( | ) | const |
| const QHash< QString, FontDBEntry * > FontsDB::getInd | ( | ) | const |
Name->glyph index.
Definition at line 378 of file fontsdb.cpp.
| FontDBEntry * FontsDB::getIndAt | ( | const QString | val | ) | const |
Glyph by name key (for QML).
Definition at line 396 of file fontsdb.cpp.
| const QVector< FontDBEntry * > FontsDB::getStore | ( | ) | const |
All glyphs.
Definition at line 373 of file fontsdb.cpp.
| FontDBEntry * FontsDB::getStoreAt | ( | const int | ind | ) | const |
Glyph by store index (for QML).
Definition at line 388 of file fontsdb.cpp.
| const FontDBEntry * FontsDB::getStoreByVal | ( | int | ind | ) | const |
| int FontsDB::getStoreSize | ( | ) | const |
| void FontsDB::index | ( | ) |
Build the name->glyph index.
Definition at line 54 of file fontsdb.cpp.
|
static |
< Number of font glyphs.
A fresh glyph finder (QML-owned; see note). The process-wide FontsDB singleton.
Definition at line 367 of file fontsdb.cpp.
Referenced by DB::fonts(), FontPreviewInstance::getResultingText(), SaveFileToolset::getStr(), FontSearch::keepAnyOf(), DB::qmlProtect(), SaveFileToolset::setStr(), and FontSearch::startOver().
| void FontsDB::load | ( | ) |
Load glyphs from JSON.
Definition at line 32 of file fontsdb.cpp.
References GameData::inst(), and GameData::json().
| void FontsDB::qmlProtect | ( | const QQmlEngine *const | engine | ) | const |
Pin to C++ ownership.
Definition at line 70 of file fontsdb.cpp.
References Utility::qmlProtectUtil().
Referenced by DB::qmlProtect().
| QScopedPointer< FontSearch, QScopedPointerDeleteLater > FontsDB::search | ( | ) | const |
C++-owned finder (smart pointer).
Definition at line 98 of file fontsdb.cpp.
| FontSearch * FontsDB::searchRaw | ( | ) | const |
Raw finder for QML (caller must delete; see note).
Definition at line 93 of file fontsdb.cpp.