diff --git a/src/mark-shapes.typ b/src/mark-shapes.typ index 5204f84f..0ff75b65 100644 --- a/src/mark-shapes.typ +++ b/src/mark-shapes.typ @@ -72,3 +72,18 @@ tip-offset: calculate-tip-offset(style) ) ) + +// Mark mnemonics +#let mnemonics = ( + ">": "triangle", +) + +// Get a mark shape for a mark name +#let get-mark(ctx, symbol) = { + // TODO: Support user supplied marks by looking them up in the ctx style + + if not symbol in marks { + symbol = mnemonics.at(symbol) + } + return marks.at(symbol) +} diff --git a/src/mark.typ b/src/mark.typ index 5b32289d..e066116e 100644 --- a/src/mark.typ +++ b/src/mark.typ @@ -5,7 +5,7 @@ #import "util.typ" #import "path-util.typ" #import "styles.typ" -#import "mark-shapes.typ" +#import "mark-shapes.typ": get-mark #let check-mark(style) = (style.start, style.end, style.symbol).any(v => v != none) @@ -107,8 +107,8 @@ /// -> A dictionary with the keys: /// - drawables (drawables): The transformed drawables of the mark. /// - distance: The distance between the tip of the mark and the end. -#let place-mark(style, pos, angle) = { - let (drawables, distance, tip-offset) = (mark-shapes.marks.at(style.symbol))(style) +#let place-mark(ctx, style, pos, angle) = { + let (drawables, distance, tip-offset) = (get-mark(ctx, style.symbol))(style) return ( drawables: drawable.apply-transform( @@ -133,7 +133,7 @@ if style.symbol == none { continue } - let mark = (mark-shapes.marks.at(style.symbol))(style) + let mark = (get-mark(ctx, style.symbol))(style) mark.length = mark.distance + mark.tip-offset let pos = path-util.point-on-path(