Archive for typography

Following up on quality fonts and meta-fonts

In response to my post on quality fontsmbana provided a pointer to a Typophile discussion on the Tex Gyre fonts. In particular, Thomas Phinney described their quality as "wildly variable". I suppose at the time I was using "quality" to more describe whether the fonts provided all the features I would expect to need, rather than only aesthetic quality. I have to admit when I did skim the specimens that they didn't look too bad to me. He did say that the glyphs based on the original URW designs were quite good, while the Greek and Cyrillic "range from mediocre to poor to largely useless". Phinney most certainly has more experience with Cyrillic and type design than me, and arguably he probably just has a much better eye than me.

Leon recommended Junicode, which provides the most important features I discussed. I do think its stems are a bit thinner than I prefer, but it seems very well done.

In my discussion of METATYPE1 and meta-fonts, Till pointed out the existence of the meta-font Antykwa Półtawskiego. At the time I told him that I thought he was misinformed because Antykwa Toruńska seemed to have been created by tracing scanned specimens. A few days ago, Peter Backes pointed out this rather egregious error in reading comprehension on my part. Currently, only the generated Type 1 font files are available for Antykwa Półtawskiego.  However, it sounds like it was prepared using a rather early version of METATYPE1 and therefore the sources could possibly be incompatible with the newer versions of METATYPE1.

Peter also noted that he has also created a font with METATYPE1 called OCEANIA. It is perhaps not as "meta" as he thinks would be ideal, but during the time I've spent working with METAFONT and METATYPE1, I've definitely found that it is often quite difficult to come up with a reasonable declarative specification of a glyph.

Comments

Finding symbols graphically

Jeff pointed me to these extremely cool and useful web application: Detexify2.  At least a few of you readers have spent time skimming The Comprehensive LaTeX Symbol List looking for the incantation required for a specific symbol. With Detexify2 you can just scribble something that roughly looks the symbol and it will tell you the name and, if necessary, the LaTeX package that provides it.

The only problem is that it lets users help train the recognizer.  This can also be a good thing, but I can imagine a few malicious users (or perhaps just people with very bad drawing skills) ruining it for everyone.

Comments (2)

Typographic Style for Computer Scientists

Typographic Style for Computer Scientists is a short article intended to bring computer scientists up to speed on typographical issues. I started writing it several years ago, and then set it aside for other projects. Recently, I decided rather than wait for it to be “complete” and perfect that I should polish it up a little and see if people could benefit from it.

It is probably far from comprehensive, but hopefully some people will find it useful. I had been thinking of perhaps adding some material specifically on inference rules and judgments, but I am not sure what else it might make sense to include.

If you find mistakes please let me know. If you disagree on some of what I have said, let me know and perhaps I can address your concerns.

Comments (8)

Testing mftrace

I am not entirely sure how fair of a comparison I am making, but I am open to suggestions on how to better compare the hypothetical output of a font designed using METATYPE1, where a Type 1 font would be directly generated, versus a font designed using METAFONT, where a Type 1 font is generated using mftrace.

For my experiment, I chose to compare glyphs from the Type 1 version of Computer Modern maintained by the American Mathematical Society, which was presumable crafted by manually tracing the bitmap version and optimizing various aspects by hand, with glyphs generated by mftrace on 3000DPI bitmaps generated from the METAFONT source. I could imagine that it might be fairer to compare the result of using nearly identical METATYPE1 and METAFONT source to generate the Type 1 glyphs, but then I would be biasing the design process towards the limitations of METATYPE1. I had considered using the METAFONT source for AMS Euler, because the source is simply the outline and would be easy to convert to METATYPE1.

I also decided to use glyphs with plenty of curves for the test, as I figure that tracing software can probably do a pretty good job with straight lines.

In any event, I will leave it to you to decide whether you can distinguish which is version is which below.  The order in which the two versions appear differs for each of the three examples below.

qaqb

sasb

ampaampb

As you might have guessed, my opinion is that results are so nearly indistinguishable, that given the design limitations of METATYPE1,  it would make much more sense to work with METAFONT and mftrace, and use FontForge or a similar tool to add hinting as a postprocessing step.

Comments (2)

The Controversial Comic Sans

I figured I would pass along Emily Steel's Wall Street Journal article: Typeface Inspired by Comic Books Has Become a Font of Ill Will.

Comments (2)

METATYPE1 and meta-fonts

I've been spending time lately learning more about working with METATYPE1, mostly for my own projects, but with the eventual hope of writing some tutorials.  While working on one of my running examples, I was encountering some difficulty expressing what I wanted in a reasonably declarative fashion. So I decided to see how it was done in Latin Modern.

I was dismayed to learn that Latin Modern is not a meta-font like Computer Modern. Instead the Type 1 versions of Computer Modern (which was developed by either Bluesky or Y&Y) were decompiled into MetaPost code as raw path outlines. So at that point all of the useful abstractions in Knuth's original code and specifications have been lost.

The only other major typeface developed in METATYPE1 that I know about, Antykwa Toruńska, has no source available and from the description I highly suspect that it was developed by creating raw paths that matched the scanned specimens. This got me thinking about whether there are any meta-fonts that have been developed in METATYPE1, or even whether Computer Modern might be the only full meta-font family in existence. I just skimmed through the METAFONT sources that are included in TeXLive, but didn't see anything particularly promising yet.

In any event, going back to the original issue, I have been starting to think that maybe the limitations of METATYPE1 are perhaps not worth being able to directly generate Type 1 fonts. It could be entirely possible that working in METAFONT and using something like mftrace to generate outline fonts from high-resolution bitmaps will produce results of sufficient quality. I'm hoping to do some tests to compare the two approaches this weekend.

(It is worth noting, that the comment about METATYPE1 on the mftrace page is slightly incorrect or out of date.  METATYPE1 can handle overlaps, there are just complicated restrictions on how overlapping may occur.  Finding clean approaches to avoid these restrictions was why I became interested in looking at the Latin Modern code to begin with.)

Comments (2)

Quality fonts

The other day on Digg I saw a link for 30 high-quality free fonts for professional designs. Many of the samples seem decent, but I guess it sparked the question in my mind of just what constitutes a "high-quality font".

I suppose when I think of a a quality font, I tend to expect a consistent design along with some of the following:

  • composing characters or glyphs for most diacritical marks, ideally Greek and Cyrillic glyphs as well
  • proper kerning
  • appropriate ligatures
  • old-style numbers
  • optical sizes

Given these criterion, offhand I have to say that perhaps the best high-quality free fonts that I can think of off the top of my head are probably the TeX Gyre fonts and the Latin Modern family.  I would be curious to hear about other recommendations.

Comments (2)

The Fifth Element

The other day, a colleague of mine pointed out to me that Aarhus University recently rolled out a new, somewhat controversial,  visual identity that includes a novel geometric alphabet that they call its "fifth element".

Comments

Fonts in LaTeX, Errata

About seven months ago, Vasile Gaburici alerted me to the fact that otftotfm has had experimental support for OpenType fonts TrueType outlines for quite some time. Furthermore, it will use kerning tables that ttf2tfm will ignore.  I am now finally getting around to writing a post to highlight this fact.

It seems likely that otftotfm may also work on pre-OpenType TrueType fonts because the OpenType font format is essentially the same as the TrueType format with potentially additional tables. At least, when I did cursory search on my computer I could not find any TrueType fonts that proved to be incompatible with otftotfm.

Therefore, if you want to use a TrueType font with pdfLaTeX you should ignore the instructions I give in ∃xistential Type Fonts in LaTeX, Part Three: pdfTeX and TrueType and use the same instructions as I gave for OpenType fonts in Fonts in LaTeX, Part Two: pdfTeX and OpenType. For your convenience, I have also created an updated the zip file for the example that uses otftotfm instead of ttf2tfm.

Comments

Fonts in LaTeX, Part Three: pdfTeX and TrueType

Update: The information in this post is out of date: otftotfm does presently have support for TrueType outlines. See my errata post for more information.

In the previous part of this tutorial, I explained how to put together the minimal infrastructure needed to use an OpenType font with pdfLaTeX.  However, I used the tool otftotfm to generate the font metrics TeX needs to lay out text. However, otftotfm only supports OpenType fonts that use PostScript font outlines, as opposed to TrueType font outlines. So in this part of the tutorial I will explain how to put together the necessary infrastructure for TrueType fonts. In preparation for that, we will first make a few changes to what we had done earlier.

For those that would find it useful, I've put together a  zip file containing all the files from the tutorials (except the fonts, which I don't want to deal with distributing).

Firstly, we are going to move the uses of \DeclareUnicodeCharacter out of UPagella.fd and into uenc.def:

 
\ProvidesFile{uenc.def}
% We are declaring an encoding named "U"
\DeclareFontEncoding{U}{}{}
 
% Technically these are not "allowed" in .def files,
% but this is really the logical place to put the
% declarations.
 
% τ (0x03C4) maps to 0xF8 in the encoding
\DeclareUnicodeCharacter{03C4}{\char"F8}
% ε (0x03B5) maps to 0xF9 in the encoding
\DeclareUnicodeCharacter{03B5}{\char"F9}
% χ (0x03C7) maps to 0xFA in the encoding
\DeclareUnicodeCharacter{03C7}{\char"FA}

As I mention in the comments, the documentation on font encoding definition files does not list \DeclareUnicodeCharacter to be one of the allowed declarations in a such a file, but it works, and it seems like the more logical place to configure it than in the font definition file.

Now that we have removed the uses of \DeclareUnicodeCharacter from UPagella.fd, it looks like:

 
\ProvidesFile{UPagella.fd}
 
% Delcaring a font family called "Pagella" for the encoding "U"
\DeclareFontFamily{U}{Pagella}{}
 
% Declare that font family "Pagella", for encoding "U", has a shape
% with weight medium (m) and normal (n) slant (in otherwords, upright)
\DeclareFontShape{U}{Pagella}{m}{n}{
  % For all sizes...
  <->
  % ... use the font named
  TeXGyrePagella-Regular--custom--base
}{}

I am going to use Deja Vu Sans as the example TrueType font. Fortunately, if you followed everything from the second part of the tutorial, there is not much that needs to be done.

First, we need to generate metrics for Deja Vu Sans. As before, if you are using TeX Live, you'll have the necessary program:

% ttf2tfm DejaVuSans.ttf -q -T custom
ttf2tfm: WARNING: Cannot find character `compwordmark'
         specified in input encoding.
...
...
ttf2tfm: WARNING: Cannot find character `zdotaccent'
         specified in input encoding.
DejaVuSans   DejaVuSans.ttf Encoding=custom.enc

The program ttf2tfm is kind of unusual in that it first takes the filename argument and then all the options. So we've passed it the TrueType font we want to generate metrics for, DejaVuSans.ttf, the option -q to tell it not to print quite so much information, and the option -T custom which tells it to use the encoding defined in the file custom.enc we created in previous part.

Unlike otftotfm, ttf2tfm does not generate an entry that we could use in our map file, custom.map, so we need to write one ourselves. You will want to start with the map we generated by otftotfm for Tex Gyre Pagella, and you will want to add the line:

DejaVuSans <custom.enc <DejaVuSans.ttf

This says to map the TeX font name DejaVuSans to the file DejaVuSans.ttf using the encoding custom.enc. To learn more about the format of map files, there is a section on them in the pdfTeX manual.

Now we just need to create a font definition file for Deja Vu Sans. However, it is essentially the same as the one we created for TeX Gyre Pagella:

 
\ProvidesFile{UDejaVuSans.fd}
 
% Delcaring a font family called "DejaVuSans" for the encoding "U"
\DeclareFontFamily{U}{DejaVuSans}{}
 
% Declare that font family "DejaVuSans", for encoding "U", has a shape
% with weight medium (m) and normal (n) slant (in otherwords, upright)
\DeclareFontShape{U}{DejaVuSans}{m}{n}{
  % For all sizes...
  &lt;-&gt;
  % ... use the font named
  DejaVuSans
}{}

We have just replaced all occurrences of Pagella with DejaVuSans.

Finally, we just need to update our example document to use Deja Vu Sans:

 
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[U]{fontenc}
\pdfmapfile{+custom.map}
\renewcommand{\rmdefault}{Pagella}
\renewcommand{\sfdefault}{DejaVuSans} 
 
\begin{document}
Testing pdfLaTeX!
 
Greek: τεχ.
 
\begin{sffamily}
Testing pdfLaTeX!
 
Greek: τεχ.
\end{sffamily}
\end{document}

Here we have used \renewcommand to set the default sans serif font, \sfdefault, to be DejaVuSans. In the body of the document, we've copied the text and surrounded it with the sffamily environment to have it typeset in sans serif.

Now we have everything we need to run pdflatex:

% pdflatex test-pdflatex.tex
This is pdfTeXk, Version 3.141592-1.40.3 (Web2C 7.5.6)
 %&-line parsing enabled.
...
...
(./test-pdflatex.aux) (./upagella.fd) (./udejavusans.fd) [1]
(./test-pdflatex.aux) ){custom.enc}{a_qnnnfc.enc}<./TeXGyrePage
lla-Regular.pfb>
Output written on test-pdflatex.pdf (1 page, 34857 bytes).
Transcript written on test-pdflatex.log.

And we have the desired output:

Testing pdfLaTeX with both OpenType and TrueType fonts

And that's everything you need to get started with TrueType fonts and pdfLaTeX. Again, if you encounter any problems or notice any omissions, let me kow. I'll do some investigation and there will possibly be a fourth part on using fontinst.

Comments (3)

« Previous entries Next Page » Next Page »