Language icons

Language symbols
Language symbols, a photo by viralbus on Flickr.
The existence of national flags makes it easy to create country icons (e.g., in a menu where you can select your country of residence).

However, at least in a web context it’s relatively rare to provide country menus. On the other hand, language menus are common, allowing the user the view the page in another language. Wikipedia is a good example of this.

Unfortunately, there is no accepted way to symbolise languages. Wikipedia writes the language names out in full, and other websites use two- or three-letter ISO codes.

When a graphical icon is needed, people often resort to national flags, but that really isn’t a very good solution at all: Some languages (such as English and Spanish) are used in many countries, and many countries have more than one official language (e.g., Scotland and Belgium).

I really wish somebody would come up with some language symbols/icons that everybody could agree on. For the purpose of this blog post, I played around with the idea of using three concentric circles in various colours (loosely based on the flags of the main countries where the language is spoken), with the ISO code in the middle, but I fear they look too similar.

Perhaps using shapes as well as colour would help, but the danger is that it would be hard to identify one of the icons out of context.

Even if the whole world could agree on a set of language icons, it would still be a challenge to teach ordinary people to recognise the one associated with their native language, but it should be possible. If websites such as Wikipedia adopted them, their use would spread quickly.

It would be really useful!

Typesetting Gaelic in Gaelic type

Gaelic in Gadelica.
Gaelic in Gadelica.
In Ireland, Gaelic type is widely used for writing Irish (although mainly for decorative purposes these days, if I’m not mistaken). On the other hand, it’s hardly ever used in Scotland, although Irish and Scottish Gaelic are very closely related.

However, I thought it’d be nice to be able to typeset Gaelic in Gaelic type using TeX/LaTeX/XeLaTeX.

After a big of googling, I found a very nice font called Gadelica.

This is a beautiful OpenType font (and it supports the grave accents used in Scottish Gaelic, not just the acute ones used in Irish), but there is a slight problem: It assumes that the dotted letters (e.g., ‘?’ instead of ‘ch’) have been coded in Unicode rather than using the normal digraphs.

To solve this, I created a TECkit mapping (see below for the complete mapping file). Once you’ve compiled it, you can now easily create a XeLaTeX document and select font and mapping with \setromanfont[Mapping=gadelica]{Gadelica}, and you can now input the normal ligatures. For instance, the second line in the illustration above is simply given as Dh’fheuch am faic mi fear a’ bhàta in the source file.

Here’s the complete mapping file, gadelica.map (compile with teckit_compile gadelica.map):

LHSName "Gadelica"
RHSName "UNICODE"

pass(Unicode)

U+0062 U+0068 <> U+1E03 ;bh
U+0063 U+0068 <> U+010B ;ch
U+0064 U+0068 <> U+1E0B ;dh
U+0066 U+0068 <> U+1E1F ;fh
U+0067 U+0068 <> U+0121 ;gh
U+006D U+0068 <> U+1E41 ;mh
U+0070 U+0068 <> U+1E57 ;ph
U+0073 U+0068 <> U+1E61 ;sh
U+0074 U+0068 <> U+1E6B ;th
U+0042 U+0048 <> U+1E02 ;BH
U+0043 U+0048 <> U+010A ;CH
U+0044 U+0048 <> U+1E0A ;DH
U+0046 U+0048 <> U+1E1E ;FH
U+0047 U+0048 <> U+0120 ;GH
U+004D U+0048 <> U+1E40 ;MH
U+0050 U+0048 <> U+1E56 ;PH
U+0053 U+0048 <> U+1E60 ;SH
U+0054 U+0048 <> U+1E6A ;TH
U+0053 U+0048 <> U+1E60 ;SH
U+0054 U+0048 <> U+1E6A ;TH
U+0042 U+0068 <> U+1E02 ;Bh
U+0043 U+0068 <> U+010A ;Ch
U+0044 U+0068 <> U+1E0A ;Dh
U+0046 U+0068 <> U+1E1E ;Fh
U+0047 U+0068 <> U+0120 ;Gh
U+004D U+0068 <> U+1E40 ;Mh
U+0050 U+0068 <> U+1E56 ;Ph
U+0053 U+0068 <> U+1E60 ;Sh
U+0054 U+0068 <> U+1E6A ;Th

; Some stuff from tex-text.map:
U+002D U+002D <> U+2013 ; -- -> en dash
U+002D U+002D U+002D <> U+2014 ; --- -> em dash

U+0027 <> U+2019 ; ' -> right single quote
U+0027 U+0027 <> U+201D ; '' -> right double quote
U+0022 > U+201D ; " -> right double quote

U+0060 <> U+2018 ; ` -> left single quote
U+0060 U+0060 <> U+201C ; `` -> left double quote

A symbol for “is pronounced the same as”

Yesterday’s blog posting made me think about the lack of a symbol for “is pronounced the same as”.

What I mean is that instead of writing that “write is pronounced the same as right“, we could just write “write ? right“.

I here used the symbol “?”, not because I think it’s ideal, but because it’s available. Other available Unicode characters based on the equal sign include the following: ? ? ? ? ? ? ?

However, ideally I think I’d want square brackets on top of an equal sign because pronunciations are given in square brackets, like this:

Does anybody know of any existing symbol that has been used for this?

TECkit

Mixing three alphabetsAfter the Mac arrived last week, one of the first programs I installed was TeXShop.

That caused me to play around with XeTeX, which – although it’s also available for Linux – I had never really got around to playing around with.

One interesting feature I noticed immediately was the maps: When loading a font one can specify an input mapping like this: \setmainfont[Mapping=tex-text]{Gentium} and this will cause -- to be mapped to – etc.

I wanted to play around with this, but there didn’t seem to be an information on these maps included.

However, a bit of googling told me that it’s a SIL invention. On Linux/Unix, just download the source code and compile it, and on Windows and Mac, you can download precompiled programs.

Once that’s in place, you can start having fun!

As an example, create a map file with the following contents and call it firsttest.map:

LHSName	"FirstTest"
RHSName	"UNICODE"

pass(Unicode)

;Greek
U+0061    <>   U+03B1    ; a
U+0062    <>   U+03B2    ; b
U+0064    <>   U+03B4    ; d
U+0065    <>   U+03B5    ; e
U+0074    <>   U+03C4    ; t
U+0069    <>   U+03B9    ; i
;Cyrillic
U+0063    <>   U+0446    ; c
U+006C    <>   U+043B    ; l
U+006D    <>   U+043C    ; m
U+0067    <>   U+0433    ; g

Now compile it with teckit_compile firsttest.map, and you can now load it in XeTeX like this: \setmainfont[Mapping=firsttest]{Gentium}.

After doing this, anything typeset with the main font will come out in an interesting mixture of Latin, Greek and Cyrillic (see the illustration above).

This is of course a fairly silly example, but it can be really useful if you’re not comfortable typing another language directly, or if there is no keyboard layout available and you don’t want to define one yourself.

How to make business cards in LaTeX



My business card
Originally uploaded by viralbus

When we set up our company, we needed some business cards.

VistaPrint will make business cards from a PDF file made according to the following specifications: “Full Bleed Size: 90mm x 52mm; Document Trim Size: 87mm x 49mm”.

I prefer doing typography in LaTeX, so I just needed to set this up properly.

I had a few problems with the margins, but with some help from DK-TUG‘s mailing list, I came up with the following:

\documentclass[11pt,a4paper]{memoir}
\setstocksize{52mm}{90mm}
\setpagecc{49mm}{87mm}{*}
\settypeblocksize{43mm}{81mm}{*}
\setulmargins{3mm}{*}{*}
\setlrmargins{3mm}{*}{*}
\setheadfoot{0.1pt}{0.1pt}
\setheaderspaces{1pt}{*}{*}
\checkandfixthelayout[fixed]
\pagestyle{empty}
\usepackage{color}
\begin{document}
\pagecolor[cmyk]{...}
...
\end{document}

The “[fixed]” option is very important here, but it is only available in the newest versions of memoir, so you might need to upgrade this package if you have problems getting it to work.

After designing the actual business card, I ran it through pdflatex and uploaded the resulting file to VistaPrint, and it worked beautifully, as can be seen on the photo.

Font design

Normally when you design a font these days, you use a program like FontForge, which is basically a glorified drawing program.

You can do anything you want, but it’s basically up to you to make the individual characters looks similar so that they combine to form a unified and beautiful font.

If you use a program like METAFONT instead, you have more options. You can define a “pen”, for instance a rotated oval, that you can draw shapes with, and you can define functions, for instance to produce serifs in a given location. However, you have to sacrifice drawing the basic shape with your mouse and have to use mathematical expressions instead.

So I’ve been wondering for some years whether it would be possible/feasible to write a font design program that lets you define a sophisticated “pen” that not only has a shape, but also comes with serifs to leave at the start and end points of a line. The serifs and the shape could depend on the direction of the stroke.

So with such a pen defined, you could then draw the basic shape in your drawing program and all the sophisticated bits would appear automagically.

In other words, I suggest drawing the top character on the right manually in the drawing program, but using fancy “pens” to turn that basic shape into all the variants beneath.

The resulting font could then be loaded into FontForge for fine-tuning, but it should be much faster than drawing an entire font by hand.

Has something like this ever been done yet?