PenRendering.h header
#include <ew/app/PenRendering.h>
Namespace ew::app
PenOptions struct
struct ew::app::PenOptions
How one stroke is inked on this occasion: the script's pen, plus the things that depend on WHERE the stroke is rather than on the pen itself.
Members
ew::core::conlang::PenSettings ew::app::script::PenOptions::settings
The script's pen.
quint32 ew::app::script::PenOptions::seed = 0
The seed for this glyph's tremor. Same glyph, same wobble, every time it is drawn.
bool ew::app::script::PenOptions::taperStart = true
Whether the stroke tapers at its start.
Suppressible because taper belongs at the two ends of a WORD, not of each glyph. In a connected script every glyph abuts its neighbours, and tapering each one pinches the line shut at every boundary – the layout engine turns these off in the middle of a run.
bool ew::app::script::PenOptions::taperEnd = true
Whether the stroke tapers at its end.
bool ew::app::script::PenOptions::tremorAtEnds = true
Whether tremor is allowed to move the stroke's endpoints.
Turned off for an anchored script: the anchors are where one glyph hands over to the next, and letting the wobble move them makes adjacent glyphs jog sideways where they meet.
Functions
quint32 ew::app::script::glyphSeed(const QString &glyphName)
A stable seed derived from glyphName, for this glyph's tremor.
Its own hash rather than qHash: qHash is seeded per process by default and is not promised to be stable across Qt versions, so a script would wobble differently on the next launch or after an upgrade – which is exactly the non-determinism that stops a script looking like a script.
double ew::app::script::penHalfWidth(double t, double dx, double dy, double pressure, const PenOptions &options)
The pen's half-width at t (0..1) along a stroke whose direction there is (dx, dy) and whose captured pressure is pressure.
Exposed because it is the whole of the pen's character and the part worth testing directly: the pressure model, the taper and its exponent, and the nib angle all meet here.
std::vector< ew::core::conlang::StrokePoint > ew::app::script::strokeOutline(const ew::core::conlang::Stroke &stroke, const PenOptions &options)
The inked outline of stroke as one closed polygon, ready to fill.
The stored stroke is a skeleton – the line a hand travelled. This is the shape a pen leaves following it: wider under pressure, narrowed at a taper, varying with the nib's angle, and wandering by the tremor. It is computed on demand and never written back, so the author's points stay exactly as drawn however the pen is re-tuned afterwards.
Empty when stroke has fewer than two points: a single point has no direction, and inventing one would put a mark on the page at an angle the user never chose.
double ew::app::script::tremorOffset(double t, double length, const PenOptions &options)
The sideways offset the tremor applies at t (0..1) along a stroke of length length.
A slow smooth wander ALONG the path, not per-point jitter – jitter reads as noise, while a wander reads as a hand. Deterministic in seed, and zero at both ends when PenOptions::tremorAtEnds is false.