Skip to main content

Codepoint definitions for the Google Fonts subsetter

Project description

gfsubsets

This is the collection of nam files (codepoint subsets) that are used to subset fonts before serving on the Google Fonts CSS API.

The subset files

The subset definitions are contained in two forms; the "editable" definitions are found in the subsets-input directory, and the machine readable defitions can be found in Lib/gfsubsets/data.

The machine readable files consist of text files with one Unicode codepoint (a hexadecimal number beginning with 0x) on each line; everything after the codepoint is a comment. Blank lines and comment lines beginning # are ignored.

The editable definitions are similar, but for convenience allow the following "directives":

  • Two codepoints separated by .. denote an (inclusive) range; all codepoints within the range are included.
  • The symbol - before a codepoint or range excludes it from the output set.
  • The directive @include(filename) includes the codepoints in filename.
  • The directive @block(XYZ) includes the codepoints in the Unicode block named XYZ.
  • The directive @script(XYZ) includes all codepoints with either the Unicode Script property equal to XYZ or the ScriptExtensions property equal to XYZ

These editable definitions are turned into their machine-readable equivalents using the script scripts/preprocess_namfile.py.

Python interface

This repository also includes the Python module gfsubsets which provides an interface to these subset definitions. It exports the following functions:

  • CodepointsInFont(filename): Lists the Unicode codepoints supported by the font
  • ListSubsets(): Returns the name of all defined subsets.
  • SubsetsForCodepoint(cp): Returns the names of all subsets including the codepoint.
  • SubsetForCodepoint(cp): Returns the name of the "most relevant" subset including the codepoint.
  • CodepointsInSubset(subset): Returns a set of codepoints included in the subset.
  • SubsetsInFont(filename, min_pct, ext_min_pct): Returns the name of subsets "well" supported by a font.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gfsubsets-2025.11.4.tar.gz (1.4 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gfsubsets-2025.11.4-py3-none-any.whl (438.8 kB view details)

Uploaded Python 3

File details

Details for the file gfsubsets-2025.11.4.tar.gz.

File metadata

  • Download URL: gfsubsets-2025.11.4.tar.gz
  • Upload date:
  • Size: 1.4 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for gfsubsets-2025.11.4.tar.gz
Algorithm Hash digest
SHA256 93a5256bda8aff54b2d9986e9ea15cc9aff48670d912fe27a6da2079fbed8a49
MD5 e3084d328e9ad81a7e0d5e0506dd3643
BLAKE2b-256 4143f6801e170662b5d97dfde0f9cd1c6e1896da3be04c16af1fc8b8292222fe

See more details on using hashes here.

Provenance

The following attestation bundles were made for gfsubsets-2025.11.4.tar.gz:

Publisher: publish-release.yml on googlefonts/nam-files

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file gfsubsets-2025.11.4-py3-none-any.whl.

File metadata

  • Download URL: gfsubsets-2025.11.4-py3-none-any.whl
  • Upload date:
  • Size: 438.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for gfsubsets-2025.11.4-py3-none-any.whl
Algorithm Hash digest
SHA256 ba6ae1a53d245824e2645a1200bb35362016576e0313328adfea25071139c965
MD5 e0c743014c3f9c6eb88c8b2a536fafd1
BLAKE2b-256 7dae75785728d59a96c004688b63d78d977f4d7a4a7b474cb640194e9268fe31

See more details on using hashes here.

Provenance

The following attestation bundles were made for gfsubsets-2025.11.4-py3-none-any.whl:

Publisher: publish-release.yml on googlefonts/nam-files

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page