# [XeTeX] XeTex and Accents

Fri Jan 18 20:25:48 CET 2008

Hi John:
Thanks for your pointers to solving the problem I had mentioned. The approach followed by exaccent (the style file I am using) is exactly aligned with the approach you had suggested. The current approach requires knowing the encoding used for the font. I don't see how it could be avoided.

regards,

rvaliveti at yahoo.com

----- Original Message ----
From: John Was <john.was at ntlworld.com>
To: Unicode-based TeX for Mac OS X and other platforms <xetex at tug.org>
Sent: Friday, January 18, 2008 12:27:31 AM
Subject: Re: [XeTeX] XeTex and Accents

DIV {
MARGIN:0px;}

Even now I quite often find it useful to
employ an \overstrike macro which must have been one of the first things I wrote
when I started to read the TeXBook.  It superimposes two characters on top
of each other, the narrow centred on the longer.  It could be tidied up a
bit but here it is in its rought state:

\def\overstrike#1#2{\leavevmode

\setbox0=\hbox{#1}\setbox1=\hbox{#2}\copy0
\kern -0.5\wd0 \kern
-0.5\wd1 \copy1 \kern -0.5\wd1 \kern 0.5\wd0}

(You would have to adapt that for LaTeX's
\DeclareTextCommand - I don't (yet) use LaTeX.)

The contents of each box can be varied up and
down (use \smash to give it zero height if you think this is going to interfere
with \baselineskip), and you can invoke characters from different fonts - so if
you have a font with a delicate horizontal bar, for example, that could be used
in #2 of the macro rather than the main font's hyphen character (which will
usually look ugly if you force it to serve as an accent, which it wasn't
designed to be).

You can nest \overstrike commands, which in
the days before the Unicode combining accents was a useful way of getting
something like a macron with an acute above.  Measurements should always be
in terms of em (or ex) so that the right height is chosen regardless of
which point-size you are using.

Now if you find this works nicely with
one font but gives an ugly effect in another, you could use

\if   \else  \fi

to give a series of alternative
definitions.  In your font definitions you would then have to include a
\....true command.  So to switch between definitions for Times and
Garamond, for example, give at the start of your file

\newif \iftimes

\newif \ifgaramond

and whenever one of these fonts is used set
\timestrue or \garamondtrue.

The accent definitions would then
be:

\iftimes [DEFINITION ONE]
\else

\ifgaramond [DEFINITION
TWO]\fi\fi

All this, of course, is very ugly in view of
what you can do neatly with Unicode fonts that have the proper accent support,
but if you are forced into using old fonts, and old .TEX files, this might at
least give you a pointer about how you could control the appearance of
diacritics.

Best

John

---------Original Message -----

From:
Valiveti

To: xetex

Sent: Friday, January 18, 2008 2:59
AM

Subject: [XeTeX] XeTex and Accents

Hi,

I have recently started using xelatex (with MikTex 2.7) instead of pdflatex. I
have a question about getting accents with xetex. Here are couple of
constraints/requirements for what I am looking for:

For the book that I am working we need to use three TTF fonts (for
different portions of the text): MS Trebuchet, Futura, and Arial. I don't
have much freedom in choosing different fonts (since we have to preserve the
formatting used in earlier editions of the book).

The text in each of these fonts may have the accents: \=, \d, and \.
applied to some of the letters. Sometimes, the text with these accents is
underlined as well. In order to make sure that underline doesn't hide the
dot below the letter, I need to control the placement of the dot accurately.

I would like a general solution that would produce controllable
accents/diacritics, regardless of the fonts. If there has to be some
dependence on the fonts, I would like such dependencies to be localized to
very few macros. It appears to me that using the "preformed" character from
the font (if it exists) may not give me all the flexibility I need. What do
you think?

I am currently using the style files: fontspec, exaccent and the
following macros to control the placement of diacritics that I
need:
%======================================
location of
accents
%=======================================
\DeclareTextCommand{\=}{EU1}[1]{\upperaccent[-0.2ex]{"00AF}{#1}}
%macron
\DeclareTextCommand{\.}{EU1}[1]{\upperaccent[-0.2ex]{"00B7}{#1}}
%dot
\DeclareTextCommand{\d}{EU1}[1]{\loweraccent[0.1ex]{"00B7}{#1}}
%dot

But I find that the macron over the letter is just too large and
doesn't look nice (the hyphen looks too small as an overbar). Do we have any
other choice for this?

I would like the same macro(s) to work with (a) older, non-unicode TTF
fonts that have been somehow adapted by fontspec to be usable by xetex, or
(b) newer unicode fonts on my machine. When I tried the unicode font called
"Gentium" (which I found on the scripts.sil.org website), the diacritics over
the letters in this font don't look appealing at all (i.e. the above
TextCommands don't seem to have any affect --- it is perhaps picking a
preformed glyph from the font). Is there anything I can
do?
I look forward to hearing from people who have faced
similar issues, and may have a solution to this issue.

thanks,

rvaliveti at yahoo.com

_______________________________________________
XeTeX mailing
list
postmaster at tug.org
http://tug.org/mailman/listinfo/xetex

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://tug.org/pipermail/xetex/attachments/20080118/c368f302/attachment.html