reword the tutorial after dropping 'grapheme'
This commit is contained in:
parent
d253a31828
commit
b72aed920b
|
@ -550,10 +550,11 @@ fn main screen: (addr screen), keyboard: (addr keyboard) {
|
||||||
|
|
||||||
`read-line-from-keyboard` reads keystrokes from the keyboard until you press
|
`read-line-from-keyboard` reads keystrokes from the keyboard until you press
|
||||||
the `Enter` (also called `newline`) key, and accumulates them into a _stream_
|
the `Enter` (also called `newline`) key, and accumulates them into a _stream_
|
||||||
of bytes. The loop then repeatedly reads _code-point-utf8s_ from the stream. A
|
of bytes. The loop then repeatedly reads _code points_ from the stream, and
|
||||||
code-point-utf8 can consist of multiple bytes, particularly outside of the Latin
|
these code points are encoded in a special encoding of Unicode called UTF-8.
|
||||||
alphabet and Arabic digits most prevalent in the West. Mu doesn't yet support
|
Mu doesn't yet support non-Qwerty keyboards, but support for keyboards in
|
||||||
non-Qwerty keyboards, but support for other keyboards should be easy to add.
|
other parts of the world should be easy to add thanks to our support for
|
||||||
|
UTF-8.
|
||||||
|
|
||||||
This is a good time to skim the section in the Mu reference on
|
This is a good time to skim the section in the Mu reference on
|
||||||
[streams](https://github.com/akkartik/mu/blob/main/mu.md#streams), just to
|
[streams](https://github.com/akkartik/mu/blob/main/mu.md#streams), just to
|
||||||
|
@ -561,14 +562,14 @@ give yourself a sense of what you can do with them. Does the above program
|
||||||
make sense now? Feel free to experiment to make sense of it.
|
make sense now? Feel free to experiment to make sense of it.
|
||||||
|
|
||||||
Can you modify it to print out the line a second time, after you've typed it
|
Can you modify it to print out the line a second time, after you've typed it
|
||||||
out until the `Enter` key? Can you print a space after every code-point-utf8 when you
|
out until the `Enter` key? Can you print a space after every code point when
|
||||||
print the line out a second time? You'll need to skim the section on
|
you print the line out a second time? You'll need to skim the section on
|
||||||
[printing to screen](https://github.com/akkartik/mu/blob/main/vocabulary.md#printing-to-screen)
|
[printing to screen](https://github.com/akkartik/mu/blob/main/vocabulary.md#printing-to-screen)
|
||||||
from Mu's vocabulary. Pay particular attention to the difference between a
|
from Mu's vocabulary. One common pattern: Mu programs read characters in
|
||||||
code-point-utf8 and a _code-point_. Mu programs often read characters in units of
|
UTF-8, but print raw `code-point`s. Use `to-code-point` to decode UTF-8 and
|
||||||
code-point-utf8s, but they must draw in units of code-points that the font manages.
|
get at the underlying raw `code-point`, and use `to-utf8` to encode a
|
||||||
(This adds some complexity but helps combine multiple code-points into a
|
`code-point` into a `code-point-utf8`. (This stuff is still under
|
||||||
single glyph as needed for some languages.)
|
construction; I hope to simplify it over time.)
|
||||||
|
|
||||||
## Task 15: generating cool patterns
|
## Task 15: generating cool patterns
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue