[XeTeX] adding some diacritics to a font

Fr. Michael Gilmary FrMichaelGilmary at MaroniteMonks.org
Wed Jan 7 21:54:53 CET 2009


François Patte wrote:


> Thanks Michael, for these macros, but I have some problem: the one you
> sent yesterday doesn't work properly: I get a mixing of a w with an n
> with a trema above....?????
>
>   

In yesterday's post, I used the \XeTeXglyph command for \dotunder since 
the character palette revealed that there's no Unicode ID for it, only a 
glyph ID(=GID).... maybe you have a different version of the font than 
we have (OTF). Otherwise I can't say what's causing that problem.

> The \dotontop you sent today works.
>   

I suppose that's because the "dot above" glyph *does* have a Unicode ID 
and that's what I used for it. Maybe you could look at the character 
palette (if you're on a Mac) to find something more suitable.


> Ross system also works, but the difference is that with Ross'
> construction, italics are not working and I don't know why.
>   

He's the man to help you on that one.


> Italics are working with your macros but with a strange behaviour: there
> is a big space added before the letter with dot (over or under).
>   

Now that I test things, the italic presents problems. What /I/ get is a 
"LATIN CAPITAL LETTER O WITH HORN AND HOOK ABOVE", (Unicode char 1EDE), 
which has the GID of 2082 (what I used for upright shape)! So, if you 
switch to italics, you have to use the GID 2281, which then can be rendered:

\def\ITdotunder#1{\leavevmode \vtop{\offinterlineskip \ialign{##\cr 
#1\cr\setbox0=\hbox{\hbox{{\XeTeXglyph2281}}}\ht0=0pt\dp0=0pt\hidewidth\box0

And it works fine, at least here. See example below.


%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%

\documentclass[11pt]{article}
\usepackage{xltxtra}

\defaultfontfeatures{Mapping=tex-text}
\setromanfont[Ligatures=Common, Numbers=OldStyle]{Garamond Premier Pro}

\def\dotontop#1{\leavevmode \vtop{\offinterlineskip \ialign{##\cr 
#1\cr\setbox0=\hbox{\hbox{\char"02D9}}\ht0=0pt\dp0=0pt\hidewidth\box0
\hidewidth\cr}}}

%XeTeXglyph2281 for italic

\def\ITdotunder#1{\leavevmode \vtop{\offinterlineskip \ialign{##\cr 
#1\cr\setbox0=\hbox{\hbox{{\XeTeXglyph2281}}}\ht0=0pt\dp0=0pt\hidewidth\box0
\hidewidth\cr}}}

\def\dotunder#1{\leavevmode \vtop{\offinterlineskip \ialign{##\cr 
#1\cr\setbox0=\hbox{\hbox{{\XeTeXglyph2082}}}\ht0=0pt\dp0=0pt\hidewidth\box0
\hidewidth\cr}}}

\newcommand\Testthis{I\dotunder{n}to house and u\dotontop{n}der a box.}
\newcommand\ITTestthis{I\ITdotunder{n}to house and u\dotontop{n}der a box.}

\begin{document}

\Testthis

\textit{\ITTestthis}

\textsc{\Testthis}

\textbf{\Testthis}

{\scshape\bfseries\Testthis}

\end{document}



-- 
United in adoration of Jesus, 



fr. michael gilmary, mma

Most Holy Trinity Monastery
67 Dugway Road
Petersham, MA 01366-97255




More information about the XeTeX mailing list