robhagemans / monobit

Tools for working with monochrome bitmap fonts
MIT License
208 stars 11 forks source link

YAFF format support for multiple codepages #28

Open ace-dent opened 1 year ago

ace-dent commented 1 year ago

I would like to store a canonical version of a font in the YAFF format, that supports multiple codepages. i.e. rather than making multiple copies for each different codepages (CP886, CP1251, etc...), I want a single font file that contains the remapping info (since the glyph bitmaps won't change). Is this possible? Currently it only seems possible to embed 2 encodings per YAFF (Unicode and encoding:).

I'm thinking an extension to the existing character label, to allow per character encoding to specified...? e.g.

0x41:
latin_a:
+cp437: 0x12
+1251: 0x44
    ....
    .@..
    @.@.
    @@@.
    @.@.
    @.@.
robhagemans commented 1 year ago

Yes, this is a use case I've been thinking about. I'll likely add something to the spec and implementation at some point to support this. It may be a while though as currently I have no time to develop this.

It'll likely take the form of an extended label syntax where it will be possible to define codepage labels in a way analogous to how (Unicode) character labels are currently defined, e.g. in your example this could become:

0x41:
latin_a:
u+0041:
cp437+12:
cp1251+44:
    ....
    .@..
    @.@.
    @@@.
    @.@.
    @.@.

This would not work in the current version however, as the + symbol would make this (intentionally) an invalid label.