texinfo-commits
[Top][All Lists]
Advanced

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

[7002] xetex pdf outline


From: Masamichi Hosoda
Subject: [7002] xetex pdf outline
Date: Mon, 08 Feb 2016 13:34:33 +0000

Revision: 7002
          http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=7002
Author:   trueroad
Date:     2016-02-08 13:34:32 +0000 (Mon, 08 Feb 2016)
Log Message:
-----------
xetex pdf outline

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/doc/texinfo.tex

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog     2016-02-07 16:17:01 UTC (rev 7001)
+++ trunk/ChangeLog     2016-02-08 13:34:32 UTC (rev 7002)
@@ -1,3 +1,11 @@
+2016-02-08  Masamichi Hosoda  <address@hidden>
+
+       * doc/texinfo.tex:
+       Improve XeTeX PDF outline support.
+       (\pdfmkdest): Add \indexnofonts and \makevalueexpandable.
+       (\dopdfoutline): Add \turnoffactive.
+       (\pdfmakeoutlines): Add some comments. Use \let instead of \def.
+
 2016-02-07  Masamichi Hosoda  <address@hidden>
 
        * doc/texinfo.tex (\unicodechardefs): Comment out end of lines 

Modified: trunk/doc/texinfo.tex
===================================================================
--- trunk/doc/texinfo.tex       2016-02-07 16:17:01 UTC (rev 7001)
+++ trunk/doc/texinfo.tex       2016-02-08 13:34:32 UTC (rev 7002)
@@ -1455,26 +1455,38 @@
 \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{%
-    \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
+    \makevalueexpandable
+    % In the case of XeTeX, xdvipdfmx converts strings to UTF-16.
+    % Therefore \txiescapepdf is not necessary.
+    \safewhatsit{\pdfdest name{#1} xyz}%
+  }}
   %
   \def\dopdfoutline#1#2#3#4{%
     \edef\pdfoutlinedest{#3}%
     \ifx\pdfoutlinedest\empty
       \def\pdfoutlinedest{#4}%
     \fi
-    %
-    \edef\pdfoutlinetext{#1}%
-    %
+    \turnoffactive
+    % 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{%
         \dopdfoutline{##1}{1}{##3}{##4}}%
@@ -1485,24 +1497,33 @@
       \def\numsubsubsecentry##1##2##3##4{%
         \dopdfoutline{##1}{4}{##3}{##4}}%
       %
-      \def\appentry{\numchapentry}%
-      \def\appsecentry{\numsecentry}%
-      \def\appsubsecentry{\numsubsecentry}%
-      \def\appsubsubsecentry{\numsubsubsecentry}%
-      \def\unnchapentry{\numchapentry}%
-      \def\unnsecentry{\numsecentry}%
-      \def\unnsubsecentry{\numsubsecentry}%
-      \def\unnsubsubsecentry{\numsubsubsecentry}%
+      \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 }




reply via email to

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