[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Improve XeTeX PDF outline support
From: |
Masamichi HOSODA |
Subject: |
Improve XeTeX PDF outline support |
Date: |
Mon, 08 Feb 2016 01:26:24 +0900 (JST) |
texinfo.tex ver. 2016-02-07.16 can not compile following attached files.
test-U201E.texi
test-set-value.texi
I've fixed it.
Here's the patch for texinfo.tex ver. 2016-02-07.16.
ChangeLog:
Improve XeTeX PDF outline support
2016-02-XX 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.
\input texinfo.tex @c -*- coding: utf-8 -*-
@documentencoding UTF-8
@contents
@node „
@chapter test „: U+201E
„: U+201E DOUBLE LOW-9 QUOTATION MARK
@bye
\input texinfo.tex
@documentencoding UTF-8
@contents
@set foo-bar_ test test test
@node nøùü @address@hidden
@chapter øùü @address@hidden test
øùü
@bye
--- texinfo.tex.org 2016-02-08 01:22:13.800799100 +0900
+++ texinfo.tex 2016-02-08 01:23:28.667073400 +0900
@@ -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 }
Re: XeTeX @image support, Gavin Smith, 2016/02/05