1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121
|
% Copyright (c) 2003-2021 Vladimir Volovich <vvv@vsu.ru>
% cmap package -- download CMap files into PDF
% to make "search" and "copy-and-paste" functions work properly
% You may distribute and/or modify this program under the terms of LPPL
% the program consists of cmap.sty and {t1,t2a,t2b,t2c,t5,ot1,ot1tt,lae,lfe}.cmap
% Usage: put \usepackage{cmap} immediately after the \documentclass line
% Thanks to:
% Han The Thanh
% Maxim I. Tishin
% Petr Sojka
% Werner Lemberg
% Oleg Katsitadze
\ProvidesPackage{cmap}[2021/02/06 v1.0j CMap support: searchable PDF]
\DeclareOption{resetfonts}{%
\@for\reserved@a:=%
OT1/cmr/m/n/5,OT1/cmr/m/n/7,OT1/cmr/m/n/10,%
OML/cmm/m/it/5,OML/cmm/m/it/7,OML/cmm/m/it/10,%
OMS/cmsy/m/n/5,OMS/cmsy/m/n/7,OMS/cmsy/m/n/10,%
OMX/cmex/m/n/10%
\do{%
\expandafter\let\csname\reserved@a\endcsname\relax
}%
}
\ProcessOptions
\@ifundefined{pdffontattr}{%
\@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
}{%
\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
\edef\reserved@a{\noexpand\in@{,fontenc.sty,}{\@filelist}}% enc.def
\reserved@a
\ifin@
\PackageWarningNoLine{cmap}{fontenc already loaded - some fonts may be unprocessed}
\fi
%\@ifpackageloaded{babel}{%
%\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
\font@name\relax
\cmap@hook
\csname\f@encoding+\f@family\endcsname
\csname\curr@fontshape\endcsname
\relax
}
\def\cmap@load{%
\edef\reserved@f{\lowercase{\def\noexpand\reserved@f{\cmap@f@encoding.cmap}}}%
\reserved@f
\IfFileExists{\reserved@f}{%
\immediate\cmap@pdfobj stream
%attr {/Type /CIDFile}
file {\reserved@f}%
\expandafter\xdef\csname cmap@set@\cmap@f@encoding\endcsname{%
\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
}%
}
\def\cmap@test@tt{%
\ifdim\fontdimen3\font@name=\z@
\ifdim\fontdimen4\font@name=\z@
\begingroup
\ifdim\fontcharwd\font@name`\i=\fontcharwd\font@name`\w
\edef\reserved@f{\lowercase{\def\noexpand\reserved@f{\cmap@f@encoding tt.cmap}}}%
\reserved@f
\IfFileExists{\reserved@f}{\xdef\cmap@f@encoding{\cmap@f@encoding tt}}\relax
\fi
\endgroup
\fi
\fi
}
\def\cmap@hook{%
\@ifundefined{CJK@plane}{%
\edef\cmap@f@encoding{\f@encoding}%
}{%
\edef\cmap@f@encoding{\f@encoding\CJK@plane}%
}%
\cmap@test@tt
\@ifundefined{cmap@set@\cmap@f@encoding}{\cmap@load}\relax
\csname cmap@set@\cmap@f@encoding\endcsname
}
\endinput
|