Compare commits

...

2 commits

Author SHA1 Message Date
24fd8beaa2
Get concept of article on paper
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
2024-05-05 22:40:29 -04:00
647aceb51d
Get concept of article on paper 2024-05-05 22:36:52 -04:00

25
src/font_rendering.dj Normal file
View file

@ -0,0 +1,25 @@
`attrubutes`{published="2024-05-05 11:05"}
# The Suprisingly Complex Process of Drawing Text
Converting strings to pixels on your screen is one of the most complex operations in computer science. Don't believe me? In this article, I'll dive into the full process of text rendering from start to paint.
## Step 1: Unicode
For those who don't know, Unicode is how computers convert bytes in memory, to actual letters. For example, the number `97` in Unicode is the letter `a`. Unicode supports more than just the letters A-Z though. In fact, there are around 149,000 characters in the Unicode standard. This includes every letter from nearly every language in human history, emojis, box drawing characters, various markup characters like bullet points, formatting instructions for hardware like typewriters and teletypes, and more stuff like the angzarr ([which no one even knows the meaning of](https://www.youtube.com/watch?v=cCoed5Oo_J4))
TL;DR, there are _*a lot*_ of characters in Unicode, and a lot of them aren't even that (things like emojis). We'll call them "code-points" in this article[^twilio].
The standard that _everyone_ uses (except for JavaScript and Windows), is UTF-8. Which assigns each letter 8 or more bits. But if each character can only be 8 bits, how can there be so many?
That's because "UTF-8 is a 'variable-width' encoding standard."[^twilio]. That means that if needed, a given code-point can extend past it's 8 bit boundary and become 16, or even 32 bits.
### TODO: Replace this image
![An image of an example UTF-8 character and it's encoded bits](https://www.twilio.com/_next/image?url=https%3A%2F%2Fdocs-assets.prod.twilio.com%2F92975df5f0ebb97c1e1746c11bd3a95eff45fe654d08410e79cabb99059a5dcc.png&w=640&q=75)[^twilio]
Works Cited
[^twilio]: "What is UTF-8?" _Twilio Docs_, Twilio, [www.twilio.com/docs/glossary/what-utf-8](https://www.twilio.com/docs/glossary/what-utf-8). Accessed 6 May 2024.