A python API for evaluating coverage of glyph sets in font projects.
Project description
Attention: Repository under transition
The assembly of character sets is currently undergoing a transition from the previous approach of using the glyphsets
command and data.json
as a database to using the gflanguages
package as the database and assembling .nam
and other files from that.
This transition is currently complete for:
- GF_Latin_Core
How to assemble glyphs and characters using the new approach
- Define the glyphset in the Python module in
Lib/glyphsets/definitions/__init__.py
with language codes for your character set. - Optional: Have a
.stub.nam
file underGF_Glyphsets/*/definitions/
for your character set, containing encoded characters that you want to see included that can't be inferred from thegflanguages
definitions. - Optional: Have a
.stub.glyphs
file underGF_Glyphsets/*/definitions/
for your character set, containing unencoded glyphs that you want to see included. - Update all glyphsets using
sh GF_glyphsets/update-gs.sh
as usual, see below for details.
The final .glyphs
files are the sum of gflanguages
+ .stub.nam
+ .stub.glyphs
.
Bonus points: Sadly, in the creation of the .glyphs
files, it's not possible to exactly recreate the glyph sorting that Glyphs.app uses by default, so the .glyphs
files look a bit different from what's expected. If you care, please open every freshly adjusted .glyphs
file in Glyphs.app, select all glyphs, and run "Update Glyph Info" from the "Glyphs" menu on them to sort them and save the file. But the files will work as-is in any case.
What happens under the hood
update-gs.sh
runs as previously, except that it won't deleted the entire folder structure as previously, thus preserving the vital newdefinitions
folder.- It continues to build all files under the old approach.
- Afterwards, it calls the new script (
scripts/assemble_charactersets.py
) which will write over existing nam/glyphs/txt files (for supported glyphsets, see list at top).
Data flow visualization
Visualizes in a simplified way how the various data sources are combined into a final glyphset, then rendered out to various format.
This process is repeated for every glyphset defined in Lib/glyphsets/definitions/__init__.py
.
Read this top to bottom.
┌──────────────────┐
│ Language codes │
│ "en_Latn" │
│ "de_Latn" │
│ ... │
└──────────────────┘
│
┌──────────────────┐ ┌──────────────────┐ ┌──────────────────┐
│ gflanguages │ │ .stub.nam │ │ .stub.glyphs │
│ (Python package) │ │ (optional) │ │ (optional) │
└──────────────────┘ └──────────────────┘ └──────────────────┘
│ │ │
╰──────────────────────┼──────────────────────╯
│
╔═══════════════════════════════╗
║ complete glyphset ║
╚═══════════════════════════════╝
│
╭──────────────────────┼──────────────────────┬──────────────────────╮
│ │ │ │
┌──────────────────┐ ┌──────────────────┐ ┌──────────────────┐ ┌──────────────────┐
│ .txt │ │ .nam │ │ .glyphs │ │ .plist │
│ (nice & prod) │ │ │ │ │ │ │
└──────────────────┘ └──────────────────┘ └──────────────────┘ └──────────────────┘
Glyphsets
This python module provides an API with data about glyph sets for many different scripts and languages. This was crafted to specify the sets of characters that fonts in the Google Fonts collection are expected to provide glyphs for.
GF glyph sets
If you are a font developer or typeface designer, see the GF Glyphsets
subdirectory which provides glyphset definition "standards" that are typically useful sets to draw. The GF_Glyphsets are thought as modules you can accumulate. Therefore the Vietnamese set only contains additional glyphs to Latin Core to be able to support Vietnamese language.
- Fonts commissioned by Google Fonts must support Latin level 1 to 4: i.e Latin Core, Vietnamese and Plus sets.
- Fonts submitted to Google Fonts must support at least GF Latin Core, and designers are strongly encouraged to consider adding the GF Latin Plus set.
API Subsets
On the other hand, the nam files on the Lib/glyphsets/encodings
directory are probably more useful for expert web developers. Those files explain how the Unicode Range subsets are defined, typically per script (writing system), in the Google Fonts css API.
Glyphsets tool
You can create your own glyphset filter using the glyphsets
tool and our database.
You can install the tool with pip:
pip install glyphsets
We recommend installing it in a virtual environment.
- Main usage:
glyphsets filter-list [Set1, Set2,…] -o list-name.txt --prod-names
This command will create a filter list using production names. Without the --prod-names
argument, the result would follow the Glyph's nice name scheme. You can then use these lists into any font editor to create your filter.
- To create a filter list specifically for Glyphs App, you need to change the file extension with
.plist
. For example:
glyphsets filter-list GF_Latin_Core GF_Latin_Plus GF_Cyrillic_Core GF_Cyrillic_Plus -o CustomFilter_ProjectName.plist
Add this .plist
file next to your Glyphs file and you would be ale to see it under your filters.
- If you want to check if your font is missing glyphs from GF_Latin_Core, run:
glyphsets missing-in-font font.ttf
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file glyphsets-0.6.10.tar.gz
.
File metadata
- Download URL: glyphsets-0.6.10.tar.gz
- Upload date:
- Size: 2.3 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.12.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 22e9279826f5422a01b0965e9d4f0f562cbca8652e747e9711cf0c48de4247ff |
|
MD5 | 518c90858f3aa3c332dfe0b4743baf10 |
|
BLAKE2b-256 | 8bb5662262b288aad46fdc32df2e757082cc5296e5c8f8728ee7757108ab8623 |
File details
Details for the file glyphsets-0.6.10-py3-none-any.whl
.
File metadata
- Download URL: glyphsets-0.6.10-py3-none-any.whl
- Upload date:
- Size: 652.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.12.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e786a259d8e77bc85fb0cd31b23fabfb89e84b77c1e64d94117b2356b0ac3b4f |
|
MD5 | 036c180eaf19d44c019580370526ba6b |
|
BLAKE2b-256 | 3b453bb2d7a881357df82be6742d3cf40edc01e61ce5601ccac1880d2f9491cd |