summaryrefslogtreecommitdiffstats
path: root/virtual-programs
diff options
context:
space:
mode:
authorOmar Rizwan <omar@omar.website>2023-09-20 13:07:49 +0000
committerOmar Rizwan <omar@omar.website>2023-09-20 13:07:49 +0000
commit370f2f88246233f721db7eb28416ec69e27f4ad2 (patch)
tree5ba3fad8c26e1e11783e8eea9990839ef9d5f69c /virtual-programs
parentdisplay: Text rotate works. (diff)
downloadfolk-370f2f88246233f721db7eb28416ec69e27f4ad2.tar.gz
folk-370f2f88246233f721db7eb28416ec69e27f4ad2.zip
display: Fix textMetrics
Diffstat (limited to 'virtual-programs')
-rw-r--r--virtual-programs/display.folk9
1 files changed, 5 insertions, 4 deletions
diff --git a/virtual-programs/display.folk b/virtual-programs/display.folk
index f7c33ce3..b0fe3ec1 100644
--- a/virtual-programs/display.folk
+++ b/virtual-programs/display.folk
@@ -26,6 +26,8 @@ namespace eval ::Display {
}
On process {
+ puts "Display pid: [pid]"
+
source pi/Gpu.tcl
Gpu::init
Gpu::ImageManager::imageManagerInit
@@ -157,12 +159,13 @@ On process {
proc circle {x y radius thickness color} {}
proc textMetrics {text scale} {
+ variable font
set em [* $scale 30.0]
- set x $x0; set y $y0
+ set x 0; set y 0
for {set i 0} {$i < [string length $text]} {incr i} {
set char [string index $text $i]
if {$char eq "\n"} {
- set y [+ $y $em]; set x $x0; continue
+ set y [+ $y $em]; set x 0; continue
}
set charCode [scan $char %c]
if {[font hasGlyphInfo $font $charCode]} {
@@ -223,8 +226,6 @@ On process {
proc end {} { Gpu::drawEnd; Gpu::poll }
}
- puts "Display pid: [pid]"
-
# TODO: Clean this up. We retract these so that we don't bounce
# statements back to the main Folk process that it sends us.
Retract /anyone/ wishes $::thisProcess shares all wishes