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
|
% Copyright (c) 2003-2005 Vladimir Volovich <vvv@vsu.ru>
% cmap package -- download CMap files into PDF
% to make "search" and "cut-n-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}.cmap
% Usage: put \usepackage{cmap} immediately after the \documentclass line
% Thanks to:
% Han The Thanh
% Maxim I. Tishin
% Petr Sojka
% Werner Lemberg
% TODO:
% add *.cmap files for other font encodings (contributions are welcome):
% TS1, OT1, OT2, LY1, IL2, OML, OMS, ...
% support dvips?
% History:
% 2003/03/07 private version
% 2003/03/11 version 1.0: first public version
% 2003/03/13 version 1.0a:
% change error to warning for non-pdftex
% added warnings if cmap is loaded after fontenc or babel
% added t5.cmap - thanks to Han The Thanh
% 2003/03/19 version 1.0b:
% minor refinements
% 2003/05/22 version 1.0c:
% fixed a typo due to which the package had no effect at all
% 2004/06/16 version 1.0d (wl):
% add support for subfonts as used in the CJK package
% 2005/05/03 version 1.0e:
% do not fail under pdftex with \pdfoutput=0 (thanks to Robin Fairbairns)
\ProvidesPackage{cmap}[2004/06/16 v1.0e CMap support: searchable PDF]
\@ifundefined{pdffontattr}{%
% The cmap package can be used only with pdflatex,
% but not with ordinary latex
\PackageWarningNoLine{cmap}{pdftex not detected - will not do anything}%
\endinput
}\relax
\ifnum\pdfoutput<1
\PackageWarningNoLine{cmap}{pdftex in DVI mode - will not do anything}
\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
\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\pdfobj stream
%attr {/Type /CIDFile}
file {\reserved@f}%
\expandafter\xdef\csname cmap@set@\cmap@f@encoding\endcsname{%
\noexpand\expandafter\pdffontattr\noexpand\font@name{/ToUnicode \the\pdflastobj\space 0 R}}%
}{%
\global\expandafter\let\csname cmap@set@\cmap@f@encoding\endcsname\empty
}%
}
\def\cmap@hook{%
\@ifundefined{CJK@plane}{%
\edef\cmap@f@encoding{\f@encoding}%
}{%
\edef\cmap@f@encoding{\f@encoding\CJK@plane}%
}%
\@ifundefined{cmap@set@\cmap@f@encoding}{\cmap@load}\relax
\csname cmap@set@\cmap@f@encoding\endcsname
}
\endinput
|