bug-texinfo
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: XeTeX PDF outline support


From: Masamichi HOSODA
Subject: Re: XeTeX PDF outline support
Date: Fri, 05 Feb 2016 00:21:15 +0900 (JST)

>> I've made XeTeX PDF outline support patch.
> 
> Excellent, thanks!

My previous XeTeX PDF outline support patch could not compile
LilyPond German texi documents.
I've fixed it.

It can compile LilyPond all languages texi documents
by combining the following patches.

http://lists.gnu.org/archive/html/bug-texinfo/2016-02/msg00009.html
http://lists.gnu.org/archive/html/bug-texinfo/2016-02/msg00010.html
http://lists.gnu.org/archive/html/bug-texinfo/2016-02/msg00011.html
--- texinfo.tex.org     2016-02-03 22:33:14.500957900 +0900
+++ texinfo.tex 2016-02-04 23:17:51.688395300 +0900
@@ -1450,6 +1450,86 @@
 \fi  % \ifx\pdfoutput
 
 %
+% PDF outline support for XeTeX
+%
+\ifx\XeTeXrevision\thisisundefined
+\else
+  \pdfmakepagedesttrue \relax
+  % Emulate the primitive of pdfTeX
+  \def\pdfdest name#1 xyz{%
+    \special{pdf:dest (name#1) address@hidden /XYZ @xpos @ypos]}%
+  }
+  \def\pdfmkdest#1{{%
+    % We have to set dummies so commands such as @code, and characters
+    % such as \, aren't expanded when present in a section title.
+    \indexnofonts
+    \turnoffactive
+    \makevalueexpandable
+    % In the case of XeTeX, xdvipdfmx converts strings to UTF-16.
+    % Therefore \txiescapepdf is not necessary.
+    \safewhatsit{\pdfdest name{#1} xyz}%
+  }}
+  %
+  \def\dopdfoutlinexetex#1#2#3#4{%
+    \edef\pdfoutlinedest{#3}%
+    \ifx\pdfoutlinedest\empty
+      \def\pdfoutlinedest{#4}%
+    \fi
+    % In the case of XeTeX, xdvipdfmx converts strings to UTF-16.
+    % Therefore \txiescapepdf is not necessary.
+    \special{pdf:out [-] #2 << /Title (#1) /A << /S /GoTo /D 
(name\pdfoutlinedest) >> >> }%
+  }
+  %
+  \def\pdfmakeoutlines{%
+    \begingroup
+      %
+      % In the case of XeTeX, counts of subentries is not necesary.
+      % Therefore, read toc only once.
+      %
+      % We use the node names as the destinations.
+      \def\partentry##1##2##3##4{}% ignore parts in the outlines
+      \def\numchapentry##1##2##3##4{%
+        \dopdfoutlinexetex{##1}{1}{##3}{##4}}%
+      \def\numsecentry##1##2##3##4{%
+        \dopdfoutlinexetex{##1}{2}{##3}{##4}}%
+      \def\numsubsecentry##1##2##3##4{%
+        \dopdfoutlinexetex{##1}{3}{##3}{##4}}%
+      \def\numsubsubsecentry##1##2##3##4{%
+        \dopdfoutlinexetex{##1}{4}{##3}{##4}}%
+      %
+      \let\appentry\numchapentry%
+      \let\appsecentry\numsecentry%
+      \let\appsubsecentry\numsubsecentry%
+      \let\appsubsubsecentry\numsubsubsecentry%
+      \let\unnchapentry\numchapentry%
+      \let\unnsecentry\numsecentry%
+      \let\unnsubsecentry\numsubsecentry%
+      \let\unnsubsubsecentry\numsubsubsecentry%
+      %
+      % In the case of XeTeX, xdvipdfmx converts strings to UTF-16.
+      % Therefore, the encoding and the language may not be considered.
+      %
+      \indexnofonts
+      \setupdatafile
+      % We can have normal brace characters in the PDF outlines, unlike
+      % Texinfo index files.  So set that up.
+      \def\{{\lbracecharliteral}%
+      \def\}{\rbracecharliteral}%
+      \catcode`\\=\active \otherbackslash
+      \input \tocreadfilename
+    \endgroup
+  }
+  {\catcode`[=1 \catcode`]=2
+   \catcode`{=\other \catcode`}=\other
+   \gdef\lbracecharliteral[{]%
+   \gdef\rbracecharliteral[}]%
+  ]
+
+  \special{pdf:docview << /PageMode /UseOutlines >> }
+  \special{pdf:tounicode UTF8-UTF16 }
+\fi
+
+%
 % @image support for XeTeX
 %
 \newif\ifxeteximgpdf
\input texinfo.tex @c -*- coding: utf-8 -*-

@documentencoding UTF-8
@documentlanguage de

@node „
@subsection test U+201E

„: U+201E DOUBLE LOW-9 QUOTATION MARK

@bye

reply via email to

[Prev in Thread] Current Thread [Next in Thread]