Skip to main content

Glyphviewer

About

Glyphviewer is a web application that analyses web font files. The user chooses a font file, either by file path or URL, and Glyphviewer will try to parse it. If successful, it will:

  • Display general information about the font file, such as name and copyright details, stored in its header.
  • Provide a testbed where users can enter text and display it using the font.
  • Display characters supported by the font along with their Unicode code points, if the user checks the Shows characters in font checkbox. This option is turned off by default, as this may result in a very long page.

A demonstration is available here.

Installation and Dependencies

Glyphviewer and its dependencies can be installed via:

pip install glyphviewer

Glyphviewer requires Django ≥ 5.2, FontTools ≥ 4, numpy ≥ 2, brotli ≥ 1, and chardet ≥ 7.

Setting up

Once installed, add "glyphviewer" to your INSTALLED_APPS list in settings.py, and add the desired URL in one of the urls.py files.

# urls.py
from django.urls import include, path

urlpatterns = [
    path("this_is_the_path_to_glyphviewer/", include("glyphviewer.urls")),
]

This provides three routes:

Path Name Role
…/ (index) Form and analysis
…/doc/ In-app documentation
…/font/ glyphviewer:font-proxy Same-origin serve of remote fonts

The font/ route is explained more in Remote fonts, the same-origin policy, and CORS below.

Glyphviewer's Local dropdown lists every *.ttf, *.otf, *.woff, and *.woff2 file it finds in the {STATIC_ROOT}/glyphviewer/fonts/ directory. You can:

  • Copy any font files into that directory; or,
  • Add symbolic links that point at fonts stored elsewhere on the same file system. Fonts from other directories are not normally accessible by Glyphviewer, but it will follow symbolic links created in {STATIC_ROOT}/glyphviewer/fonts/ that lead to font files elsewhere on your machine.

Either way, your browser will list these fonts as coming from the {STATIC_URL}/glyphviewer/fonts/ folder.

Glyphviewer already comes with its own set of fonts from the Free UCS Outline Fonts. Those bundled fonts remain under their own GPL terms; the Glyphviewer application code is BSD-3-Clause (see LICENSE.txt). In production, the fonts can be moved into the correct directory via:

python manage.py collectstatic

Remote fonts, the same-origin policy and CORS

Glyphviewer's Remote text field allows the user to provide a full URL of a remote font. For earlier versions of Glyphviewer — 0.8 and before — the application could download remote fonts. It could even analyse them for their header information and the characters they supported. The problem was that the browser could not generally download the font to display it as it was designed.

The reason for this is that web browsers enforce the Same-origin policy: resources from one website are generally restricted from being used in another website unless Cross-Origin Resource Sharing is enabled on the source website.

Some websites, such as Google Fonts, are happy to share their fonts directly with others. When these files are downloaded, they are downloaded with these HTTP response headers that say CORS is permitted.

access-control-allow-origin: *

The asterisk means that requesting code from any origin can access the resource. So this means that you can embed the font in your site, and everyone is happy.

Not everyone has the budget that Google does. Some websites may use their own proprietary font that they spent a lot of money on. So when your website (or Glyphviewer 0.8 or before) tries to access it in the site, it will almost certainly not be sent with those access-control-allow-origin headers. That means CORS is not enabled, and the browser will refuse to display it as it was designed. Instead, the browser will use a fallback font for the user's browser and operating system instead; you are expecting Roboto, but it is displayed as Arial or Helvetica. Since this may mislead users as to the appearance of the font, Glyphviewer would then warn them about the situation.

(The Same-origin policy was originally intended for JavaScript; enforcement would reduce the number of malicious scripts executed on a webpage. But when Web fonts were introduced, the Same-origin policy also applied to fonts accessed by CSS @font-face rules in your webpages.)

Version 0.9 of Glyphviewer overcomes this limitation: it introduces a proxy for web fonts. The web page creates a same-origin URL that goes through Glyphviewer's font proxy; to the browser, it appears that the font is local, and so CORS permits the font to be loaded. To give more detail:

  1. The user submits a remote font URL, using either the HTTP or HTTPS schemes;
  2. The index view sets fontpath to /this_is_the_path_to_glyphviewer/font/?url=<urlencoded-remote-url>;
  3. The HTML template's @font-face refers to that same-origin URL; and,
  4. The font-proxy view — glyphviewer:font-proxy — downloads the remote file with fetch_remote_font() in font_fetch.py, and with an appropriate Content-Type. This could be font/woff2, font/woff, font/otf, or font/ttf.

Safety limits

All font fetches are capped by size (3 MB) and timeout (120s).

The proxy is not an open relay. Before fetching, validate_remote_font_url() rejects:

  • Schemes other than http / https;
  • URLs with embedded credentials;
  • Hostnames such as localhost, *.local, *.internal; and,
  • Private, loopback, link-local, and other non-public addresses.

Versions

  • 0.1 (June 11th 2011) - Initial release.
  • 0.2 (June 28th 2013) - Added setup script to create a PyPI package. Fixed bugs.
  • 0.3 (February 15th 2014) - Made compatible with Mezzanine and Bootstrap, changed styles for errors, now handles empty local directories.
  • 0.4 (January 16th 2016) - Now handles cases where remote fonts are inaccessible using CORS; removed the limitation that restricted characters to the BMP; added documentation for above.
  • 0.5 (March 31st 2017) - Updated to be compatible with Django 1.10. Now automatically install dependencies using pip.
  • 0.6 (March 18th 2018) - Add WOFF2 compatibility.
  • 0.7 (December 6th 2020) - Updated for Python 3 compatibility.
  • 0.8 (December 10th 2020) - Better representation of font header information as text; better use of urllib for Python 3.
  • 0.9 (September 25th 2026) - Same-origin remote-font proxy for preview (CORS bypass); ship glyph table / preview styles as package static CSS; add tests; migrate README to Markdown; clarify app license as BSD-3-Clause (bundled FreeFonts remain GPL); align copyright years and changelogs.

The Glyphviewer application code is copyright (c) 2011-2026 Peter Murphy peterkmurphy@gmail.com, and is licensed under the BSD-3-Clause terms in LICENSE.txt. Bundled Free UCS Outline Fonts remain under their own GPL terms.

Metadata

Release files for glyphviewer 0.9

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for glyphviewer 0.9
File Size Uploaded Provenance Actions
glyphviewer-0.9.tar.gz 5.5 MB Without provenance Details for glyphviewer-0.9.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for glyphviewer 0.9
File Interpreter ABI Platform Actions
glyphviewer-0.9-py3-none-any.whl Python 3 none any Details for glyphviewer-0.9-py3-none-any.whl

Total release size: 11.0 MB

Release files / glyphviewer-0.9.tar.gz

Download URL glyphviewer-0.9.tar.gz
Size 5.5 MB
Tags Source
SHA-256 checksum
How to use checksums
de433fc3147a2d6497c3db4c36372efab282f8fefb36857f9fcbc24fdd66bdc2
BLAKE2b-256 checksum
How to use checksums
3b7540048d2884de5504140aa35340ef2417d37fa5db3fc637b4ca6e412441d8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Release files / glyphviewer-0.9-py3-none-any.whl

Download URL glyphviewer-0.9-py3-none-any.whl
Size 5.5 MB
Tags Python 3
SHA-256 checksum
How to use checksums
5a4227598ff55eea3f5e803a6979bdb89682022091687574f39671b3765902a9
BLAKE2b-256 checksum
How to use checksums
08933c1222e2d3e4a872e4be5313fef4aeca191ea6c41e13a597891b20d2a58b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Security for glyphviewer 0.9

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page