Log In  

Cart #sitelenpona-1 | 2021-02-15 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
14

Continuing my topic of custom fonts, here's one that replaces almost every character in the later half of the character set (which is usually taken by patterns, hiragana and katakana) with the 120 official characters of the "sitelen pona" writing system for the minimalist conlang "toki pona".

Here's the charts of characters:

Changelog:

Version 1.1 (current):

  • slight adjustments to some characters, an easier-to-understand "moli"

Version 1.0:


Cart #sitelenpona-0 | 2021-02-15 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
14


  • initial version
P#87666 2021-02-15 09:01 ( Edited 2021-02-17 10:52)

Hi! Can I ask how you generate the hex literals for poke4?

I am using poke in my font tool (wip), because it takes variable arguments so only one call needed to define many or all glyphs. I haven’t compared the sizes (token, chars, compressed) between poke+numbers and poke4+hex yet.

P#87674 2021-02-15 15:44

So, the characters are basically 8x8 monochrome bitmaps, where each byte represents one row and each bit represents one pixel.

poke4() accepts four bytes in little-endian format, and PICO-8 has 32-bit fixed point numbers with 16 bits in the integer part and 16 bits in the fractional part.

so, for example, doing poke4(0xddcc.bbaa) writes aa to the fkrst byte, bb to the second, cc to the third and dd to the fourth. There are 8 bytes per character, so two 32-bit values are needed for each character. In each byte, bits go from lowest to highest and from left to right (so 1 is the leftmost pixel, 2 is the one after that, and so on...)

Here's a little illustration to show how it would work.

Of course, the zeroes can be omitted just like in a real hexadecimal number (so 0x003F.0000 can become 0x3F and 0x0000.0012 can become 0x.0012 and stuff like that).

P#87675 2021-02-15 16:15 ( Edited 2021-02-15 16:31)

Nice explanation! My question was not about the bitmap or how poke4 works, but really how to fit 4 bytes into one number. I’m not good with bit operations! Is it just: left shift by 4 for the 4th byte (dd in your example), etc, and right shift to get a byte into the decimal part?

P#87682 2021-02-15 18:34

I'd say it's best to have pre-written numbers, rather than bit-shifting them in code, at least because that saves on operations (reminder that PICO-8 has every operation cost fake CPU time, and if it goes over 100%, the game lags or drops frames).

But yes, you bit shift left by 8 for the 4th byte, do nothing for the 3rd, shift right by 8 for the 2nd and shift right by 16 for the first.

P#87683 2021-02-15 18:49

The point is to write code that generates these pre-written numbers!

Thank you for the reply! I’ll put something in my tool to compare the techniques.

P#87684 2021-02-15 19:19

In the end, my tool creates the font and a string, so that you can see the result directly and copy the text. So instead of shifting bits I printed the result of peek4!

P#87732 2021-02-16 05:33

Is there any chance you could port this to the new custom font system? It would make it much easier to use.

P#88527 2021-03-04 13:14
1

It's already using the new custom font system, as does my Russian font. I specifically made them for the custom font system.

P#88528 2021-03-04 13:23

Oh, really? Yeah, I see that now. Sorry! Great job, btw. This post is what got me into Toki Pona in the first place.
EDIT: Maybe you could add the symbols for some of the unofficial words like "tonsi"?

P#88529 2021-03-04 13:37 ( Edited 2021-03-04 13:38)

In the current setup, there's only 128 spaces for "wide" characters. 120 of them are taken by word characters, 6 by possible buttons and 2 by the basic patterns.

If you need, I can make you a custom version where these 8 are replaced with symbols for unofficial words, but there are a lot of unofficial words, you'd need to pick which ones.

It is alternatively possible to make a font that only has wide sitelen pona characters, but that would mean you'd need to disable the custom font and reenable it whenever you need to type Latin characters.

P#88533 2021-03-04 13:50

I see. As a beginning, I was under the impression that there about 6 words which had become almost standard, but I'm no authority on the subject. I mean, this is really cool regardless, so I don't think you need to add to it (especially if it would be trouble).

P#88534 2021-03-04 14:03

[Please log in to post a comment]

Follow Lexaloffle:          
Generated 2024-03-29 08:18:58 | 0.013s | Q:29