sourcelibs/Panel/demos/font.xtl
1⍝!/usr/bin/env xetal
2⍝ The panel's 7-segment font, drawn the classic way in three lines of
3⍝ text (_ and | for the segments): the sixteen digits, then the display
4⍝ after calculations typed at HEX1000. The same segments light the 3D
5⍝ mockup (mockup/calculator.xtl) and will be sent to the display driver.
6⍝ Run with "just demo-lib Panel font".
7ᵖⁿ⁼u̲se< "Panel"
8ʰˣ⁼u̲se< "Hex1000"
9ʳˣ⁼u̲se< "Radix"
10⍝# d u:a_rt: digit latches d (the leftmost first) as three lines
11ᵘa̲rt ← { d →
12 s ← ᵖⁿs̲egs d
13 n ← t̲ally d
14 c̲ol ← { k → r̲avel k s̲elect 2 1 t̲ranspose s }
15 one ← n r̲eshape 1
16 i ← (9 c̲at n) r̲eshape one c̲at (1 + c̲ol 1) c̲at one c̲at (1 + 2 × c̲ol 6) c̲at (1 + c̲ol 7) c̲at (1 + 2 × c̲ol 2) c̲at (1 + 2 × c̲ol 5) c̲at (1 + c̲ol 4) c̲at 1 + 2 × c̲ol 3
17 t ← i s̲elect " _|"
18 r̲ow ← { k → r̲avel 2 1 t̲ranspose 3 t̲ake (3 × k) d̲rop t }
19 (3 c̲at 3 × n) r̲eshape (r̲ow 0) c̲at (r̲ow 1) c̲at r̲ow 2
20}
21⍝# u:s_hown text: the display after typing text at the calculator
22ᵘs̲hown ← { text →
23 (st, d, done, took) ← ʰˣCalcRom ʰˣt̲ype (ʰˣReset, ʳˣk̲eys text, 30000)
24 p̲rint! text
25 ᵘa̲rt r̲ev d
26}
27"the font, 0 to F:"
28ᵘa̲rt 16 + o̲ffsets 16
29ᵘs̲hown "12+34="
30ᵘs̲hown "C0DE+BEEF="
31ᵘs̲hown "A*B="