Glyphviewer is a web application that analyses web font files.
For those unsure about the meaning of "glyph", "font", and "web font", a small glossary is provided at the end.
Glyphviewer analyses font files, not fonts per se. (Computer fonts often consist of multiple files.) There are several formats supported
There are two places where font files can be hosted for analysis.
Other controls present are:
To finish, users hit the Submit button.
If Glyphviewer succeeds, it will generate a page with the following sections.
Glyphviewer will display an error message when it fails. There are several reasons for failure.
There is one situation which will result in a warning (rather than an outright failure). It occurs when the user attempts to analyse a font from a remote server whose Cross-origin Resource Sharing (CORS) policy refuses resources to be served by third-party sites. Glyphviewer will be able to analyse the font's header for information such as designer and copyright information. CORS doesn't prevent a resource being accessed by its lonesome. The problem will be when Glyphviewer - located on a particular server - tries to display the characters in the font when accessing it from a secondary, remote server. Many browsers - such as IE and Firefox - will refuse to display the characters using the font, and thus use some "fallback" font for that browser. Since this may mislead users as to the appearance of the font, Glyphviewer will warn them about this situation.
Glyphviewer should not encounter this situation when handling remote fonts delivered from Content Delivery Networks (CDN) such as Google Fonts. That's because these sites are designed to allow their resources to be shared by other sites. There are several ways to do this, but the most common way is to serve them with these particular HTTP headers:
Access-Control-Allow-Origin: *
If Glyphviewer detects these headers when downloading fonts from a remote server, it will assume that the browser can display them in the browser, and no warning will be presented to the user. This is not an issue for Glyphviewer when handling fonts hosted locally, because obviously the font and the server shares the same domain; CORS would not apply. However, enabling CORS on your own server may be useful if you are able to do it, especially when debugging remotely. For example, if you are serving your fonts from a nginx server that you control, you could use configuration declarations like the following:
location /static/glyphviewer/fonts/ { add_header 'Access-Control-Allow-Origin' "*" always; add_header 'Access-Control-Allow-Credentials' 'true' always; add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, OPTIONS' always; add_header 'Access-Control-Allow-Headers' 'Accept,Authorization,Cache-Control,Content-Type,DNT,If-Modified-Since,Keep-Alive,Origin,User-Agent,X-Requested-With' always; if ($request_method = 'OPTIONS') { # Tell client that this pre-flight info is valid for 20 days add_header 'Access-Control-Max-Age' 1728000; add_header 'Content-Type' 'text/plain charset=UTF-8'; add_header 'Content-Length' 0; return 204; } }
CORS - although a hindrance to Glyphviewer - is generally a good thing. It can be problematic if a "resource" such as a hostile piece of JavaScript is injected into a page from a third party website. That's why some browsers (such as Firefox and IE) refuse to load resources from third party websites unless certain criteria are met.
For more information on CORS, please see enable cross-origin resource sharing, especially if you want to add CORS support to your webserver. You could also look at the Mozilla Developer Network article on the subject.
Apart from issues arising from CORS, these are several limitations built in to Glyphviewer.
Earlier versions had a serious limitation. The application could only show glyphs for characters from the Basic Multilingual Plane (U+0000 to U+FFFF). Characters out of this range were not displayed. Fortunately, this limitation has been removed from Glyphviewer as of version 0.4 (2016).
If you have Python, the quickest way to install Glyphviewer (and its dependencies) is via the following command:
pip install glyphviewer
The next stage is to add "glyphviewer" to your INSTALLED_APPS list in settings.py. The stage after that is to add then desired URL to one of the urls.py files.
The final stage is to populate the directory with fonts where you display your chosen font or fonts. The Glyphviewer application comes with its own set of fonts adapted from the Free UCS Outline Fonts; they have been converted to WOFF form for quicker download. These can be moved into the correct directory via the following shell command:
python manage.py collectstatic
The font files wil then be moved into the {STATIC_ROOT}/glyphviewer/fonts/
directory, and the browser will read
the files from the {STATIC_URL}/glyphviewer/fonts/
folder.
Note: it is not mandatory to run the collectstatic command. However, if there are no font files in the above directory, then Glyphviewer will only be able to read remote files.
The HTML template files in this application have been redesigned to work with the Mezzanine CMS. The redesign removed any explicit references to particular stylesheets found with earlier versions. The app (and the fonts) are released under a GNU general public license. If you wish to do any changes, pop over to the GitHub repository for the app.
Glyphviewer (as of version 0.8 and beyond) depends on the following software:
Note: earlier versions of Glyphviewer depended on WoffTools, a package (built on top of FontTools) for parsing WOFF files. However, FontTools has WOFF support, and WoffTools has not been worked on for several years, so this dependency has been removed. Earlier versions of Glyphviewer also required Numerical Python (numpy) to be installed "by hand", since there were problems installing it with "pip". Fortunately, "pip install glyphviewer" will now provide all dependencies automatically.
I created Glyphviewer as a tool to examine the character repetoire of web fonts. It is easy to find fonts online; it is harder to find out exactly what characters they support. Almost all contain standard capital letters like "A", "B" and "C", and that's not hard to discover, because those are among the first characters to be advertised by the foundries. It's harder to find out how much support a font has for more unusual characters like (say) "ŋ". One could install individual fonts on the computer, and inspect each in a tool like "Character Map", but this is laborous and time-wasting.
So I created a tool that could analyse a font if it was located somewhere on the World Wide Web. Font makers often display their fonts using web pages, and even provide a place where people can type text and see it displayed using the typeface. All one has to do to analyse it is examine the attached cascading stylesheet for a link to the font file, and place its URL in Glyphviewer.
This application was designed in response to and in reaction to Google Fonts, which came out in 2011. The idea is wonderful: tens of web fonts available for access and download. A laudatory effort - except that it doesn't accurately show the full repertoire of characters for each font. Take Lato - a lovely font, and comes in 10 variants too. Now look at the character set Google Web Fonts displays for it. At the time, I was frustrated that "Ł" and "ł" were not displayed, even though the font supports them, and even though the creator goes by the name of Łukasz Dziedzic. Now Google Fonts displays them, but it took Google a couple of years to lift their game.
The primary inspiration for this is Mark Pilgrim, who wrote a blog post called Fuck the foundries in 2009 (before yanking it off the net two years later). His essay and/or rant got me interested in web fonts in the first place, as did his use of the utterly superb web font Essays 1743 in Dive into HTML5. Thanks to John Stracke for coming up with the "Essays" typeface in the first place.
I also have to acknowledge the developers of the libraries used in the making of Glyphviewer. A special shout out goes to the folk at TypeSupply who decided to open-source their code for WoffTools. The project wouldn't have been possible without them. I must also acknowledge the Free UCS Outline Fonts project for providing the fonts used in this application.
Copyright © Peter Murphy 2011-2024.
here’s a comic about arguing on twitter https://t.co/vNX0sBBoma
1 year, 7 months ago
On point 8, Helen, you had unrepentant Nazis on your side that day. It's probably just as well you are leaving the… https://t.co/5P2wWhFDc5
1 year, 7 months ago
@TweetsByBritt Britt: the answer is "no". In my working life of close to 30 years, there's been only one threat of… https://t.co/MmuSFBiszr
1 year, 7 months ago