ScriptInventory.h header
#include <ew/app/ScriptInventory.h>
Namespace ew::app
InventoryCoverage struct
struct ew::app::InventoryCoverage
How much of a script has been drawn.
Members
int ew::app::script::InventoryCoverage::total = 0
How many units the script could have a glyph for.
int ew::app::script::InventoryCoverage::drawn = 0
How many of them do.
bool ew::app::script::InventoryCoverage::truncated = false
Whether the candidate list was cut short by a limit, so total counts what was ENUMERATED rather than what exists.
Reported rather than hidden: a script whose unit is a root can imply four figures of possible symbols, and a coverage line that silently counted only the first few hundred would tell the user they are further along than they are.
bool ew::app::script::InventoryCoverage::operator==(const InventoryCoverage &other) const =default
Value equality over all fields.
InventoryEntry struct
struct ew::app::InventoryEntry
One unit a script could have a glyph for, and whether it has one yet.
Members
QString ew::app::script::InventoryEntry::unit
The unit itself, as a glyph's ew::core::conlang::Glyph::unit records it.
QString ew::app::script::InventoryEntry::label
What to show beside it – a word's meaning, a syllable's shape – or empty when the unit is its own label.
QString ew::app::script::InventoryEntry::glyphName
The glyph that writes it, or empty when nothing has been drawn for it.
bool ew::app::script::InventoryEntry::drawn = false
Whether a glyph has actually been drawn for this unit.
bool ew::app::script::InventoryEntry::operator==(const InventoryEntry &other) const =default
Value equality over all fields.
Functions
bool ew::app::script::candidatesTruncated(const ew::core::conlang::Language &language, int limit)
Whether entries was cut short at limit.
InventoryCoverage ew::app::script::coverageOf(const std::vector< InventoryEntry > &entries, bool truncated=false)
The coverage entries represent, with truncated carried through from enumeration.
std::vector< InventoryEntry > ew::app::script::filterInventory(const std::vector< InventoryEntry > &entries, const QString &query, bool drawnOnly)
entries narrowed to those matching query (in the unit or its label, case-insensitively) and, when drawnOnly, to those already drawn.
QString ew::app::script::nextUndrawnUnit(const std::vector< InventoryEntry > &entries, const QString &unit)
The entry after unit in entries that has not been drawn yet, or empty when there is none.
What the canvas advances to when a glyph is finished. Drawing an alphabet is a sitting, not a series of errands, and having to return to a list between each letter is what turns one into the other.
std::vector< InventoryEntry > ew::app::script::scriptCandidates(const ew::core::conlang::Language &language, int limit=kDefaultCandidateLimit)
The units language's script could have glyphs for, drawn from what the language already holds.
Which data is read follows the script's ew::core::conlang::ScriptUnitKind: the phoneme inventory for an alphabet, the phonotactic templates for a syllabary, the templates and the lexicon for a root-per-glyph script, the lexicon for a logography, and the script's own glyphs when the list is the user's to manage. Nothing is ever retyped – a user who has already defined their sounds should not have to name them again to draw them.
At most limit entries, so a script implying thousands of possible units does not build a list nobody asked for; InventoryCoverage::truncated then says the count is partial.
Constants
int ew::app::script::kDefaultCandidateLimit = 4096
The most candidates enumerated by default.
A cap is not a nicety here. A syllabary over a modest inventory, or a script whose unit is a three-sound root, multiplies out to four or five figures of possible units – and the ones that matter are the coined handful. The list stays a list of CANDIDATES; no glyph is created for any of them until it is drawn.