Extended Graphic object - an AdvanceGraphic is a Graphic twinned with and advance vector.
- type AdvanceVec u = Vec2 u
- advanceH :: AdvanceVec u -> u
- advanceV :: AdvanceVec u -> u
- data AdvObject u
- type DAdvObject = AdvObject Double
- runAdvObject :: AdvObject u -> LocImage u (Vec2 u)
- makeAdvObject :: Query u (Vec2 u) -> LocGraphic u -> AdvObject u
- emptyAdvObject :: InterpretUnit u => AdvObject u
- blankAdvObject :: Vec2 u -> AdvObject u
- advance :: Num u => AdvObject u -> AdvObject u -> AdvObject u
- advances :: InterpretUnit u => [AdvObject u] -> AdvObject u
- advspace :: Num u => Vec2 u -> AdvObject u -> AdvObject u -> AdvObject u
- evenspace :: InterpretUnit u => Vec2 u -> [AdvObject u] -> AdvObject u
- advrepeat :: InterpretUnit u => Int -> AdvObject u -> AdvObject u
- punctuate :: InterpretUnit u => AdvObject u -> [AdvObject u] -> AdvObject u
- advfill :: Num u => Vec2 u -> AdvObject u -> AdvObject u
Advance vectors provide an idiom for drawing consecutive graphics. PostScript uses them to draw left-to-right text - each character has an advance vector for the width and as characters are drawn they successively displace the start point for the next character with their advance vector.
Type alias for Vec2.
Extract the horizontal component of an advance vector.
For left-to-right latin text, the vertical component of an advance vector is expected to be 0. Ingoring it seems permissible when drawing text.
Advance-vector object and graphic
Advance vector graphic - this partially models the
show command which moves the current point by the
advance (width) vector as each character is drawn.
Draw the first AdvObject and use the advance vector to displace the second AdvObject.
The final answer is the sum of both advance vectors.
Concatenate the list of AdvObjects with
Combine the AdvObjects using the answer vector of the first object plus the separator to move the start of the second object.
List version of
Repeat the AdvObject
n times, moving each time with
Concatenate the list of AdvObjects, going next and adding the separator at each step.