AlexClay [Lexaloffle Blog Feed]https://www.lexaloffle.com/bbs/?uid=30131 Arabic Text - ArSpr <p> <table><tr><td> <a href="/bbs/?pid=66908#p"> <img src="/bbs/thumbs/pico8_ar_spr-0.png" style="height:256px"></a> </td><td width=10></td><td valign=top> <a href="/bbs/?pid=66908#p"> ArSpr</a><br><br> by <a href="/bbs/?uid=30131"> AlexClay</a> <br><br><br> <a href="/bbs/?pid=66908#p"> [Click to Play]</a> </td></tr></table> </p> <p>ArSpr is a set of 2 utility functions that let&rsquo;s you write Arabic text in Pico8. You input a Latin text and it will transliterate it to Arabic. I made it because I want to make localized Pico8 games, and to practice writing my own implementation for Right-to-Left text and Arabic Shaping.</p> <p>ArSpr&rsquo;s specifications:</p> <div> <div class=scrollable_with_touch style="width:100%; max-width:800px; overflow:auto; margin-bottom:12px"> <table style="width:100%" cellspacing=0 cellpadding=0> <tr><td background=/gfx/code_bg1.png width=16><div style="width:16px;display:block"></div></td> <td background=/gfx/code_bg0.png> <div style="font-family : courier; color: #000000; display:absolute; padding-left:10px; padding-top:4px; padding-bottom:4px; "> <pre>2 sprites 510 out of 8192 tokens ~30% of compressed space No dropped frames when filling the screen</pre></div></td> <td background=/gfx/code_bg1.png width=16><div style="width:16px;display:block"></div></td> </tr></table></div></div> <img style="margin-bottom:16px" border=0 src="https://www.lexaloffle.com/bbs/files/30131/arabicnocompress3_30.png" alt="" /> <p>Usage is easy, but slightly different from the regular Print() function in Pico8; you have to initialize a variable to contain the text data then draw it. Here&rsquo;s an example:</p> <div> <div class=scrollable_with_touch style="width:100%; max-width:800px; overflow:auto; margin-bottom:12px"> <table style="width:100%" cellspacing=0 cellpadding=0> <tr><td background=/gfx/code_bg1.png width=16><div style="width:16px;display:block"></div></td> <td background=/gfx/code_bg0.png> <div style="font-family : courier; color: #000000; display:absolute; padding-left:10px; padding-top:4px; padding-bottom:4px; "> <pre>function _init() text1=create_ar_spr([string]) end function _draw() cls() draw_ar(text1, [x], [y]) end</pre></div></td> <td background=/gfx/code_bg1.png width=16><div style="width:16px;display:block"></div></td> </tr></table></div></div> <p>You can read how the font is encoded in <a href="https://habibtac.com/en/2019/08/24/write-arabic-text-in-pico8-arspr/">this blogpost</a>.</p> <p>This project was inspired by <a href="https://www.lexaloffle.com/bbs/?tid=3059">TinyText</a> which uses a similar method, but my cart is written from scratch and has an Arabic Shaper that's not in TinyText.</p> https://www.lexaloffle.com/bbs/?tid=35164 https://www.lexaloffle.com/bbs/?tid=35164 Sat, 24 Aug 2019 09:33:34 UTC