googlefonts / pyfontaine

Python tool to check font files for language/character set support
https://github.com/googlefonts/pyfontaine
GNU General Public License v3.0
104 stars 20 forks source link

List available collections if none are specified #43

Closed davelab6 closed 10 years ago

davelab6 commented 10 years ago

Today:

$ pyfontaine --collections
usage: pyfontaine [-h] [--flush-cache] [--disable-unames] [--missing] [--text]
                  [--xml] [--json] [--wiki] [--csv] [--show-hilbert]
                  [--set SET] [--collections COLLECTIONS] [-V]
pyfontaine: error: argument --collections: expected one argument
$

What I'd like:

$ pyfontaine --collections
all All collections
al Adobe Latin
gf Google Fonts Subsets
[$shortName $longName]
$
davelab6 commented 10 years ago

This isn't working; its looking up the list of available sets, not the list of available collections, and that has somehow broken the collections feature.

$ pyfontaine --collections subsets font.ttf;
argument --collections: invalid collections "subsets"
adobe_latin_1                 Adobe Latin 1
adobe_latin_2                 Adobe Latin 2
adobe_latin_3                 Adobe Latin 3
adobe_latin_4                 Adobe Latin 4
adobe_latin_5                 Adobe Latin 5
africaan                      African
arabic                        Arabic
archaicgreekletter            Archaic Greek Letters
armenian                      Armenian
balinese                      Balinese
baltic                        Baltic
bamum                         Bamum
basiccyrillic                 Basic Cyrillic
basicgreek                    Basic Greek
basiclatin                    Basic Latin
batak                         Surat Batak
bengali                       Bengali
brahmi                        Brahmi
buginese                      Buginese
canadiansyllabics             Unified Canadian Aboriginal Syllabics
catalan                       Catalan
centraleuropean               Central European
cham                          Cham
cherokee                      Cherokee
chesssymbols                  Chess Symbols
claudianletters               Claudian Letters
coptic                        Coptic
gwf_arabic                    Google arabic
gwf_cyrillic                  Google cyrillic
gwf_cyrillic-ext              Google cyrillic-ext
gwf_cyrillic-ext-actual       Arimo cyrillic-ext+latin
gwf_extras                    Google extras
gwf_greek                     Google greek
gwf_latin                     Google latin
gwf_latin-ext                 Google latin-ext
gwf_latin-ext-full_impallari  Impallari latin-ext
gwf_latin-ext-lato_phase_2    Lato European
gwf_latin-ext-lato_phase_3    Lato Vietnamese
gwf_vietnamese                Google vietnamese
panafricanlatin               Pan African Latin
polish                        Full Polish Alphabet
westerneuropean               Western European
davelab6 commented 10 years ago

The --set is also broken. Its now

$ pyfontaine --set asd
error: too few arguments
dcrossland-macbookpro3:gurajada dcrossland$ pyfontaine --set asd  Gurajada-Regular.ttf 
WARNING: Please install [PyICU](https://pypi.python.org/pypi/PyICU) toenable [feature], perhaps with: pip install pyicu
Fonts
  Font:
    Common name: Gurajada
    Sub family: Regular
    Weight: normal
    Fixed width: no
    Fixed sizes: yes
    Copyright: Copyright (c) 2012 SiliconAndhra (fonts.siliconandhra.org)
    License: This Font Software is licensed under the SIL Open Font License, Version 1.1. This license is available with a FAQ at http://scripts.sil.org/OFL
    License url: http://scripts.sil.org/OFL
    Version: Version 1.0.3
    Vendor: SiliconAndhra, USA.
    Designer: Purushoth Kumar Guthula
    Glyph count: 709
    Character count: 216
$

it should be

$ pyfontaine --set asd,qwe
These sets are not recognised:
asd
qwe
Available sets:
adobe_latin_1                 Adobe Latin 1
adobe_latin_2                 Adobe Latin 2
adobe_latin_3                 Adobe Latin 3
adobe_latin_4                 Adobe Latin 4
adobe_latin_5                 Adobe Latin 5
africaan                      African
arabic                        Arabic
archaicgreekletter            Archaic Greek Letters
armenian                      Armenian
balinese                      Balinese
baltic                        Baltic
bamum                         Bamum
basiccyrillic                 Basic Cyrillic
basicgreek                    Basic Greek
basiclatin                    Basic Latin
batak                         Surat Batak
bengali                       Bengali
brahmi                        Brahmi
buginese                      Buginese
canadiansyllabics             Unified Canadian Aboriginal Syllabics
catalan                       Catalan
centraleuropean               Central European
cham                          Cham
cherokee                      Cherokee
chesssymbols                  Chess Symbols
claudianletters               Claudian Letters
coptic                        Coptic
gwf_arabic                    Google arabic
gwf_cyrillic                  Google cyrillic
gwf_cyrillic-ext              Google cyrillic-ext
gwf_cyrillic-ext-actual       Arimo cyrillic-ext+latin
gwf_extras                    Google extras
gwf_greek                     Google greek
gwf_latin                     Google latin
gwf_latin-ext                 Google latin-ext
gwf_latin-ext-full_impallari  Impallari latin-ext
gwf_latin-ext-lato_phase_2    Lato European
gwf_latin-ext-lato_phase_3    Lato Vietnamese
gwf_vietnamese                Google vietnamese
panafricanlatin               Pan African Latin
polish                        Full Polish Alphabet
westerneuropean               Western European
$
$ pyfontaine --set gwf_latin  Gurajada-Regular.ttf 
Fonts
  Font:
    Common name: Gurajada
    Sub family: Regular
    Weight: normal
    Fixed width: no
    Fixed sizes: yes
    Copyright: Copyright (c) 2012 SiliconAndhra (fonts.siliconandhra.org)
    License: This Font Software is licensed under the SIL Open Font License, Version 1.1. This license is available with a FAQ at http://scripts.sil.org/OFL
    License url: http://scripts.sil.org/OFL
    Version: Version 1.0.3
    Vendor: SiliconAndhra, USA.
    Designer: Purushoth Kumar Guthula
    Glyph count: 709
    Character count: 216
    Character Set: Google latin (gwf_latin)
        Missing:
            etc etc
$
davelab6 commented 10 years ago

Done. Only thing is that argument does not know about another one, so --collections subsets will not affect to --set in help message and you will see complete list of sets except only for subsets :(

Lets remove --collections then, and use --set for both sets glyph/char sets and groups of the same.

As per semver, this means bumping version to 1.3.0 I think

davelab6 commented 10 years ago

Ah, no, perhaps https://github.com/davelab6/pyfontaine/pull/48 can solve that?

davelab6 commented 10 years ago

1.2.2 is broken

...

davelab6 commented 10 years ago

perhaps #48 can solve that?

Actually I'll close that PR now - I think if i do pyfontaine --collection subsets --set then I expect to see only the lists of sets in that collection.

davelab6 commented 10 years ago

1.2.2 is broken

No its not, my mistake :)

davelab6 commented 10 years ago

The list of collections now works:

$ pyfontaine --collection
WARNING: Please install PyICU <https://pypi.python.org/pypi/PyICU> to enable CLDR related features, perhaps with: pip install pyicu
argument --collections: expected one argument
all         All collections
pyfontaine  PyFontaine collections
extensis    Extensis collection
fontconfig  FontConfig collection
subsets     Subsets collections
uniblocks   Uniblocks collections
%