Picowide, a function-based font.
"Picowide", as the name suggest, is nothing more but the classic pico8 font, but wider on the left side.
This gives it eye-catching characteristic, as its based on the original but with an extra twist; familiar but new.
"Picowide" is printed exclusively through code, explained step by step in the code. Its not "a custom font".
The following gif is an example of how the font is used (At the start, with "play" and "credits", on the score-top right and on the time-bottom left)
The "Picowide" code has been published under the creative commons license "CC4-BY-NC-SA".
Hi @LokiStriker. Now that I see what you are doing here I think it can be done in considerably less code, a single function, and using a faster method that anyone can adopt:
-- picowide by lokistriker -- new function dw817 (02-08-23) cls() function _init() tr4("pack my box with five",0,60) tr4("dozen liquor jugs.",0,66) end function _update() end -- 49-tokens or 110-chars. function tr4(t,x,y)local p,d,c=print,clip for i=1,#t do c=sub(t,i,i)d(x,y,2,5)p(c,x,y)d()p(c,x+1,y)x+=5end end |
This is great!
I was sure there would be better ways to do it, but I wasn't sure which ways those could be. Im not only relatively new to Pico, but also new to Lua.
But I'm glad you did it!
It's genius what you figured out though, @LokiStriker. I had never considered the 3x5 could convert to 4x5. If you print direct like for letter W or M you get a solid block.
No, you must truncate the first portion of the PRINT.
Excellent work here, gold star. You may yet see your unique ability to create this beautiful extended font in other people's work over time ...
@dw817 I truly hope so! The reason why even posted this was so people could get a hold of it and use it, so I'll be excited to see it!
have you thought about converting this nice font to the new built-in custom font system?
@merwok, would you like to try ? That would be an interesting experiment. To see how minimal the code would be to inject this font into the custom font memory versus 110-characters.
Hi @LokiStriker:
I updated the function. Now you can have color:
tr4 ( string , x , y , {color} ) |
It takes just one more token.
If you don't use color however, it will use the default color, just like PRINT(t,x,y).
-- picowide by lokistriker -- new function dw817 (02-09-23) cls() function _init() tr4("pack my box with five",11,54) tr4("dozen liquor jugs.",19,74) end function _update() end -- 50-tokens or 116-chars. function tr4(t,x,y,...)local p,d,a=print,clip for i=1,#t do a=t[i]d(x,y,2,5)p(a,x,y,...)d()p(a,x+1,y,...)x+=5end end |
I do have an incomplete tool to convert PNG to font code, and need to find time to complete it. but we don’t need to convert the font to know how minimal the code would be: a custom font takes 7 [edit: 2!] tokens, hundreds of characters, and zero function to use the font!
@dw817 Defaulting to the last color like print does seems pretty optimal! And it being optional means its one less token per call after the first! (if I understand the process correctly)
@merwok Im sure people would prefer custom font to the function version. For my part, I like the option of having Picowide for titles and such, but long texts being on regular pico font. That being said, my specifications are not everyones. More options are always better!
Hi @LokiStriker.
If PRINT is the problem, you can certainly reroute the command thus. You are not limited to a custom name.
-- simple reroute print() function _init() cls() print3=print print=print2 ?"pack my box",0,55 ?"with five dozen" ?"liquor jugs." end function _update() end function print2(t,...) print3("\^w"..t,...) end |
@dw817 a little out of my scope of understanding but I see the idea of re-routing functions. Would this allow you to print with a custom font as well as with pico's default font?
Hi @LokiStriker:
As this is truly just PRINT, yes, you could print a custom font or Pico-8's own default font if you choose.
All I did in the example above is add \^w
to the beginning of any text which means anytime you use the PRINT or ?
command, the text printed will be double wide. As for the x-position, y-position, and color, those are all default to PRINT via ...
To develop a custom font that appears with normal PRINT, you can certainly look at the tool I wrote for this HERE:
> I like the option of having Picowide for titles and such, but long texts being on regular pico font.
sure, that’s provided for! print only uses your custom font when you add a control code to instruct it to, and always has access to the default font. it really is the easiest way to have custom fonts.
Wow! That's awesome!
I guess the code-base version would only matter if you are already occupying the memory space assigned to the custom font (which, I mean, I cant see why I would need 3 font, but I guess that an option)
Otherwise, I guess one might look into the char-count of each and evaluating which one you can afford, be it either the chars or the tokens. Not sure how many chars a custom font usually asks for...
[Please log in to post a comment]