# [XeTeX] Several apostrophe-related problems (kerning, mapping)

John Was john.was at ntlworld.com
Mon Nov 1 11:07:29 CET 2010

Oh dear - I don't use these packages at all so won't be of much help.  Do you have to create a TOC entry in the body of your text, with a command such as \toc{L'incertitude}?  If so, you might get away with \toc{L\noexpand 'incertitude}.  But this will mess things up if L'incertitude has also to be typeset in the main text at this point - and it may not work anyway.

If you get a UTF file of your table of contents, you could simply do a global search-and-replace, altering "2019 to the apostrophe - but if all that is done in the background and the package produces a finalized table of contents (as a PDF) then you have no chance to intervene.

Sorry if my suggestions have got you into difficulties.   You could always revert to what you were doing before and ask the supporters of the various packages you use to help you out.

John

----- Original Message -----
From: Pierre Morel
To: Unicode-based TeX for Mac OS X and other platforms
Sent: 01 November 2010 09:46
Subject: Re: [XeTeX] Several apostrophe-related problems (kerning, mapping)

Ouch, I thought everything was solved... but now there is a problem in the PDF TOC generated by hyperref.
Basically, instead of having
L'incertitude
I get:
L"2019incertitude

...not very nice.
Hyperref produces some warnings:

Package hyperref Warning: Token not allowed in a PDF string (Unicode):
(hyperref)                \kern 0.00003pt
(hyperref)                removed on input line 308.

Package hyperref Warning: Token not allowed in a PDF string (Unicode):
(hyperref)                removing \hbox' on input line 308.

Package hyperref Warning: Token not allowed in a PDF string (Unicode):
(hyperref)                removing \char' on input line 308.

Now that everything else works, how to prevent this hyperref problem ?

Thanks

Pierre

Le 31 oct. 2010 à 23:19, John Was a écrit :

Hello Pierre

I'm sorry to say that I can't help with the marginal kerning - I've never investigated that facility in TeX since the output I get without it has always seemed OK (to my eye) in the work I do.  What seems to be happening is that the TeX mapping is being ignored by the package that deals with the marginal kerning, so when in the \active hacks that I sent you the true apostrophe is being replaced by the upright ', the package is giving you the latter instead of switching it to the correct typographical sort as your TeX mapping specifies.  I'm sure those maintaining the package will be able to come up with some proper solution, but in the meantime you could try bypassing the TeX mapping for apostrophes and closing quotation marks by using the correct Unicode characters (as I think you have already done with the single quotation mark/apostrophe).

In spite of my misgivings about using an active character in the definition of that very same character, the following does seem to work without causing processing errors:

\catcode"2019=\active
\def’{\leavevmode \kern 1sp \hbox{\char"2019}}
\catcode"201D=\active
\def”{\leavevmode \kern 1sp \hbox{\char"201D}}

Try that instead of my previous four lines of code and see what happens!

John

----- Original Message ----- From: "Pierre Morel" <pier.morel at gmail.com>
To: "Unicode-based TeX for Mac OS X and other platforms" <xetex at tug.org>
Sent: 31 October 2010 18:14
Subject: Re: [XeTeX] Several apostrophe-related problems (kerning, mapping)

Thank you John, your hack indeed solves the problem when U+0027 apostrophes are replaced with U+2019 apostrophes (I did not try to make U+0027 active) and when the margin kering is not activated.

However, replacing U+0027 with U+2019 apostrophes showed that the margin-kerning bug is not due to the tex-text mapping : even when the apostrophes are U+2019 in the source file, they are replaced by U+0027 apostrophes in the PDF !! And this only for the font for which margin kerning is activated.

Any ideas on this last problem ?

Le 31 oct. 2010 à 16:32, John Was a écrit :

Hello

I can't help with the marginal kering (which I don't use), but here is what I do in a font that also had overtight kerning associated with apostrophes:

\catcode"2019=\active

\def’{\leavevmode \kern 1sp \hbox{'}}

\catcode"201D=\active

\def”{\leavevmode \kern 1sp \hbox{''}}

Note that the characters in the \hboxes are the ordinary straight apostrophe (since I also use TeX mapping in my font calls.)

As it stands, this would involve you actually using the correct Unicode characters 2019 and 201D for closing single and double apostrophes in your document, in spite of your tex-mapping - and I guess you could achieve this by global search-and-replace in your file.  But you  may be able to do much the same thing by making 0027 active instead (I haven't tried that - I can see a potential danger of a loop if you are using 0027 to define itself).

I'm sure there are more elegant solutions - and I use plain TeX so there may be LaTeX issues that I don't know about.

(Of course, if my request for custom kerning could be met, we would all be able to refine the kerning of any font at will.  Unfortunately, someone in another thread explained that that is very difficult in XeTeX because of the way it looks up font information (LuaTeX can do it because it has another method of accessing the font's tables).  I was rather hoping that someone would see that as an opportunity to show off hrs computing prowess by performing the miracle - but this hasn't happened yet.)

John

----- Original Message ----- From: "Pierre Morel" <pier.morel at gmail.com>

To: "Unicode-based TeX for Mac OS X and other platforms" <xetex at tug.org>

Sent: 31 October 2010 15:02

Subject: [XeTeX] Several apostrophe-related problems (kerning, mapping)

Hello,

My thesis is finished soon, but I have an annoying apostrophe problem.

In French we have a lot of apostrophes uses like this : L'œil, l'incertitude, etc.

In theory, these apostrophes should be the unicode character U+2019 (right single quotation mark) instead of a straight apostrophe (U+0027). This replacement is automatically made by this command : \defaultfontfeatures{Mapping=tex-text}

First there is a problem with the kerning of this U+2019 character, it is possibly a bug in the font I'm using (Adobe Caslon Pro), but I'd like to solve it anyway.

Here is an example (The word L'œil, on the top right) :

http://dl.dropbox.com/u/1205127/Images/xetex.jpg

The apostrophe is completely kerned above the "œ" (the same problem is present for any small character), which thus touches the "L".

So my first question is: is there a way to override the default kerning of this U+2019 character so that it behaves in a more correct way (with a slight space between the apostrophe and the next letter) ?

Now there is a second problem (which solved the first one but in a bad way).

When activating margin kerning, xetex behaves as if the line \defaultfontfeatures{Mapping=tex-text} was not present : U+0027 apostrophes stay straight (which curiously solves the kerning problem, see the example on the top left of the image), and  and '' are not converted appropriately (more annoying).

Here is what I use for the margin kerning (when I comment these line, the mapping problem is corrected) :

\newcount\countA

\ifx\XeTeXprotrudechars\undefined

\pdfprotrudechars=2

\else

\let\pdftexversion=\countA

\pdftexversion = 140

\XeTeXprotrudechars=2%\fi

\input protcode-native

\font\f="Adobe Caslon Pro" at 11pt \f

\setprotcode\f

\pretolerance=-1

\tolerance=9999

\emergencystretch=2em

With the file protcode-native file being

\def\setprotcode#1{

\rpcode#1 U"0021    55

\rpcode#1 U"002C    194

\rpcode#1 U"002D    233

\rpcode#1 U"002E    194

\rpcode#1 U"003B    138

\rpcode#1 U"003A    138

\rpcode#1 U"003F    94

\lpcode#1 U"2018    194

\rpcode#1 U"2019    194

\rpcode#1 U"0027    194

\lpcode#1 U"201C    250

\rpcode#1 U"201D    250

\rpcode#1 U"2013    150

\rpcode#1 U"2014    200

}

So, in short, I want to use margin kerning while maintaining the tex-text mapping AND having a correct kerning with the U+2019 apostrophe.

PS: (this last problem also appears on my sans serif font (Myriad pro), an example is visible in the linked image.

Thank you,

Pierre

--------------------------------------------------

Subscriptions, Archive, and List information, etc.:

http://tug.org/mailman/listinfo/xetex

--------------------------------------------------

Subscriptions, Archive, and List information, etc.:

http://tug.org/mailman/listinfo/xetex

--------------------------------------------------
Subscriptions, Archive, and List information, etc.:
http://tug.org/mailman/listinfo/xetex

--------------------------------------------------
Subscriptions, Archive, and List information, etc.:
http://tug.org/mailman/listinfo/xetex

------------------------------------------------------------------------------

--------------------------------------------------
Subscriptions, Archive, and List information, etc.:
http://tug.org/mailman/listinfo/xetex
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://tug.org/pipermail/xetex/attachments/20101101/73fae5a5/attachment-0001.html>