about summary refs log tree commit diff stats
path: root/apps
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2021-09-02 15:38:45 -0700
committerKartik K. Agaram <vc@akkartik.com>2021-09-02 15:38:45 -0700
commit60a50c92456fed87c4eaceee7a4649098238a2eb (patch)
tree4b388ddfdd0d901a07db0fce7f4880560ea96cde /apps
parent3f953ea5c861706f4996e9d4a9133d3806ad7a93 (diff)
downloadmu-60a50c92456fed87c4eaceee7a4649098238a2eb.tar.gz
support combining characters in streams of text
Fake screens can't handle them yet.
Diffstat (limited to 'apps')
-rw-r--r--apps/ex15.mu55
1 files changed, 55 insertions, 0 deletions
diff --git a/apps/ex15.mu b/apps/ex15.mu
index 991b7f08..3f0d32bc 100644
--- a/apps/ex15.mu
+++ b/apps/ex15.mu
@@ -77,4 +77,59 @@ fn main screen: (addr screen), keyboard: (addr keyboard), data-disk: (addr disk)
   # kaha
   var dummy/eax: int <- draw-code-point-on-real-screen 0x0915/devanagari-letter-ka, 0x13/x 9/y, 3/fg 0/bg
   var dummy/eax: int <- overlay-code-point-on-real-screen 0x0903/devanagari-visarga, 0x13/x 9/y, 3/fg 0/bg
+
+  # render the same letters as a single stream of utf-8 graphemes rather than individual code-points.
+  var text-storage: (stream byte 0x200)
+  var text/esi: (addr stream byte) <- address text-storage
+  var g/eax: grapheme <- to-grapheme 0x0915/devanagari-letter-ka
+  var ka/ecx: grapheme <- copy g
+  # ka
+  write-grapheme text, ka
+  # kaa
+  write-grapheme text, ka
+  g <- to-grapheme 0x093e/devanagari-vowel-aa
+  write-grapheme text, g
+  # ki
+  write-grapheme text, ka
+  g <- to-grapheme 0x093f/devanagari-vowel-i
+  write-grapheme text, g
+  # kee
+  write-grapheme text, ka
+  g <- to-grapheme 0x0940/devanagari-vowel-ii
+  write-grapheme text, g
+  # ku
+  write-grapheme text, ka
+  g <- to-grapheme 0x0941/devanagari-vowel-u
+  write-grapheme text, g
+  # koo
+  write-grapheme text, ka
+  g <- to-grapheme 0x0942/devanagari-vowel-oo
+  write-grapheme text, g
+  # kay
+  write-grapheme text, ka
+  g <- to-grapheme 0x0947/devanagari-vowel-E
+  write-grapheme text, g
+  # kai
+  write-grapheme text, ka
+  g <- to-grapheme 0x0948/devanagari-vowel-ai
+  write-grapheme text, g
+  # ko
+  write-grapheme text, ka
+  g <- to-grapheme 0x094b/devanagari-vowel-o
+  write-grapheme text, g
+  # kow
+  write-grapheme text, ka
+  g <- to-grapheme 0x094f/devanagari-vowel-aw
+  write-grapheme text, g
+  # kan
+  write-grapheme text, ka
+  g <- to-grapheme 0x0902/devanagari-anusvara
+  write-grapheme text, g
+  # kaha
+  write-grapheme text, ka
+  g <- to-grapheme 0x0903/devanagari-visarga
+  write-grapheme text, g
+  # render everything
+  set-cursor-position screen, 4/x 0xe/y
+  draw-stream-wrapping-right-then-down-from-cursor-over-full-screen screen, text, 3/fg 0/bg
 }