Glyphviewer Documentation

What is Glyphviewer?

Glyphviewer is a web application that analyses web font files.

  • It lists the characters supported by a font using its glyphs. This is the raison d'être for the application.
  • It displays information present in the font's header, such as developer and license details.
  • It provides a test bed for users to enter their own message, and see it displayed using the font.

For those unsure about the meaning of "glyph", "font", and "web font", a small glossary is provided at the end.

Glyphviewer Usage

Glyphviewer analyses font files, not fonts per se. (A font may consist of multiple files.) Permissible formats are TrueType (.ttf), OpenType (.otf), and best of all, Web Open Font Format (.woff). WOFF is preferred, because font data is compressed by design, resulting in quicker download.

  • Users will find it easiest to analyse a web font file stored on the server hosting this application. This is Glyphviewer's default behavior: when a user first encounters this page, the application randomly selects one from its file system, and analyses it for inspection. Viewers can choose other font files stored locally, as long as Local is checked; they just select an item from the File drop down list. All fonts are listed by file name, so File will display (say) "DejaVuSans.woff" rather than "DejaVu Sans".
  • More adventurous users can choose a font somewhere else on the Internet by checking Remote instead. They write the full URL for the font file (including the extension) in the URL control. For example, here's an URL for the Lato web font ready for copying-and-pasting.

Other controls present are:

  • Shows characters in font: If checked, all characters in the font (well, almost all) are displayed in tabular form. The advantage is that users can discover which characters and languages are supported by the font. Moreover, people can inspect individual glyphs for legibility and appearance. The disadvantage is that the resulting page – which accommodates all the characters – can be quite large.
  • Arrange characters as Unicode blocks: If checked, Glyphviewer splits characters into different tables according to their Unicode blocks. If not checked, all characters are displayed in one gigantic table. If Shows characters in font is not selected, this checkbox is ignored altogether.

To finish, users hit the Submit button.

On Success

If Glyphviewer succeeds, it will generate a page with the following sections.

  • General information: This data is taken from the font's header; it generally includes details such as name, designer, and copyright information. The last piece of data is extremely useful to know, as it may indicate whether the font is legally free to use or not.
  • Testbed: This provides an area where users can play around with the font. Fields of interest are:
    • Enter some text to try out the font: This is a multi-line field for changing the message (because "Hello World!" gets boring quickly).
    • Font size (in pixels): This sets the size of the message text in pixels. But to actually resize the text, one has to click...
    • Try it: This rewrites and redisplays the message.
    • Reset: This resets the message to the default text and size.
  • Supported characters: if Shows characters in font is selected, Glyphviewer will generate a table (or tables) of the characters provided by the font. For maximum utility, characters will be displayed using the actual glyphs in the font, and each character is displayed with its Unicode code point underneath. However, some fonts include characters such as the humble "NULL" (U+0000) which were never intended for display. Rather than writing them to the screen, Glyphviewer lists them instead.

On Failure

Glyphviewer will display an error message when it fails. There are several reasons for failure.

  • The URL cannot be resolved to some resource on the Internet.
  • The URL points to an actual resource on the Interwebs, but it's not a font file.
  • The URL points to a font file, but it is too "big". This limitation is deliberate. Imagine if some smartarse puts all 22MB of Arial Unicode MS on their web server, and directed Glyphviewer to analyse it. This would slow down this server. That's why the application refuses to read very large files.
  • The font is genuine, but essential information such as the header is missing. (This shouldn't happen, as it's against the specification).
  • The font is a symbol font, a relic from the days before Unicode. Glyphviewer will refuse to analyse it out of disgust.

Limitations

These are several limitations built in to Glyphviewer.

  • The application can only show glyphs for characters from the Basic Multilingual Plane (U+0000 to U+FFFF). This is probably the most serious limitation for the application. Fonts which contain characters out of this range will not be displayed, just ignored.
  • Glyphviewer can only analyse OpenType, TrueType and Web Open Font Format font files. Other font files such as Embedded OpenType (.eot) and Scalable Vector Graphics (.svg) cannot be handled by this application.
  • The application has a font size limitation built in (as stated before).
  • The application may be slow when analyzing a remote font, as the server has to access it to create a temporary copy.

Installation and Dependencies

Glyphviewer depends on the following software:

Once these libraries have been installed, the next stage is to install Glyphviewer via the following command:

pip install glyphviewer

The next stage is to add "glyphviewer" to your INSTALLED_APPS list in settings.py, and add the desired URL in 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.

Why Glyphviewer?

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 a fonts on the computer, and inspect it 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 Web 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. Does it show the "Ł" and "ł" it supports? This omission is inexcusable two years later, given that the creator goes by the name of Łukasz Dziedzic. Google – lift your game.

Acknowledgements

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. It 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.

History

  • 0.1 (June 11th 2011) - Initial release.
  • 0.2 (June 28th 2013) - Added setup script to create a PyPI package. Removed bugs.
  • 0.3 (February 15th 2014) - Made compatible with Mezzanine and Bootstrap, changed styles for errors, now handles empty local directories.

Glossay

Font
A file, or a set of files, that is used to specify the appearance of computer text. Common Windows fonts are "Times New Roman", "Arial" and "Courier New"; Mac OS X and Linux have their own equivalents. The "Times New Roman" font consists of 4 files: one for representing regular text, one for Bold text, one for Italic text and one for Bold Italic text.
Web font
A font that is designed to be downloaded with a web page only for the purpose of viewing it, and then discarded afterwards. Historically, most web designers assumed that users had a limited repertoire of fonts already installed on their machine, and would style accordingly. For example, it would be a safe bet to have either Helvetica or Arial on the viewer's computer, and if not, there would be some sort of sans-serif equivalent available instead. One problem with this is that it gets boring to see the same fonts all the time. So the W3C had a sit down with industry folk from Microsoft and Adobe and Mozilla and other companies, and worked out their own technology for embedding fonts on the fly.
Glyph
Glyphs are the shapes used to represent characters in a font. For example, the character "I" is (more or less) shaped a horizontal line - in contrast to an "o" character, which resembles (roughly) a hollow circle. Terms like "more or less" and "roughly" are used here, because the same character would be generally represented by different glyphs in different fonts, and even within them. Continuing the example above, an "I" in a italic version of a font would be inclined relative to a regular version of "I", while an "I" in a serif font would have serifs coming out at the front and the bottom. In short, there are many ways to create a glyph for the same characters.

Copyright © Peter Murphy 2011, 2012, 2013, 2014.

Recent Tweets

  • Peter Murphy

    Peter Murphy @peterkmurphy

    @Colvinius Yet another reason that I give thanks to AQIS. Without them, we'd probably have our own population of wandering spiders by now.
    4 days, 23 hours ago

  • Peter Murphy

    Peter Murphy @peterkmurphy

    @1rainbowstar1 The term "Social Justice" predates #Gamergate by a couple of decades. You can't co-opt it that easily.
    5 days, 10 hours ago

  • Peter Murphy

    Peter Murphy @peterkmurphy

    @1rainbowstar1 You don't get it. There's a strong case for Martin Luther King being a "social justice warrior" - a term you try to co-opt.
    5 days, 11 hours ago