blob: eeaaf1430cc689c2999bfdd790248ab8565cec55 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
When /thing/ has region /region/ {
set bbox [regionToBbox $region]
lassign [boxCentroid $bbox] x y
set width [boxWidth $bbox]
set height [boxHeight $bbox]
set radians [region angle $region]
set upsidedown [expr {$radians > 1.57 || $radians < -1.57}]
if {$::isLaptop} {set upsidedown false}
When the collected matches for [list /someone/ wishes $thing is labelled /text/] are /matches/ {
set text [join [lmap match $matches {dict get $match text}] "\n"]
if {$text eq ""} { return }
set lines [split $text "\n"]
set lines [expr {$upsidedown ? [lreverse $lines] : $lines}]
set scale 1
set fontSize [expr {18 * $scale}]
for {set lineNum 0} {$lineNum < [llength $lines]} {incr lineNum} {
set line [lindex $lines $lineNum]
set ly [expr {$y + $lineNum * $fontSize}]
Display::text device $x $ly $scale $line $radians
}
}
}
fn text {coords text angle} {
Display::text Display::fb [lindex $coords 0] [lindex $coords 1] 2 $text $angle
}
When /anyone/ wishes /p/ has halo message /message/ & /p/ has region /r/ {
lassign [lindex $r 0] a b c d
lassign $a x y
text $a $message 0
text $d $message 180
}
|