summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/cmap
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2021-02-07 03:00:48 +0000
committerNorbert Preining <norbert@preining.info>2021-02-07 03:00:48 +0000
commite068841d2fc2976d094b382e4dd5e4d6df455506 (patch)
treea10b009fa5e01a531fa1eb92723f24ae05ba6d4e /macros/latex/contrib/cmap
parent27accb929aa8061d3aea791560a1bffd3876f0c7 (diff)
CTAN sync 202102070300
Diffstat (limited to 'macros/latex/contrib/cmap')
-rw-r--r--macros/latex/contrib/cmap/README3
-rw-r--r--macros/latex/contrib/cmap/cmap.sty44
2 files changed, 38 insertions, 9 deletions
diff --git a/macros/latex/contrib/cmap/README b/macros/latex/contrib/cmap/README
index 3a012e5b34..54009c7469 100644
--- a/macros/latex/contrib/cmap/README
+++ b/macros/latex/contrib/cmap/README
@@ -92,3 +92,6 @@ History:
change was inspired by discussion with Alexey Kuligin and Alexey Vikhlinin.
2021/01/29 version 1.0i:
suppress cmaps automatically generated by pdfTeX for all handled fonts
+2021/02/06 version 1.0j:
+ Don't fail if \pdfnobuiltintounicode primitive is missing
+ Add support for LuaTeX without luatex85
diff --git a/macros/latex/contrib/cmap/cmap.sty b/macros/latex/contrib/cmap/cmap.sty
index f77cc99d61..104468d84f 100644
--- a/macros/latex/contrib/cmap/cmap.sty
+++ b/macros/latex/contrib/cmap/cmap.sty
@@ -11,7 +11,7 @@
% Werner Lemberg
% Oleg Katsitadze
-\ProvidesPackage{cmap}[2021/01/29 v1.0i CMap support: searchable PDF]
+\ProvidesPackage{cmap}[2021/02/06 v1.0j CMap support: searchable PDF]
\DeclareOption{resetfonts}{%
\@for\reserved@a:=%
@@ -26,12 +26,27 @@
\ProcessOptions
\@ifundefined{pdffontattr}{%
-% The cmap package can be used only with pdflatex,
+ \@ifundefined{pdfextension}{%
+% The cmap package can be used only with pdflatex and lualatex,
% but not with ordinary latex
- \PackageWarningNoLine{cmap}{pdftex not detected - exiting}%
- \endinput
-}\relax
-\ifnum\pdfoutput<1
+ \PackageWarningNoLine{cmap}{pdftex not detected - exiting}%
+ \endinput
+ }{%
+ \protected\def\cmap@pdfobj{\pdfextension obj }%
+ \protected\def\cmap@fontattr{\pdfextension fontattr }%
+ \def\cmap@lastobj{\number\pdffeedback lastobj \space 0 R}%
+ }%
+}{%
+ \let\cmap@pdfobj\pdfobj
+ \let\cmap@fontattr\pdffontattr
+ \def\cmap@lastobj{\number\pdflastobj\space 0 R}%
+}
+
+\@ifundefined{pdfoutput}{%
+ \ifnum\outputmode<1
+}{%
+ \ifnum\pdfoutput<1
+}%
\PackageWarningNoLine{cmap}{pdftex in DVI mode - exiting}
\expandafter\endinput
\fi
@@ -45,6 +60,17 @@
%\PackageWarningNoLine{cmap}{babel already loaded - some fonts may be unprocessed}%
%}\relax
+\@ifundefined{pdfnobuiltintounicode}{%
+ \@ifundefined{pdfgentounicode}\relax{%
+ \pdfgentounicode=0
+ }%
+ \protected\def\cmap@nobuiltintounicode{%
+ \expandafter\@gobble\the
+ }%
+}{%
+ \let\cmap@nobuiltintounicode\pdfnobuiltintounicode
+}
+
\def\extract@font{%
\get@external@font
\global\expandafter\font\font@name\external@font\relax
@@ -58,12 +84,12 @@
\edef\reserved@f{\lowercase{\def\noexpand\reserved@f{\cmap@f@encoding.cmap}}}%
\reserved@f
\IfFileExists{\reserved@f}{%
- \immediate\pdfobj stream
+ \immediate\cmap@pdfobj stream
%attr {/Type /CIDFile}
file {\reserved@f}%
\expandafter\xdef\csname cmap@set@\cmap@f@encoding\endcsname{%
- \pdfnobuiltintounicode\noexpand\font@name
- \noexpand\expandafter\pdffontattr\noexpand\font@name{/ToUnicode \the\pdflastobj\space 0 R}}%
+ \cmap@nobuiltintounicode\noexpand\font@name
+ \noexpand\expandafter\cmap@fontattr\noexpand\font@name{/ToUnicode \cmap@lastobj}}%
}{%
\global\expandafter\let\csname cmap@set@\cmap@f@encoding\endcsname\empty
}%