Log In  

Cart #picowide_loki-0 | 2023-02-05 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
7

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".

P#125387 2023-02-06 00:22 ( Edited 2023-02-06 00:23)

3

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:

Cart #manimigafa-0 | 2023-02-09 | Code ▽ | Embed ▽ | No License
3

-- 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
P#125555 2023-02-09 00:59 ( Edited 2023-02-09 01:06)

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!

P#125560 2023-02-09 02:52
1

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 ...

P#125561 2023-02-09 04:15 ( Edited 2023-02-09 07:14)

@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!

P#125566 2023-02-09 05:17

have you thought about converting this nice font to the new built-in custom font system?

P#125592 2023-02-09 16:10

@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.

P#125600 2023-02-09 18:42
2

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).

Cart #benurokare-0 | 2023-02-09 | Code ▽ | Embed ▽ | No License

-- 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
P#125602 2023-02-09 19:07

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!

P#125619 2023-02-09 21:41 ( Edited 2023-10-27 02:44)

@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!

P#125623 2023-02-09 22:31
1

Hi @LokiStriker.

If PRINT is the problem, you can certainly reroute the command thus. You are not limited to a custom name.

Cart #nukohimuro-0 | 2023-02-10 | Code ▽ | Embed ▽ | No License
1

-- 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
P#125625 2023-02-10 00:20

@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?

P#125626 2023-02-10 00:35

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:

https://www.lexaloffle.com/bbs/?pid=119185

P#125647 2023-02-10 02:17

> 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.

P#125650 2023-02-10 02:23

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...

P#125652 2023-02-10 02:35

[Please log in to post a comment]

Follow Lexaloffle:          
Generated 2024-03-03 16:09:31 | 0.052s | Q:42