James-E-A / pyPSF

Python library for parsing PC Screen Fonts (PSF1 and PSF2)
1 stars 0 forks source link

psf2dir: select how output glyphs will be named #1

Open James-E-A opened 6 years ago

James-E-A commented 6 years ago

Right now, we're using the IBM variant of CP437 to describe the lower 256 characters, which is good and sane for

But seems to be disagreeing with even some of the included ones on Debian

So perhaps we should standardize the format-string and just let users put their own in

James-E-A commented 6 years ago

:thinking: 32b4861bee7fe99a30507527bea61360ba3e2b61

**********************************************************************
*                                                                    *  
*  IBM's internal systems must only be used for conducting IBM's     *
*  business or for purposes authorized by IBM management.            *
*                                                                    *
*  Use is subject to audit at any time by IBM management.            *
*                                                                    *   
*  Important  Please read                                            * 
*                                                                    *
*  Machine Code updates provided through this site are available     *
*  only for IBM machines that are under warranty or an IBM hardware  * 
*  maintenance service agreement Code for operating systems or other *
*  software products is available only where entitled under the      * 
*  applicable software warranty or IBM software maintenance          * 
*  agreement. All code (including Machine Code updates, samples,     * 
*  fixes or other software downloads)provided through this site      *  
*  is subject to the terms of the license agreements which           *
*  govern the use of the associated code. Some exceptions may        *  
*  apply.IBM reserves the right to change, modify or withdraw its    * 
*  offerings,policies and practices at any time.                     * 
**********************************************************************

Might be worth including this as a TXT or something

also:

Copyright IBM Corporation 1984

>literally ©1984
>on less than 100 English words
>that are basic public information anyway
wew lads

James-E-A commented 6 years ago

Right now, we're using [the IBM variant of CP437](ftp://ftp.software.ibm.com/software/globalization/gcoc/attachments/CP00437.txt)…

THANKS GITHUB

tl;dr: it's exactly like The Unicode Consortium's CP437, except uses the old-school "BIOS emoji" (represented here by closest Unicode approximations, split into 16 cols):

 ☺☻♥♦♣♠•◘○◙♂♀♪♬✺
►◄↕‼¶§▬↨↑↓→←∟↔▲▼

for codepoints 1–31 instead of the (ASCII?) control characters provided by "Shawn Steele" from Microsoft

James-E-A commented 6 years ago

Thought: for things with a unicode table, would it be reasonable to use the first listed unicode character for each glyph to provide the name?

James-E-A commented 6 years ago

Something like psf2dir --names=(none|cp437|unicode437|table|tableall)

Dunno what kind of algorithm an "Auto" setting would use, probably something like:

if has_unicode_table:
    #Has a unicode table
    return "table"
elif nglyphs<=256:
    #Has NO unicode table,
    #AND has only singlebyte-addressable glyphs
    return "cp437"
else:
    #NO unicode table,
    #BUT has multibyte-addressable glyphs
    return "unicode437"
James-E-A commented 6 years ago

As long as we enforce the 0x([0-9A-Fa-f]+).*\.png (idk if this regex is 100% kosher but you get the idea) in any case it should always be absolutely trivial to re​constitute directories, so we can focus all the efforts on just not breaking that as we pack as much convenience as possible into the naming of the files.

(Rearranging glyphs in any way based on the filenames is probably far out of the scope of this project.)

James-E-A commented 6 years ago

Unicode437: As "Unicode", with the exception of glyphs below U+0030, which are named as IBM CP437 characters

Looks good; this should be the default

ĀāĂ㥹ĆćĈĉĊċČčĎď
ĐđĒēĔĕĖėĘęĚěĜĝĞğ
ĠġĢģĤĥĦħĨĩĪīĬĭĮį
İıIJijĴĵĶķĸĹĺĻļĽľĿ
ŀŁłŃńŅņŇňʼnŊŋŌōŎŏ
ŐőŒœŔŕŖŗŘřŚśŜŝŞş
ŠšŢţŤťŦŧŨũŪūŬŭŮů
ŰűŲųŴŵŶŷŸŹźŻżŽžſ
ƀƁƂƃƄƅƆƇƈƉƊƋƌƍƎƏ
ƐƑƒƓƔƕƖƗƘƙƚƛƜƝƞƟ
ƠơƢƣƤƥƦƧƨƩƪƫƬƭƮƯ
ưƱƲƳƴƵƶƷƸƹƺƻƼƽƾƿ
ǀǁǂǃDŽDždžLJLjljNJNjnjǍǎǏ
ǐǑǒǓǔǕǖǗǘǙǚǛǜǝǞǟ
ǠǡǢǣǤǥǦǧǨǩǪǫǬǭǮǯ
ǰDZDzdzǴǵǶǷǸǹǺǻǼǽǾǿ

I would say let's quickly compare it visually against the default fonts included in like Debian or something, but all 298 of the files in my /usr/share/consolefonts HAVE a Unicode directory, so we don't even have some kludgy "de facto standards" to try to mimic. In the absence of a unicode table, I'm not seeing any better options; unless we find out for sure that that's used for bold chars or something