<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Ouch, I thought everything was solved... but now there is a problem in the PDF TOC generated by hyperref.<div>Basically, instead of having</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>L'incertitude</div><div>I get:</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>L"2019incertitude</div><div><br></div><div>...not very nice.</div><div>Hyperref produces some warnings:</div><div><br></div><div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; ">Package hyperref Warning: Token not allowed in a PDF string (Unicode):</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; ">(hyperref) \kern 0.00003pt</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; ">(hyperref) removed on input line 308.</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; min-height: 14px; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; min-height: 14px; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; ">Package hyperref Warning: Token not allowed in a PDF string (Unicode):</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; ">(hyperref) removing `\hbox' on input line 308.</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; min-height: 14px; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; min-height: 14px; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; ">Package hyperref Warning: Token not allowed in a PDF string (Unicode):</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; ">(hyperref) removing `\char' on input line 308.</div><div><br></div><div>Now that everything else works, how to prevent this hyperref problem ?</div><div><br></div><div>Thanks</div><div><br></div><div>Pierre</div><div><br><div><div>Le 31 oct. 2010 à 23:19, John Was a écrit :</div><br class="Apple-interchange-newline"><blockquote type="cite"><div>Hello Pierre<br><br>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).<br><br>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:<br><br>\catcode"2019=\active<br>\def’{\leavevmode \kern 1sp \hbox{\char"2019}}<br>\catcode"201D=\active<br>\def”{\leavevmode \kern 1sp \hbox{\char"201D}}<br><br>Try that instead of my previous four lines of code and see what happens!<br><br><br><br>John<br><br><br><br><br>----- Original Message ----- From: "Pierre Morel" <<a href="mailto:pier.morel@gmail.com">pier.morel@gmail.com</a>><br>To: "Unicode-based TeX for Mac OS X and other platforms" <<a href="mailto:xetex@tug.org">xetex@tug.org</a>><br>Sent: 31 October 2010 18:14<br>Subject: Re: [XeTeX] Several apostrophe-related problems (kerning, mapping)<br><br><br>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.<br><br>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.<br><br>Any ideas on this last problem ?<br><br><br>Le 31 oct. 2010 à 16:32, John Was a écrit :<br><br><blockquote type="cite">Hello<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">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:<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">\catcode"2019=\active<br></blockquote><blockquote type="cite">\def’{\leavevmode \kern 1sp \hbox{'}}<br></blockquote><blockquote type="cite">\catcode"201D=\active<br></blockquote><blockquote type="cite">\def”{\leavevmode \kern 1sp \hbox{''}}<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">Note that the characters in the \hboxes are the ordinary straight apostrophe (since I also use TeX mapping in my font calls.)<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">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).<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">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.<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">(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.)<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">John<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">----- Original Message ----- From: "Pierre Morel" <<a href="mailto:pier.morel@gmail.com">pier.morel@gmail.com</a>><br></blockquote><blockquote type="cite">To: "Unicode-based TeX for Mac OS X and other platforms" <<a href="mailto:xetex@tug.org">xetex@tug.org</a>><br></blockquote><blockquote type="cite">Sent: 31 October 2010 15:02<br></blockquote><blockquote type="cite">Subject: [XeTeX] Several apostrophe-related problems (kerning, mapping)<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">Hello,<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">My thesis is finished soon, but I have an annoying apostrophe problem.<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">In French we have a lot of apostrophes uses like this : L'œil, l'incertitude, etc.<br></blockquote><blockquote type="cite">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}<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">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.<br></blockquote><blockquote type="cite">Here is an example (The word L'œil, on the top right) :<br></blockquote><blockquote type="cite"><a href="http://dl.dropbox.com/u/1205127/Images/xetex.jpg">http://dl.dropbox.com/u/1205127/Images/xetex.jpg</a><br></blockquote><blockquote type="cite">The apostrophe is completely kerned above the "œ" (the same problem is present for any small character), which thus touches the "L".<br></blockquote><blockquote type="cite">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) ?<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">Now there is a second problem (which solved the first one but in a bad way).<br></blockquote><blockquote type="cite">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).<br></blockquote><blockquote type="cite">Here is what I use for the margin kerning (when I comment these line, the mapping problem is corrected) :<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">\newcount\countA<br></blockquote><blockquote type="cite">\ifx\XeTeXprotrudechars\undefined<br></blockquote><blockquote type="cite"> \pdfprotrudechars=2<br></blockquote><blockquote type="cite">\else<br></blockquote><blockquote type="cite"> \let\pdftexversion=\countA<br></blockquote><blockquote type="cite"> \pdftexversion = 140<br></blockquote><blockquote type="cite"> \XeTeXprotrudechars=2%\fi<br></blockquote><blockquote type="cite">\input protcode-native<br></blockquote><blockquote type="cite">\font\f="Adobe Caslon Pro" at 11pt \f<br></blockquote><blockquote type="cite">\setprotcode\f<br></blockquote><blockquote type="cite"> \pretolerance=-1<br></blockquote><blockquote type="cite"> \tolerance=9999<br></blockquote><blockquote type="cite"> \emergencystretch=2em<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">With the file protcode-native file being<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">\def\setprotcode#1{<br></blockquote><blockquote type="cite"> \rpcode#1 U"0021 55<br></blockquote><blockquote type="cite"> \rpcode#1 U"002C 194<br></blockquote><blockquote type="cite"> \rpcode#1 U"002D 233<br></blockquote><blockquote type="cite"> \rpcode#1 U"002E 194<br></blockquote><blockquote type="cite"> \rpcode#1 U"003B 138<br></blockquote><blockquote type="cite"> \rpcode#1 U"003A 138<br></blockquote><blockquote type="cite"> \rpcode#1 U"003F 94<br></blockquote><blockquote type="cite"> \lpcode#1 U"2018 194<br></blockquote><blockquote type="cite"> \rpcode#1 U"2019 194<br></blockquote><blockquote type="cite"> \rpcode#1 U"0027 194<br></blockquote><blockquote type="cite"> \lpcode#1 U"201C 250<br></blockquote><blockquote type="cite"> \rpcode#1 U"201D 250<br></blockquote><blockquote type="cite"> \rpcode#1 U"2013 150<br></blockquote><blockquote type="cite"> \rpcode#1 U"2014 200<br></blockquote><blockquote type="cite">}<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">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.<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">PS: (this last problem also appears on my sans serif font (Myriad pro), an example is visible in the linked image.<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">Thank you,<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">Pierre<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">--------------------------------------------------<br></blockquote><blockquote type="cite">Subscriptions, Archive, and List information, etc.:<br></blockquote><blockquote type="cite"><a href="http://tug.org/mailman/listinfo/xetex">http://tug.org/mailman/listinfo/xetex</a><br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">--------------------------------------------------<br></blockquote><blockquote type="cite">Subscriptions, Archive, and List information, etc.:<br></blockquote><blockquote type="cite"><a href="http://tug.org/mailman/listinfo/xetex">http://tug.org/mailman/listinfo/xetex</a><br></blockquote><br><br><br><br>--------------------------------------------------<br>Subscriptions, Archive, and List information, etc.:<br> <a href="http://tug.org/mailman/listinfo/xetex">http://tug.org/mailman/listinfo/xetex</a> <br><br><br>--------------------------------------------------<br>Subscriptions, Archive, and List information, etc.:<br> <a href="http://tug.org/mailman/listinfo/xetex">http://tug.org/mailman/listinfo/xetex</a><br></div></blockquote></div><br></div></div></body></html>