summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Master/texmf-dist/doc/latex/cmap/README3
-rw-r--r--Master/texmf-dist/tex/latex/cmap/cmap.sty44
2 files changed, 38 insertions, 9 deletions
diff --git a/Master/texmf-dist/doc/latex/cmap/README b/Master/texmf-dist/doc/latex/cmap/README
index 3a012e5b34c..54009c74699 100644
--- a/Master/texmf-dist/doc/latex/cmap/README
+++ b/Master/texmf-dist/doc/latex/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/Master/texmf-dist/tex/latex/cmap/cmap.sty b/Master/texmf-dist/tex/latex/cmap/cmap.sty
index f77cc99d61e..104468d84ff 100644
--- a/Master/texmf-dist/tex/latex/cmap/cmap.sty
+++ b/Master/texmf-dist/tex/latex/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
}%