# Title/footnote wish fulfillment # for wishes of the form: # "Wish $tag is titled "This is a tag"" or "Wish $tag is footnoted "This is a footnote"" When /thing/ has region /region/ { set radians [region angle $region] When the collected matches for [list /someone/ wishes $thing is titled /text/] are /matches/ { set text [join [lmap match $matches {dict get $match text}] "\n"] if {$text eq ""} { return } set scale [dict_getdef $match scale 1.0] set pos [region top [region move $region up 10px]] Wish to draw text with position $pos scale $scale text $text radians $radians anchor bottom } When the collected matches for [list /someone/ wishes $thing is footnoted /text/] are /matches/ { set text [join [lmap match $matches {dict get $match text}] "\n"] if {$text eq ""} { return } set scale [dict_getdef $match scale 0.75] set pos [region bottomleft [region move $region down 20px]] Wish to draw text with position $pos scale $scale text $text radians $radians anchor topleft } When the collected matches for [list /someone/ wishes $thing is right-margined /text/] are /matches/ { set text [join [lmap match $matches {dict get $match text}] "\n"] if {$text eq ""} { return } set scale [dict_getdef $match scale 0.75] set pos [region right [region move $region right 10px]] Wish to draw text with position $pos scale $scale text $text radians $radians anchor left } When the collected matches for [list /someone/ wishes $thing is left-margined /text/] are /matches/ { set text [join [lmap match $matches {dict get $match text}] "\n"] if {$text eq ""} { return } set scale [dict_getdef $match scale 0.75] set pos [region left [region move $region left 10px]] Wish to draw text with position $pos scale $scale text $text radians $radians anchor right } }