User: Password:
|
|
Subscribe / Log in / New account

Development

New tools for open source font development

November 30, 2011

This article was contributed by Nathan Willis

Open font development revolves around a set of tools that is small even by open source standards. There is the GUI font editor FontForge (which is used to edit the vector outlines of characters, but which is difficult to use for other important tasks like editing spacing, kerning, or substitution tables), and there are a handful of small, standalone utilities that focus on individual tasks (like checking glyph coverage, or comparing hinting and rendering options). As a result, it is proportionally bigger news when new projects are unveiled, and three such projects have recently appeared.

Google's sfntly toolkit

The largest project is Google's sfntly toolkit, which is an Apache-licensed library for inspecting and altering font tables, but also includes some simple command-line tools built on top. The project was announced on November 18, and according to the blog announcement, it has been in use for a while by the team behind Google's Web Fonts initiative.

Sfntly code is available in both Java and C++ implementations. It can read and parse the tables in TrueType or OpenType fonts, which share the same underlying sfnt format. Under the hood, those formats consist of a collection of lookup tables that contain things like the mapping between character codes and the glyphs of the font, the glyphs themselves, horizontal and vertical spacing for each glyph, and so on. The Java version of the toolkit is self-contained; the C++ version requires some external dependencies: a testing framework from Google, and the International Components for Unicode (ICU) library.

At their simplest, the sfntly command-line tools can inspect a font file and print out the tables to stdout. The utilities include a sfntdump program that does this for a font file and table provided as arguments. Running:

    java -jar sfntdump.jar SomeFont.otf
returns a list of the tables found; you can inspect any of those tables by appending its name on the command line. A bit more interesting is sflint, which performs some validity checks on the contents of the tables. The current version checks that the full font name begins with the font-family-name, looks for glyphs which are clipped at the top or the bottom by the bounding box, tries to spot duplicate references, and checks for consistent character widths.

Another directory of utilities contains more substantial sfntly-derived programs, including some that modify font files. The fontinfo and sfnttool programs are both inspectors — fontinfo calculates and summarizes some useful values from the font tables (such as the sizes in bytes of the glyph and auxiliary tables), while sfnttool reports glyph coverage and compatibility of the font's options with the restrictive Web Open Font Format (WOFF).

Obviously, calculating the byte-size and WOFF-compatibility of a font are features frequently used by the Google Web Font office. So too is subsetting, which takes an input font file and extracts a new font file that preserves a specific portion of the original glyphs; that task is done using the subsetter tool. One could use this to construct a Cyrillic- or Latin-only version of a large multilingual font for example. The conversion tool will transform a TrueType or OpenType font into WOFF, at which point subsetter can extract only those characters used by a given page for delivery over HTTP.

In the announcement, Google claims that the speed of the code is "really, really fast," and quotes Google Web Fonts engineer (and former Ghostscript maintainer) Raph Levien as saying: "Using sfntly we can subset a large font in a millisecond. It's faster than gzip'ing the result." While the specific set of functions (error-checking, conversion to WOFF, subsetting) implemented in the command-line tools is important to Google Web Fonts, the rest of the library may prove just as helpful to other developers. It is generic enough that writing utilities to inspect and manipulate other font tables should be straightforward. Several of the non-sfntly standalone utilities mentioned in the introduction already permit investigating specific font tables, but they lack a common code base and uniform API.

TTFautohint

By comparison, ttfautohint is quite limited in scope. It is a utility that uses the auto-hinting subsystem of the FreeType library to pre-generate hinting tables for a TrueType font, then inserts them into the font. The result is a font that looks as good on a non-FreeType-rendered operating system (e.g., Windows) as it does on those OSes where FreeType handles the rendering (e.g. Linux and the BSDs).

"Hinting" is the process of adjusting the native vector outline of a glyph so that it looks good when rasterized — primarily by ensuring that lines and features fit onto grid boundaries so as not to appear blurry when anti-aliased on screen, but also to preserve white spaces that might be accidentally lost, to ensure that characters are uniform in height, and other details.

FreeType, the font renderer used by most Linux distributions, has included a quality autohinting engine for years, which alleviates (to one degree or another, depending on the eye of the beholder) the need for TrueType fonts to include hints of their own. PostScript fonts and PostScript-flavored OpenType fonts do not need such embedded hints, because the hinting functionality is expected to be handled by the rendering engine for those formats.

The ttfautohint tool is an effort by FreeType's Werner Lemberg. The current release is version 0.5, from November 6, and binaries for Windows and OS X are available in addition to the source code. Like FreeType, it is dual-licensed under GPLv2 and the FreeType license. It can already be used to generate hinting instructions for a font; because the instructions are resolution-dependent, ttfautohint processes fonts at a range of resolutions — by default between 8 pixels-per-em (or ppem, where an em is one standard character-width) and 1000ppem.

Rather than generating 993 separate sets of instructions, however, it categorizes the results, looks for commonality, and outputs a minimal set of hinting "classes" for a range of commonly-used sizes. The documentation says typical results need "three to four sets (covering the whole range), but sometimes more than ten are necessary." Similarly, ttfautohint attempts to group related sets of instructions into repeatable "high-level" operations, a concept that could be used to develop ttfautohint into an interactive hinting editor — where operations like "align this stem to the grid" would be more useful than the manual methods currently used.

Such a visual editor is part of the long-term roadmap. No such hinting editor exists in open source at present, and hinting is tedious to do by hand. TrueType hints are written in a stack-based, PostScript-like language that utilizes abbreviated opcodes for every instruction and function. Again because separate instructions may be required for different output sizes, several sets of hints are typically needed, an area where a "hinting IDE" would come in handy. So, too, would the ability to test hints without exporting, re-generating, and re-loading the font file into the OS.

Lemberg is running a Kickstarter-like fundraising campaign to fund development of the the ttfautohint work, including the visual editor. So far donors have pledged about 65% of the support he estimates needing for the entire project.

A simple font previewer

[Fonts previewer]

Last but not least, Sune Vuorela's fonts is a tiny Qt utility that does one task and does it well: it previews user-provided text in every active font on the system, rendered in a simple, easy-to-compare window.

Vuorela announced it on November 21, saying he had created it to assist him with finding a suitable font that incorporates some specific visual features. That is a common job for graphic designers, for example when finding the right font for a logo. There are more full-featured font managers like Fontmatrix, and type classification systems like PANOSE, but neither can do the straightforward sorting that the eye sometimes requires. Think "I need to find a font where the dot over the i is a square" — no classification scheme will tell you that information. Other design tools like Scribus or the GIMP will allow you to enter the text and cycle through the available fonts, but it is time consuming and you cannot see them all at once.

With Vuorela's utility, you type in the text, and a sample of it rendered in each font appears below, alongside the font name. In the grand scheme of things, a feature like this would make a good addition to several other applications (perhaps with the ability to alter the background and foreground colors or sizes), but too much complexity would rob it of its charm.

Last word

Individually, each of these projects constitutes an incremental improvement to the open source font development toolbox, but it is encouraging to see them at all. Development on FontForge is slow and has been for some time, while several of the other, larger applications face an uncertain future — including Fontmatrix, whose lead developer has been busy with other tasks for close to two years.

The sfntly library has the potential to replace some of Fontmatrix's inspection functions and to unify the functionality provided by several of the standalone utilities. Whether development actually takes off is anyone's guess, but considering that sfntly is an in-house tool in use by Google (as opposed to a "20% time" project), it is probably stable. Ttfautohint will draw the most immediate attention from font designers who care about Windows rendering, but the prospect of a good, visual hinting editor is bigger in the long run — and would be a significant win for open source font development.

Comments (6 posted)

Brief items

Quotes of the week

Some human endeavors require a disguise. Sometimes the intent is to deceive, but more often, the intent is to communicate something true at a deeper level. For instance, many job interviewers expect you to dress up in a tie to indicate that you're seriously interested in fitting in, even though both of you know you'll never wear a tie on the job. It's odd when you think about it: tying a piece of cloth around your neck can magically get you a job. In Perl culture, the tie operator plays a similar role: it lets you create a seemingly normal variable that, behind the disguise, is actually a full-fledged Perl object that is expected to have an interesting personality of its own. It's just an odd bit of magic, like pulling Bugs Bunny out of a hat.
-- Tom Christiansen

Postgres 9.2 is going to have a boat-load of performance enhancements. The inclusion in Postgres 9.2 of index-only scans and count(*) optimizations clearly is something that is going to help a lot of work-loads.

Large server workloads (+32 cores) is another area that is being addressed. This has been an area where we lagged behind commercial databases, and I was starting to think that to catch up with them, we were going to need to do a lot of very ugly, platform-specific hacks. Well, that turns out to be false also. Changing the layout of the of the per-session shared memory storage has yielded a 40% performance improvement on 32-core tests. Lock scalability for a large number of clients was also improved by 5 times!

-- Bruce Momjian

Comments (none posted)

gcc-python-plugin 0.7

gcc-python-plugin is a plugin for the GCC compiler that enables the embedding of Python modules for static analysis and other types of checking. "The usability and signal:noise ratio is greatly improved over previous releases. It can now emit HTML reports showing the path of execution through a function that triggers a particular error." There is also a new feature allowing the creation of custom attributes that can be used to annotate a C API and check its use.

Full Story (comments: none)

Numexpr 2.0

Numexpr is a numerical Python package aimed at fast evaluation of array operations. It makes use of multithreading and, when possible, the Intel vector math library to parallelize operations. The biggest change appears to be a shift to the new iterator operation provided in NumPy 1.6 for significantly improved performance.

Full Story (comments: none)

openBarter 0.2.0

OpenBarter is a PostgreSQL extension aimed at implementing barter-based markets. "Archaic barter has always been the result of a crumbling financial system. However openBarter performs automatic competition of multilateral exchanges and is nearly as liquid as a regular market using money, maximizing usefulness of resource allocation. By considering value as multidimensional, openBarter proposes a regulation mean for allocation of a large diversity of scarce ecological resources." Version 0.2.0 has been released; see this paper [PDF] for details on how it works.

Full Story (comments: none)

Web Search By The People, For The People: YaCy 1.0

The Free Software Foundation Europe covers the release of YaCy 1.0, a peer-to-peer Free Software search engine. "The YaCy search engine runs on each user's own computer. Search terms are encrypted before they leave the user and the user's computer. Different from conventional search engines, YaCy is designed to protect users' privacy. A user's computer creates its individual search indexes and rankings, so that results better match what the user is looking for over time. YaCy also makes it easy to create a customised search portal with a few clicks."

Full Story (comments: 24)

Newsletters and articles

Development newsletters from the last week

Comments (none posted)

Cinepaint resurrected, v1.0 released (LGW)

Libre Graphics World reports that the Cinepaint project has returned to life and put out a 1.0 release. "The official announcement doesn't mention any changes apart from fixes in the build system, and a quick comparison of the source code against Kai-Uwe's private fork reveals that none of his latest changes (if any at all) have been used in the upstream Cinepaint project. No plans for further development have been announced by Robin Rowe either. Feature-wise Cinepaint 1.0 is still the old GIMP from early 2000s which means that you get high bit depth precision, flipbook and color management on top of a rather limited toolbox and aging user interface." One has to start somewhere; perhaps this is the beginning of an interesting new development effort.

Comments (18 posted)

Wingo: the gnu extension language

Guile maintainer Andy Wingo re-examines its suitability as the official GNU extension language, showing off a number of useful features on the way. "Delimited continuations let a user extend their code with novel, expressive control structures that compose well with existing code. I'm going to give another extended example. I realize that there is a risk of losing you in the details, dear reader, but the things to keep in mind are: (1) most other programming languages don't let you do what I'm about to show you; and (2) this has seriously interesting practical applications." (The article is a few months old, but we had not encountered it previously).

Comments (112 posted)

Page editor: Jonathan Corbet
Next page: Announcements>>


Copyright © 2011, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds