aboutsummaryrefslogtreecommitdiffstats
path: root/res/compose
blob: 56921d44f4a8e10ad361f29da207a2b25cecb829 (plain) (blame)
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
# mds — A micro-display server
# Copyright © 2014  Mattias Andrée (maandree@member.fsf.org)
# 
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# 
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
# 
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.



# Based on the Unicode Character Database 7.0



macro dead_ascii/1
  <dead letter \1> [" " <dead letter \1>] : "\1"
  <compose> "\1" : <dead letter \1>
end macro
macro dead_ascii/2
  <dead letter \1> [" " "\2" <dead letter \1>] : "\1"
  <compose> ["\1" "\2"] : <dead letter \1>
end macro

macro composite/3
  <dead letter \2> "\1" : "\3"
  <compose> "\1" "\2" : "\3"
end macro
macro composite/4
  <dead letter \2> "\1" : "\4"
  <compose> "\1" ["\2" "\3"] : "\4"
end macro


<compose> "u" "+" : <dead hexcompose>
<compose> "U" "+" : <dead longhexcompose>


# TODO C0 Controls

# Basic Latin:
dead_ascii("^")
dead_ascii("`")
dead_ascii("~")

# TODO C1 Controls

# Latin-1 Supplement:
<compose> "!" "!" : "¡"
<compose> ("/" "c") : "¢"
<compose> ("|" ["c" "L"]) : "¢"
<compose> ("-" ["l" "L"]) : "£"
<compose> (["o" "O"] ["x" "X"]) : "¤"
<compose> (["-" "="] ["y" "Y"]) : "¥"
<compose> ("!" "|") : "¦"
<compose> (["o" "O"] ["s" "S"]) : "§"
dead_ascii("¨" "\"")
<compose> (["o" "O"] ["c" "C"]) : "©"
(<compose> <dead letter ~>) "_" "a" : "ª"
<compose> "<" "<" : "«"
<compose> ("-" ",") : "¬"
<compose> "-" "-" " " : "­"
<compose> (["o" "O"] ["r" "R"]) : "®"
<compose> "-" : <dead letter ¯>
<compose> "o" : <dead letter °>
dead_ascii("°")
<compose> "+" "-" : "±"
<dead letter ^> "2" : "²"
<dead letter ^> "3" : "³"
dead_ascii("´" "'")
<compose> "m" "u" : "µ"
<compose> ["p" "P"] ["p" "P" "!"] : "¶"
<compose> "!" ["p" "P"] : "¶"
<compose> "." "-" : "·"
dead_ascii("," ",")
<dead letter ^> "1" : "¹"
(<compose> <dead letter ~>) "_" "o" : "º"
<compose> ">" ">" : "»"
<compose> "1" "4" : "¼"
<compose> "1" "2" : "½"
<compose> "3" "4" : "¾"
<compose> "?" "?" : "¿"
composite("`" "A" "À")
composite("´" "'" "A" "Á")
composite("~" "A" "Ã")
composite("¨" "\"" "A" "Ä")
<dead letter °> "A" : "Å"
<compose> "A" "E" : "Æ"
composite("¸" "," "C" "Ç")
composite("`" "E" "È")
composite("´" "'" "E" "É")
composite("^" "E" "Ê")
composite("¨" "\"" "E" "Ë")
composite("`" "I" "Ì")
composite("´" "'" "I" "Í")
composite("^" "I" "Î")
composite("¨" "\"" "I" "Ï")
<compose> "-" : <dead letter ->
composite("-" "D" "Đ")
<compose> "/" : <dead letter />
composite("/" "D" "Đ")
composite("~" "N" "Ñ")
composite("`" "O" "Ò")
composite("´" "'" "O" "Ó")
composite("^" "O" "Ô")
composite("~" "O" "Õ")
composite("¨" "\"" "O" "Ö")
<compose> "x" "x" : "×"
composite("/" "O" "Ø")
composite("`" "U" "Ù")
composite("´" "'" "U" "Ú")
composite("^" "U" "Û")
composite("¨" "\"" "U" "Ü")
composite("´" "'" "Y" "Ý")
<compose> "T" "H" : "Þ"
<compose> "s" "s" : "ß"
<compose> "ſ" "s" : "ß"
composite("`" "a" "à")
composite("´" "'" "a" "á")
composite("~" "a" "ã")
composite("¨" "\"" "a" "ä")
<dead letter °> "a" : "å"
<compose> "a" "e" : "æ"
composite("¸" "," "c" "ç")
composite("`" "e" "è")
composite("´" "'" "e" "é")
composite("^" "e" "ê")
composite("¨" "\"" "e" "ë")
composite("`" "i" "ì")
composite("´" "'" "i" "í")
composite("^" "i" "î")
composite("¨" "\"" "i" "ï")
composite("/" "d" "ð")
composite("~" "n" "ñ")
composite("`" "o" "ò")
composite("´" "'" "o" "ó")
composite("^" "o" "ô")
composite("~" "o" "õ")
composite("¨" "\"" "o" "ö")
<compose> ":" "-" : "÷"
composite("/" "o" "ø")
composite("`" "u" "ù")
composite("´" "'" "u" "ú")
composite("^" "u" "û")
composite("¨" "\"" "u" "ü")
composite("´" "'" "y" "ý")
<compose> "t" "h" : "þ"
composite("¨" "\"" "y" "ÿ")

# TODO Latin Extended-A
# TODO Latin Extended-B
# TODO IPA Extensions
# TODO Spacing Modifier Letter
# TODO Combining Diacritical Marks
# TODO Greek and Coptic
# TODO Cyrillic
# TODO Cyrillic Supplement
# TODO Armenian
# TODO Hebrew
# TODO Arabic
# TODO Syriac
# TODO Arabic Supplement
# TODO Thaana
# TODO NKo
# TODO Samaritan
# TODO Mandaic
# TODO Arabic Extended-A
# TODO Devanagari
# TODO Bengali
# TODO Gurmukhi
# TODO Gujarati
# TODO Oriya
# TODO Tamil
# TODO Telugu
# TODO Kannada
# TODO Malayalam
# TODO Sinhala
# TODO Thai
# TODO Lao
# TODO Tibetan
# TODO Myanmar
# TODO Georgian
# TODO Hangul Jamo
# TODO Ethiopic
# TODO Ethiopic Supplement
# TODO Cherokee
# TODO Unified Canadian Aboriginal Syllabics
# TODO Ogham
# TODO Runic
# TODO Tagalog
# TODO Hanunoo
# TODO Buhid
# TODO Tagbanwa
# TODO Khmer
# TODO Mongolian
# TODO Unified Canadian Aboriginal Syllabics Extended
# TODO Limbu
# TODO Tai Le
# TODO New Tai Lue
# TODO Khmer Symbols
# TODO Buginese
# TODO Tai Tham
# TODO Combining Diacritical Marks Extended
# TODO Balinese
# TODO Sundanese
# TODO Batak
# TODO Lepcha
# TODO Ol Chiki
# TODO Sundanese Supplement
# TODO Vedic Extensions
# TODO Phonetic Extensions
# TODO Phonetic Extensions Supplement
# TODO Combining Diacritical Marks Supplement
# TODO Latin Extended Additional
# TODO Greek Extended

# General Punctuation:
<compose> <space> "_" "." : "\u2000" # en quad
<compose> <space> "_" "_" : "\u2001" # em quad
<compose> <space> "-" "." : "\u2002" # en space
<compose> <space> "-" "-" : "\u2003" # em space
<compose> <space> "3" : "\u2004" # three-per-em space
<compose> <space> "4" : "\u2005" # four-per-em space
<compose> <space> "6" : "\u2006" # six-per-em space
<compose> <space> "f" : "\u2007" # figure space
<compose> <space> "." : "\u2008" # punctuation space
<compose> <space> "t" : "\u2009" # thin space
<compose> <space> "h" : "\u200A" # hairspace
<compose> <space> "0" : "\u200B" # zero width space
<compose> <space> "J" : "\u200C" # zero width non-joiner
<compose> <space> "j" : "\u200D" # zero width joiner
<compose> <space> "l" : "\u200E" # left-to-right mark
<compose> <space> "r" : "\u200F" # right-to-left mark
<compose> "-" <space> : "\u2010" # hyphen
<compose> "-" " " : "\u2011" # non-breaking hyphen
<compose> "-" "-" "f" : "\u2012" # figure dash
<compose> "-" "-" "." : "\u2013" # en dash
<compose> "-" "-" "-" : "\u2014" # em dash
<compose> "-" "-" "_" : "\u2015" # horizontal bar
<compose> "|" "|" : "\u2016" # double verical line
<compose> "-" "_" : "\u2017" # double low line
<compose> ("(" "'") : "‘"
<compose> (")" "'") : "’"
<compose> ("(" ",") : "‚"
<compose> (")" ",") : "‛"
<compose> ("(" "\"") : "“"
<compose> (")" "\"") : "”"
<compose> ("(" ";") : "„"
<compose> (")" ";") : "‟"
<compose> "+" "T" : "†"
<compose> "+" "+" "T" : "‡"
<shift compose> "." "." : "•"
<shift compose> "|" ">" : "‣"
<compose> "." "," : "\u2024" # one dot leader
<compose> "." ";" : "\u2025" # two dot leader
<compose> "." "." : "…"
<compose> "-" "." : "\u2027" # hyphenation point
<compose> "l" <space> : "\u2028" # line separator
<compose> "p" <space> : "\u2029" # paragraph separator
<compose> <space> "e" "l" : "\u202A" # left-to-right embedding
<compose> <space> "e" "r" : "\u202B" # right-to-left embedding
<compose> <space> "e" "p" : "\u202C" # pop directional formatting
<compose> <space> "o" "l" : "\u202D" # left-to-right override
<compose> <space> "o" "r" : "\u202E" # right-to-left override
<compose> "m" " " : "\u202F" # narrow no-break space
<compose> "%" ["o" "."] : "‰"
<compose> "%" ["O" ":"] : "‱"
<compose> ("1" ["'" "´"]) : "′"
<compose> ("2" ["'" "´"]) : "″"
<compose> ("3" ["'" "´"]) : "‴"
<compose> ("1" "`") : "‵"
<compose> ("2" "`") : "‶"
<compose> ("3" "`") : "‷"
<shift compose> ("." "^") : "‸"
<shift compose> ("." "<") : "‹"
<shift compose> ("." ">") : "›"
<compose> ("x" "+") : "※"
<shift compose> "!" "!" : "‼"
<compose> "!" "?" : "‽"
<shift compose> "^" "_" : "‾"
<shift compose> ("_" "u") : "‿"
<shift compose> ("^" "u") : "⁀"
<shift compose> "/" "/" : "⁁"
<compose> "*" "*" : "⁂"
<shift compose> "-" "-" : "⁃"
<compose> "/" "/" : "⁄"
<compose> ("[" "-") : "⁅"
<compose> ("]" "-") : "⁆"
<shift compose> "?" "?" : "⁇"
<shift compose> "?" "!" : "⁈"
<shift compose> "!" "?" : "⁉"
<compose> ("/" "7"): "⁊"
<compose> "¶" "¶" : "⁋"
<compose> ("?" ["p" "P"]) : "⁋"
<compose> "(" "|" : "⁌"
<compose> "|" ")" : "⁍"
<compose> ("*" ".") : "⁎"
<compose> ";" ";" : "⁏"
<shift compose> "(" ")": "⁐"
<compose> ("*" ":") : "⁑"
<compose> "%" "%" : "⁒"
<shift compose> "~" ["-" "~"] : "⁓"
<shift compose> "-" "~" : "⁓"
<sjift compose> ("_" "U") : "⁔"
<compose> ("x" "*") : "⁕"
<compose> "." ":" <space>  : "⁖"
<compose> ("4" ["'" "´"]) : "⁗"
<compose> "." ":" "." : "⁘"
<compose> ":" "." ":" : "⁙"
<compose> "|" "." "." : "⁚"
<shift compose> "." ":" "." : "⁛"
<compose> ("x" ":") : "⁜"
<compose> "|" ":" "." : "⁝"
<compose> "|" ":" ":" : "⁞"
<compose> <space> "m" : "\u205F" # medium mathematical space
<compose> <space> "w" : "\u2060" # word joiner
<shift compose> ("f" " ") : "\u2061" # function application
<shift compose> (["x" "×" "*"] " ") : "\u2062" # invisible times
<shift compose> (["," "."] " ") : "\u2063" # invisible separator
<shift compose> ("+" " ") : "\u2064" # invisible plus
<compose> <space> "i" "l" : "\u2066" # left-to-right isolate
<compose> <space> "i" "r" : "\u2067" # right-to-left isolate
<compose> <space> "i" "s" : "\u2068" # first strong isolate
<compose> <space> "i" "p" : "\u2069" # pop directional isolate
# U+206A through U+206C are deprecated

# Superscripts and Subscripts:
<dead letter ^> "0" : "⁰"
<shift compose> ["^" <dead letter "^">] "i" : "ⁱ"
<dead letter ^> "4" : "⁴"
<dead letter ^> "5" : "⁵"
<dead letter ^> "6" : "⁶"
<dead letter ^> "7" : "⁷"
<dead letter ^> "8" : "⁸"
<dead letter ^> "9" : "⁹"
<dead letter ^> "+" : "⁺"
<dead letter ^> "-" : "⁻"
<dead letter ^> "=" : "⁼"
<dead letter ^> "(" : "⁽"
<dead letter ^> ")" : "⁾"
<shift compose> ["^" <dead letter "^">] "n" : "ⁿ"
dead_ascii("ˇ")
<dead letter ˇ> "0" : "₀"
<dead letter ˇ> "1" : "₁"
<dead letter ˇ> "2" : "₂"
<dead letter ˇ> "3" : "₃"
<dead letter ˇ> "4" : "₄"
<dead letter ˇ> "5" : "₅"
<dead letter ˇ> "6" : "₆"
<dead letter ˇ> "7" : "₇"
<dead letter ˇ> "8" : "₈"
<dead letter ˇ> "9" : "₉"
<dead letter ˇ> "+" : "₊"
<dead letter ˇ> "-" : "₋"
<dead letter ˇ> "=" : "₌"
<dead letter ˇ> "(" : "₍"
<dead letter ˇ> ")" : "₎"
<shift compose> ["ˇ" <dead letter "ˇ">] "a" : "ₐ"
<shift compose> ["ˇ" <dead letter "ˇ">] "e" : "ₑ"
<shift compose> ["ˇ" <dead letter "ˇ">] "o" : "ₒ"
<shift compose> ["ˇ" <dead letter "ˇ">] "x" : "ₓ"
<shift compose> ["ˇ" <dead letter "ˇ">] "ə" : "ₔ"
<shift compose> ["ˇ" <dead letter "ˇ">] "h" : "ₕ"
<shift compose> ["ˇ" <dead letter "ˇ">] "k" : "ₖ"
<shift compose> ["ˇ" <dead letter "ˇ">] "l" : "ₗ"
<shift compose> ["ˇ" <dead letter "ˇ">] "m" : "ₘ"
<shift compose> ["ˇ" <dead letter "ˇ">] "n" : "ₙ"
<shift compose> ["ˇ" <dead letter "ˇ">] "p" : "ₚ"
<shift compose> ["ˇ" <dead letter "ˇ">] "s" : "ₛ"
<shift compose> ["ˇ" <dead letter "ˇ">] "t" : "ₜ"

# TODO Currency Symbols
# TODO Combining Diacritical Marks for Symbols
# TODO Letterlike Symbols
# TODO Number Forms
# TODO Arrows
# TODO Mathematical Operators
# TODO Miscellaneous Technical
# TODO Control Pictures
# TODO Optical Character Recognition

# Enclosed Alphanumerics:
for "1" to "9" as \1
  <compose> "(" "\1" ")"             : "\add(\u2460 \sub(\1 "1"))"
  <compose> "(" " " "\1" [" " .] ")" : "\add(\u2474 \sub(\1 "1"))"
  <compose> "(" "\1" " " ")"         : "\add(\u2474 \sub(\1 "1"))"
  <compose> "\1" "."                 : "\add(\u2488 \sub(\1 "1"))"
end for
for "0" to "9" as \1
  <compose> "(" "1" "\1" ")"             : "\add(\u2469 \sub(\1 "0"))"
  <compose> "(" " " "1" "\1" [" " .] ")" : "\add(\u247D \sub(\1 "0"))"
  <compose> "(" "1" "\1" " " ")"         : "\add(\u247D \sub(\1 "0"))"
  <compose> "1" "\1" "."                 : "\add(\u2491 \sub(\1 "0"))"
end for
<compose> "(" "2" "0" ")"             : "\u2473"
<compose> "(" " " "2" "0" [" " .] ")" : "\u2487"
<compose> "(" "2" "0" " " ")"         : "\u2473"
<compose> "2" "0" "."                 : "\u2498"
for "a" to "z" as \1
  <compose> "(" " " "\1" [" " .] ")" : "\add(\u249C \sub(\1 "a"))"
  <compose> "(" "\1" " " ")"         : "\add(\u249C \sub(\1 "a"))"
end for
for "A" to "Z" as \1
  <compose> "(" "\1" ")" : "\add(\u24B6 \sub(\1 "A"))"
end for
for "a" to "z" as \1
  <compose> "(" "\1" ")" : "\add(\u24D0 \sub(\1 "a"))"
end for
<compose> "(" "0" ")" : "\u24EA"
for "1" to "9" as \1
  <compose> "(" "(" "(" "1" "\1" ")" ")" ")" : "\add(\u24EB \sub(\1 "1"))"
end for
<compose> "(" "(" "(" "2" "0" ")" ")" ")" : "\u24F4"
for "1" to "9" as \1
  <compose> "(" "(" "\1" ")" ")" : "\add(\u24F5 \sub(\1 "1"))"
end for
<compose> "(" "(" "1" "0" ")" ")" : "\u24FE"
<compose> "(" "(" "(" "0" ")" ")" ")" : "\u24FF"

# Box Drawing:
<compose> ("╴" "╶") : "─"
<compose> ("╸" "╺") : "━"
<shift compose> "b" "-" : "─"
<shift compose> "B" "-" : "━"
<shift compose> "b" "|" : "│"
<shift compose> "B" "|" : "┃"
<shift compose> "b" "." "-" : "┄"
<shift compose> "B" "." "-" : "┅"
<compose> "┄" "┄" : "┅"
<shift compose> "b" "." "|" : "┆"
<shift compose> "B" "." "|" : "┇"
<compose> "┆" "┆" : "┇"
<shift compose> "b" ":" "-" : "┈"
<shift compose> "B" ":" "-" : "┉"
<compose> "┈" "┈" : "┉"
<shift compose> "b" ":" "|" : "┊"
<shift compose> "B" ":" "|" : "┋"
<compose> "┊" "┊" : "┋"
macro boxes/2
  let \3 : {
    3 48 12 192      999 999 999 999  999 999 999 999  10 40 130 160
    9 24 129 144     6 36 66 96       5 20 65 80       14 44 74 132
    194 104 164 224  13 28 73 133     193 88 146 208   11 26 41 56
    131 146 161 176  7 22 37 52       67 82 97 112     15 30 45 60
    75 135 195 90    105 150 165 120  180 210 225 240  999 999 999 999
    999 999 999 999  999 999 999 999  999 999 999 999  999 999 999 999
    999 999 999 999  999 999 999 999  999 999 999 999  999 999 999 999
    999 999 999 999  1 4 2 8          16 64 32 128     33 132 18 40
  }
  let \4 : \get(\3 \1)
  let \5 : \get(\3 \2)
  if \or(\equals(\4 999) \equals(\5 999))
    return
  endif
  let \6 : { \and(\4 16) \and(\4 32) \and(\4 64) \and(\4 128) }
  let \7 : { \and(\5 16) \and(\5 32) \and(\5 64) \and(\5 128) }
  let \4 : { \and(\4 1) \and(\4 2) \and(\4 4) \and(\4 8) }
  let \5 : { \and(\5 1) \and(\5 2) \and(\5 4) \and(\5 8) }
  for 0 to 3 as \8
    \set(\4 \8 \add(\rsh(\get(\4 \8) \8) \mul(2 \rsh(\get(\6 \8)))))
    \set(\5 \8 \add(\rsh(\get(\5 \8) \8) \mul(2 \rsh(\get(\7 \8)))))
    \set(\4 \8 \add(\get(\4 \8) \get(\4 \8)))
    if \greater(\get(\4 \8), 2)
      \set(\4, \8, 2)
    endif
  end for
  for 0 to 127 as \5
    let \6 : \get(\3 \5)
    if \equals(\4 999)
      continue
    endif
    let \7 : { \and(\6 16) \and(\6 32) \and(\6 64) \and(\6 128) }
    let \6 : { \and(\6 1) \and(\6 2) \and(\6 4) \and(\6 8) }
    for 0 to 3 as \8
      \set(\6 \8 \add(\rsh(\get(\6 \8) \8) \mul(2 \rsh(\get(\7 \8)))))
    end for
    if \equals(\get(\6 0) \get(\4 0))
      if \equals(\get(\6 1) \get(\4 1))
        if \equals(\get(\6 2) \get(\4 2))
          if \equals(\get(\6 3) \get(\4 3))
            <compose> ("\add(\u2500 \1)" "\add(\u2500 \2)") : "\add(\u2500 \5)"
          end if
        end if
      end if
    end if
  end for
end macro
for 0 to 127 as \1
  for \1 to 127 as \2
    boxes(\1 \2)
  end for
end for
<shift compose> "b" "+" : "┼"
<shift compose> "B" "+" : "╋"
<compose> (["-" "─"] ["|" "│"]) : "┼"
<shift compose> "b" "." "." : "╌"
<shift compose> "B" "." "." : "╍"
<compose> "╌" "╌" : "╍"
<shift compose> "b" "¦" : "╎"
<shift compose> "b" "." ":" : "╎"
<shift compose> "B" "¦" : "╏"
<shift compose> "B" "." ":" : "╏"
<compose> "╎" "╎" : "╏"
<shift compose> "b" "=" "-" : "═"
<compose> ("=" "─") : "═"
<shift compose> "b" "=" "|" : "║"
<compose> ("=" "│") : "║"
<compose> ("+" "┍") : "╒"
<compose> ("+" "┎") : "╓"
<compose> ("+" ["┌" "┏"]) : "╔"
<compose> ("+" "┑") : "╕"
<compose> ("+" "┒") : "╖"
<compose> ("+" ["┐" "┓"]) : "╗"
<compose> ("+" "┕") : "╘"
<compose> ("+" "┖") : "╙"
<compose> ("+" ["└" "┗"]) : "╚"
<compose> ("+" "┙") : "╛"
<compose> ("+" "┚") : "╜"
<compose> ("+" ["┘" "┛"]) : "╝"
<compose> ("+" "┝") : "╞"
<compose> ("+" "┠") : "╟"
<compose> ("+" ["├" "┣"]) : "╠"
<compose> ("+" "┥") : "╡"
<compose> ("+" "┨") : "╢"
<compose> ("+" ["┤" "┫"]) : "╣"
<compose> ("+" "┯") : "╤"
<compose> ("+" "┰") : "╥"
<compose> ("+" ["┬" "┳"]) : "╦"
<compose> ("+" "┷") : "╧"
<compose> ("+" "┸") : "╨"
<compose> ("+" ["┴" "┻"]) : "╩"
<compose> ("+" "┿") : "╪"
<compose> ("+" "╂") : "╫"
<compose> ("+" ["┼" "╋"]) : "╬"
<shift compose> "b" "=" "+" : "╬"
<compose> ("=" "┼") : "╬"
<compose> (["o" "O"] "┌") : "╭"
<compose> (["o" "O"] "┐") : "╮"
<compose> (["o" "O"] "┘") : "╯"
<compose> (["o" "O"] "└") : "╰"
<shift compose> "b" "/" : "╱"
<shift compose> "b" "\" : "╲"
<compose> ("╱" "╲") : "╳"
<shift compose> "b" "X" : "╳"
<shift compose> "b" ["<" "←"] : "╴"
<shift compose> "b" [<dead letter ^> "^" "↑"] : "╵"
<shift compose> "b" [">" "→"] : "╶"
<shift compose> "b" ["v" "," "↓"] : "╷"
<shift compose> "B" ["<" "←"] : "╸"
<shift compose> "B" [<dead letter ^> "^" "↑"] : "╹"
<shift compose> "B" [">" "→"] : "╺"
<shift compose> "B" ["v" "," "↓"] : "╻"

# Block Elements:
<shift compose> "B" <compose> : <dead letter █>
dead_ascii("█")
<dead letter █> "|" : <dead letter ▀>
dead_ascii("▀")
<dead letter ▀> "0" : "▀"
<dead letter ▀> "1" : "▁"
<dead letter ▀> "2" : "▂"
<dead letter ▀> "3" : "▃"
<dead letter ▀> "4" : "▄"
<dead letter ▀> "5" : "▅"
<dead letter ▀> "6" : "▆"
<dead letter ▀> "7" : "▇"
<dead letter █> "-" : <dead letter ▐>
dead_ascii("▐")
<dead letter ▐> "7" : "▉"
<dead letter ▐> "6" : "▊"
<dead letter ▐> "5" : "▋"
<dead letter ▐> "4" : "▌"
<dead letter ▐> "3" : "▍"
<dead letter ▐> "2" : "▎"
<dead letter ▐> "1" : "▏"
<dead letter ▐> "0" : "▐"
<dead letter █> "1" : "░"
<dead letter █> "2" : "▒"
<dead letter █> "3" : "▓"
<dead letter ▀> "-" : "▔"
<dead letter ▐> "|" : "▕"
<dead letter █> "," : "▖"
<dead letter █> "." : "▗"
<dead letter █> ";" : "▘"
<dead letter █> "▝" : "▙"
<compose> "▗" "▘" : "▚"
<dead letter █> "▗" : "▛"
<dead letter █> "▖" : "▜"
<dead letter █> ":" : "▝"
<compose> "▖" "▝" : "▞"
<dead letter █> "▘" : "▟"

# TODO Geometric Shapes
# TODO Miscellaneous Symbols
# TODO Dingbats
# TODO Miscellaneous Mathematical Symbols-A
# TODO Supplemental Arrows-A

# Braille Patterns:
function braille/1
  \or(\lsh(1 \sub("\1" "0")) "\u2800")
end function
macro braille_double/1
  let \2 : "\u2800"
  if \and(\1 1) = 1
    let \2 : \or(\2 8)
  endif
  if \and(\1 2) = 2
    let \2 : \or(\2 16)
  endif
  if \and(\1 4) = 4
    let \2 : \or(\2 32)
  endif
  if \and(\1 8) = 8
    let \2 : \or(\2 1)
  endif
  if \and(\1 16) = 16
    let \2 : \or(\2 2)
  endif
  if \and(\1 32) = 32
    let \2 : \or(\2 4)
  endif
  if \and(\1 64) = 64
    let \2 : \or(\2 128)
  endif
  if \and(\1 128) = 128
    let \2 : \or(\2 64)
  endif
  <compose> "\1" "\1" : "\or(\1 \2)"
end macro
<shift compose> "b" <space> : "\u2800"
for "1" to "8" as \1
  <shift compose> "b" "\1" : "\braille(\1)"
  for \add(\1 1) to "8" as \2
    <shift compose> "B" ("\1" "\2") : "\or(\braille(\1) \braille(\2))"
  end for
end for
for "\u2800" to "\u28FF" as \1
  braille_double(\1)
  for \add(\1 1) to "\u28FF" as \2
    <compose> ("\1" "\2") : "\or(\1 \2)"
  end for
end for

# TODO Supplemental Arrows-B
# TODO Miscellaneous Mathematical Symbols-B
# TODO Supplemental Mathematical Operators
# TODO Miscellaneous Symbols and Arrows
# TODO Glagolitic
# TODO Latin Extended-C
# TODO Coptic
# TODO Georgian Supplement
# TODO Tifinagh
# TODO Ethiopic Extended
# TODO Cyrillic Extended-A
# TODO Supplemental Punctuation
# TODO CJK Radicals Supplement
# TODO Kangxi Radicals
# TODO Ideographic Description Characters
# TODO CJK Symbols and Punctuation
# TODO Hiragana
# TODO Katakana
# TODO Bopomofo
# TODO Hangul Compatibility Jamo
# TODO Kanbun
# TODO Bopomofo Extended
# TODO CJK Strokes
# TODO Katakana Phonetic Extensions
# TODO Enclosed CJK Letters and Months
# TODO CJK Compatibility
# TODO CJK Unified Ideographs Extension A
# TODO Yijing Hexagram Symbols
# TODO CJK Unified Ideographs
# TODO Yi Syllables
# TODO Yi Radicals
# TODO Lisu
# TODO Vai
# TODO Cyrillic Extended-B
# TODO Bamum
# TODO Modifier Tone Letters
# TODO Latin Extended-D
# TODO Syloti Nagri
# TODO Common Indic Number Forms
# TODO Phags-pa
# TODO Saurashtra
# TODO Devanagari Extended
# TODO Kayah Li
# TODO Rejang
# TODO Hangul Jamo Extended-A
# TODO Javanese
# TODO Myanmar Extended-B
# TODO Cham
# TODO Myanmar Extended-A
# TODO Tai Viet
# TODO Meetei Mayek Extensions
# TODO Ethiopic Extended-A
# TODO Latin Extended-E
# TODO Meetei Mayek
# TODO Hangul Syllables
# TODO Hangul Jamo Extended-B
# TODO CJK Compatibility Ideographs
# TODO Alphabetic Presentation Forms
# TODO Arabic Presentation Forms-A
# TODO Variation Selectors
# TODO Vertical Forms
# TODO Combining Half Marks
# TODO CJK Compatibility Forms
# TODO Small Form Variants
# TODO Arabic Presentation Forms-B
# TODO Halfwidth and Fullwidth Forms
# TODO Specials
# TODO Linear B Syllabary
# TODO Linear B Ideograms
# TODO Aegean Numbers
# TODO Ancient Greek Numbers
# TODO Ancient Symbols
# TODO Phaistos Disc
# TODO Lycian
# TODO Carian
# TODO Coptic Epact Numbers
# TODO Old Italic
# TODO Gothic
# TODO Old Permic
# TODO Ugaritic
# TODO Old Persian
# TODO Deseret
# TODO Shavian
# TODO Osmanya
# TODO Elbasan
# TODO Caucasian Albanian
# TODO Linear A
# TODO Cypriot Syllabary
# TODO Imperial Aramaic
# TODO Palmyrene
# TODO Nabataean
# TODO Phoenician
# TODO Lydian
# TODO Meroitic Hieroglyphs
# TODO Meroitic Cursive
# TODO Kharoshthi
# TODO Old South Arabian
# TODO Old North Arabian
# TODO Manichaean
# TODO Avestan
# TODO Inscriptional Parthian
# TODO Psalter Pahlavi
# TODO Old Turkic
# TODO Rumi Numeral Symbols
# TODO Brahmi
# TODO Kaithi
# TODO Sora Sompeng
# TODO Chakma
# TODO Mahajani
# TODO Sharada
# TODO Sinhala Archaic Numbers
# TODO Khojki
# TODO Khudawadi
# TODO Grantha
# TODO Tirhuta
# TODO Siddham
# TODO Modi
# TODO Takri
# TODO Warang Citi
# TODO Pau Cin Hau
# TODO Cuneiform
# TODO Cuneiform Numbers and Punctuation
# TODO Egyptian Hieroglyphs
# TODO Bamum Supplement
# TODO Mro
# TODO Bassa Vah
# TODO Pahawh Hmong
# TODO Miao
# TODO Kana Supplement
# TODO Duployan
# TODO Shorthand Format Controls
# TODO Byzantine Musical Symbols
# TODO Musical Symbols
# TODO Ancient Greek Musical Notation
# TODO Tai Xuan Jing Symbols
# TODO Counting Rod Numerals
# TODO Mathematical Alphanumeric Symbols
# TODO Mende Kikakui
# TODO Arabic Mathematical Alphabetic Symbols
# TODO Mahjong Tiles
# TODO Domino Tiles

# Playing Cards:
<shift compose> "p" "c" : "🂠"
dead_ascii(🂠)
macro playing_card/2
  <compose> (["♠" "♤"] "\1") : "\add(\u1F0A0 \2)"
  <compose> (["♥" "♡"] "\1") : "\add(\u1F0B0 \2)"
  <compose> (["♦" "♢"] "\1") : "\add(\u1F0C0 \2)"
  <compose> (["♣" "♧"] "\1") : "\add(\u1F0D0 \2)"
end macro
for "1" to "9" as \1
  playing_card("\1" \sub(\1 "0") 1)
endfor
playing_card(["a" "A"] 1)
playing_card("0" 10)
playing_card(["j" "J"] 11)
playing_card(["c" "C"] 12)
playing_card(["q" "Q"] 13)
playing_card(["k" "K"] 14)
<compose> "🂠" "j" "r" : "\u1F0BF"
<compose> "🂠" "j" "b" : "\u1F0CF"
<compose> "🂠" "j" "w" : "\u1F0DF"
<compose> "🂠" "0" <space> : "\u1F0E0"
<compose> "🂠" "1" <space> : "\u1F0E1"
<compose> "🂠" "2" <space> : "\u1F0E2"
<compose> "🂠" "3" <space> : "\u1F0E3"
<compose> "🂠" "4" <space> : "\u1F0E4"
<compose> "🂠" "5" <space> : "\u1F0E5"
<compose> "🂠" "6" <space> : "\u1F0E6"
<compose> "🂠" "7" <space> : "\u1F0E7"
<compose> "🂠" "8" <space> : "\u1F0E8"
<compose> "🂠" "9" <space> : "\u1F0E9"
<compose> "🂠" "1" "0" : "\u1F0EA"
<compose> "🂠" "1" "1" : "\u1F0EB"
<compose> "🂠" "1" "2" : "\u1F0EC"
<compose> "🂠" "1" "3" : "\u1F0ED"
<compose> "🂠" "1" "4" : "\u1F0EE"
<compose> "🂠" "1" "5" : "\u1F0EF"
<compose> "🂠" "1" "6" : "\u1F0F0"
<compose> "🂠" "1" "7" : "\u1F0F1"
<compose> "🂠" "1" "8" : "\u1F0F2"
<compose> "🂠" "1" "9" : "\u1F0F3"
<compose> "🂠" "2" "0" : "\u1F0F4"
<compose> "🂠" "2" "1" : "\u1F0F5"

# Enclosed Alphanumeric Supplement:
<compose> "0" "." : "\u1F100"
for "0" to "9" as \1
  <compose> "\1" "," : "\add(\u1F101 \sub(\1 "0")"
end for
<compose> "(" "0" "." ")" : "\u1F10B"
<compose> "(" "(" "(" "0" "." ")" ")" ")" : "\u1F10C"
for "A" to "Z" as \1
  <compose> "(" " " "\1" [" " .] ")" : "\add(\u1F110 \sub(\1 "A"))"
  <compose> "(" "\1" " " ")"         : "\add(\u1F110 \sub(\1 "A"))"
end for
<compose> "[" " " "S" [" " .] "]" : "\u1F12A"
<compose> "[" "S" " " "]"         : "\u1F12A"
<compose> "(" "/" "C" ["/" .] ")" : "\u1F12B"
<compose> "(" "C" "/" ")"         : "\u1F12B"
<compose> "(" "/" "R" ["/" .] ")" : "\u1F12C"
<compose> "(" "R" "/" ")"         : "\u1F12C"
<compose> "(" "C" "D" ")"         : "\u1F12D"
<compose> "(" "W" "z" ")"         : "\u1F12E"
for "A" to "Z" as \1
  <compose> "[" "\1" "]"                 : "\add(\u1F130 \sub(\1 "A"))"
  <compose> "(" "(" "(" "\1" ")" ")" ")" : "\add(\u1F160 \sub(\1 "A"))"
  <compose> "[" "[" "[" "\1" "]" "]" "]" : "\add(\u1F170 \sub(\1 "A"))"
end for
<compose> "[" "H" "V" "]" : "\u1F14A"
<compose> "[" "M" "V" "]" : "\u1F14B"
<compose> "[" "S" "D" "]" : "\u1F14C"
<compose> "[" "S" "S" "]" : "\u1F14D"
<compose> "[" "P" "P" "V" "]" : "\u1F14E"
<compose> "[" "W" "C" "]" : "\u1F14F"
<compose> "(" "M" "C" ")" : "\u1F16A"
<compose> "(" "M" "D" ")" : "\u1F16B"
<compose> "[" "[" "[" "X" "P" "]" "]" "]" : "\u1F18A"
<compose> "[" "[" "[" "I" "C" "]" "]" "]" : "\u1F18B"
<compose> "[" "[" "[" "P" "A" "]" "]" "]" : "\u1F18C"
<compose> "[" "[" "[" "S" "A" "]" "]" "]" : "\u1F18D"
<compose> "[" "[" "[" "A" "B" "]" "]" "]" : "\u1F18E"
<compose> "[" "[" "[" "W" "C" "]" "]" "]" : "\u1F18F"
<compose> "[" "D" "J" "]" : "\u1F190"
<compose> "[" "C" "L" "]" : "\u1F191"
<compose> "[" "C" "O" "O" "L" "]" : "\u1F192"
<compose> "[" "F" "R" "E" "E" "]" : "\u1F193"
<compose> "[" "I" "D" "]" : "\u1F194"
<compose> "[" "N" "E" "W" "]" : "\u1F195"
<compose> "[" "N" "G" "]" : "\u1F196"
<compose> "[" "O" "K" "]" : "\u1F197"
<compose> "[" "S" "O" "S" "]" : "\u1F198"
<compose> "[" "U" "P" "]" : "\u1F199
<compose> "[" "U" "P" "!" "]" : "\u1F199
<compose> "[" "V" "S" "]" : "\u1F19A
for "a" to "z" as \1
  <compose> "[" "r" "\1" "]" : "\add(\u1F1E6 \sub(\1 "a"))"
end for

# TODO Enclosed Ideographic Supplement
# TODO Miscellaneous Symbols and Pictographs
# TODO Emoticons
# TODO Ornamental Dingbats
# TODO Transport and Map Symbols
# TODO Alchemical Symbols
# TODO Geometric Shapes Extended
# TODO Supplemental Arrows-C
# TODO CJK Unified Ideographs Extension B
# TODO CJK Unified Ideographs Extension C
# TODO CJK Unified Ideographs Extension D
# TODO CJK Compatibility Ideographs Supplement

# Tags: These are deprecated

# TODO Variation Selectors Supplement