3

I am importing a custom font that I made into my document, and compiling it using XeLaTeX. Let's call the font "MyFont" for sake of argument.

\documentclass{article}
\font\myfont="MyFont" at 12pt
\begin{document}

{\myfont Hello, world!}

\end{document}

So the result is the character associated with "H" is displayed first, then the character associated with "e", etc. Since this specific font is actually an approximation of an ancient runic script, the displayed characters have some analogies to sounds in English, but not always of a single letter. For instance, one letter sounds something like the English amalgamation "ngh", and some just like "a".

As such, I would like to be able to type {\myfont a{ngh}} and have only two symbols appear. I'm using curly brackets around the "ngh" to show that that is one symbol in the imported font, but it could be any other delimiter.

The symbols are approximations of one, two, or three english letters. Any help in this direction is appreciated!

4
  • Font mapping seems the way to go. Should all ngh groups point to the same character in the font?
    – egreg
    Jan 25, 2013 at 23:40
  • @egreg Not sure what you mean by "groups". I have distinct characters "ngh", "nh", "nn", "n" and "h" that have similar English expressions. And there are no capital letters, just lowercase and punctuation. Jan 26, 2013 at 4:07
  • For instance, can you have nn that represents the double character for n or does any nn combination represent a single character?
    – egreg
    Jan 26, 2013 at 9:43
  • you can define ngh as a ligature if it is an OpenType fonts.
    – user2478
    Jan 26, 2013 at 10:52

1 Answer 1

5

First of all you should never use \font directly in LaTeX (or XeLaTeX, which differs just by what engine is used). The fontspec interface is much better.

\documentclass{article}
\usepackage{fontspec}

\newfontface{\myfont}[Mapping=jimbo,Scale=1.2]{Junicode}

\begin{document}

{\myfont abcnghd}

{\myfont abc/nn/d}

\end{document}

Here is the result (I used Junicode instead of your runic font).

enter image description here

You'll notice that abcnghd in the first line has become "abcZd" and abc/nn/d in the second "abcYd". How did I do it?

I prepared a jimbo.map file by copying the standard tex-text.map file that you can surely find in your TeX distribution and modifying it to read

; TECkit mapping for TeX input conventions <-> Unicode characters

LHSName "TeX-text"
RHSName "UNICODE"

pass(Unicode)

; ligatures from Knuth's original CMR fonts
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

U+0021 U+0060   <>  U+00A1  ; !` -> inverted exclam
U+003F U+0060   <>  U+00BF  ; ?` -> inverted question

; additions supported in T1 encoding
U+002C U+002C   <>  U+201E  ; ,, -> DOUBLE LOW-9 QUOTATION MARK
U+003C U+003C   <>  U+00AB  ; << -> LEFT POINTING GUILLEMET
U+003E U+003E   <>  U+00BB  ; >> -> RIGHT POINTING GUILLEMET

; ADDITIONS FOR JimboBimbo start here    
; ligatures for the runic font

U+006E U+0067 U+0068        <> U+005A ; ngh -> Z
U+002F U+006E U+006E U+002F <> U+0059 ; /nn/ -> Y

It should be clear that this mapping transforms every ngh cluster into a Z and every /nn/ cluster into Y. The font is loaded with the Mapping=jimbo specification, so this will be done only for that font.

The mapping file should be compiled with the teckit_compile utility:

teckit_compile jimbo.map

will produce a jimbo.tec file that you should keep in the working directory (or any other in the XeTeX search tree).

What input form should you prefer? It depends on you. If every ngh cluster should be transformed into Z, just use the first form, which is easier to input. Otherwise, choose a non used character (here I chose /) for grouping clusters.

1
  • Very nice, this worked perfectly for me. Instead of the Scale option of \newfontface, I used SizeFeatures={Size=10}, which makes it easier for me to integrate this font with English text, the size of which is specified in pt, which seems also to be what the 10 refers to in size. And I used / to group clusters as you suggested, because there are separate letters "n", "g" and "h" that might appear together. Thanks! Jan 26, 2013 at 14:35

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .