WritingSystem.h header

#include <ew/core/WritingSystem.h>

Namespace ew::core

Glyph struct

struct ew::core::Glyph

One glyph of a constructed writing system: a named symbol that spells a grapheme, with an optional vector outline. The grapheme is the romanized spelling this glyph writes (so a word can be converted to glyphs); svgPath is the glyph's shape as SVG path data (empty for a glyph that has been named/mapped but not yet drawn), which lets the script be rendered and exported as artwork.

Members

QString ew::core::Glyph::name

The glyph's name/identifier (e.g. "aleph", "vowel-a").

QString ew::core::Glyph::grapheme

The romanized grapheme this glyph writes (e.g. "a", "sh"); empty for a decorative glyph.

QString ew::core::Glyph::svgPath

The glyph outline as SVG path data (the d attribute), in a nominal 100x100 em box; empty when the glyph has not been drawn yet.

bool ew::core::Glyph::operator==(const Glyph &other) const =default

Value equality over all fields.

LigatureRule struct

struct ew::core::LigatureRule

A ligature rule: a sequence of graphemes that is written as a single combined glyph rather than the individual glyphs. Modelling ligatures lets a script join letters (as many real scripts do).

Members

QString ew::core::LigatureRule::sequence

The grapheme sequence that ligates (e.g. "ae", "ll"); matched greedily, longest first.

QString ew::core::LigatureRule::glyphName

The name of the Glyph that spells the whole sequence.

bool ew::core::LigatureRule::operator==(const LigatureRule &other) const =default

Value equality over all fields.

WritingSystem struct

struct ew::core::WritingSystem

A constructed writing system (conscript): a named set of glyphs, the writing direction, and ligatures. It layers over the language's romanization – each glyph maps a grapheme to a drawn form – so a word can be converted into a glyph sequence, rendered on screen, and exported as artwork. Empty for a language written only in the Latin alphabet.

Members

QString ew::core::WritingSystem::name

The script's display name (e.g. "Keshan runes").

TextDirection ew::core::WritingSystem::direction =

The writing direction.

std::vector<Glyph> ew::core::WritingSystem::glyphs

The glyphs, in the script's own order.

std::vector<LigatureRule> ew::core::WritingSystem::ligatures

The ligature rules.

bool ew::core::WritingSystem::isEmpty() const

Whether the writing system carries no glyphs, ligatures, or name (only defaults).

const Glyph * ew::core::WritingSystem::glyphForGrapheme(const QString &grapheme) const

The glyph that writes grapheme (case-sensitive), or nullptr if none.

const Glyph * ew::core::WritingSystem::glyphByName(const QString &glyphName) const

The glyph named glyphName, or nullptr if none.

bool ew::core::WritingSystem::operator==(const WritingSystem &other) const =default

Value equality over all fields.

Enumerations

enum class TextDirection { LeftToRight, RightToLeft, TopToBottom }

The direction a constructed script is written and read in. Serialized as a stable lowercase token.

Functions

std::optional< TextDirection > ew::core::textDirectionFromToken(QStringView token)

Parses a text direction from its token; std::nullopt if unrecognized.

QString ew::core::toToken(TextDirection direction)

The stable serialization token for direction (e.g. "rtl").