Log In  

CharSet Editor for Pico 8

Download

github.com - CharsetEditor_Pico8

Short manual

A simple tool to create fonts for the virtual console pico8.

Left click on the charset to edit this char. Right click will copy the current char to this position.

Left click on the char will set a dot, right click will delete it. With the cursor keys you can shift the current char. "Set Default" will reset the current charater to the default.

"Lo Width" are for chars with a code <= 127, "Hi Width" for code >=128.

With "Copy" and "Paste" you can copy the complete Charset to the clipboard as a string embeded in [[ ]]. Don't indent the string, it could change the font! In pico 8 you need the following code to transfer the string to the memory:

    function str2mem(data)
        local t,a,i,c,d,str,m = split(data)
        for a = 1,#t,2 do  
            m,str,i=t[a],t[a+1],1
            while i <= #str do
                c,d= ord(str,i,2)
                i+=c==255 and 2 or 1
                if (c>16) poke(m, c==255 and d or c^^0x80) m+=1
            end
        end
    end

    myfont = [[0x5600,
    --some funny chars
    ]]

    str2mem(myfont)

With "Load" and "Save" you can load/save the current font as ascii-file with the extension ".lua". It is the same format as the clipboard routines.

About the string format

A Font is too big for a string in "", but enclose it with [[]] has the disadvantage that escape-sequenzes are not possible. Also chars lower 16 are not printable.

Chars lower than code 16 must be encode in a special form. Also some special characters like "[]," must be encoded to prevent conflicts.

Because chars lower than code 16 are very common (especially code zero), I first flip the high-bit of the char (m = char ^^ 0x80). If m is now lower 16 or one of the special characters, I store the in the string a sequenz of "chr(0xff)..chr(m ^^ 0x80)" otherwise a simple "chr(m)".

Example code

load #customfont_example-0

Cart #customfont_example-0 | 2021-09-26 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
7

P#97849 2021-09-26 11:12 ( Edited 2021-09-26 11:16)

@GPI I don't know if you're still working on this, but I prefer your tool over using the Pico-8 built-in stuff because I like being able to see the entire font all at once.

Feature request: selected char can be cleared by pressing "delete" on the keyboard

Feature request: hold "shift" to select multiple characters for mass deletion (personally, I don't need any double-wide chars and I'm packing multiple fonts into a small amount of cartridge space)

P#107302 2022-02-20 05:32

@ChristopherD
I plan to rewrite my tools - but this time I want to use lua instead of pure basic.
My problem in the moment is, that lua by default doesn't support any GUI, so at the moment I translate SDL (and some other suff, like a file select) for a modified lua-version.
But this take some time...

P#107830 2022-02-28 17:57

@GPI No worries. Hope the project goes well for you.

P#107849 2022-02-28 23:01

A very nice tool!

P#114814 2022-07-25 17:05
P#114827 2022-07-25 19:39

@ChristopherD
I released the first beta of my new editor
https://www.lexaloffle.com/bbs/?tid=49307
And you can there mark more than one char and press delete to remove it :)

P#117279 2022-09-12 16:01

[Please log in to post a comment]

Follow Lexaloffle:          
Generated 2024-03-29 13:50:35 | 0.038s | Q:25