diff options
author | Karl Berry <karl@freefriends.org> | 2006-01-12 23:53:12 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2006-01-12 23:53:12 +0000 |
commit | 054e00d3535c6d3f9a3b1384dd02fa29f1d33d37 (patch) | |
tree | 5a31f4b46c001f8d144bd0ae587adb1e133f8bb2 /Master/texmf-dist/tex/latex/cmap/cmap.sty | |
parent | 9365f95aa4fda656d9d504c9e62a6849dc904b3b (diff) |
cmap
git-svn-id: svn://tug.org/texlive/trunk@767 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/cmap/cmap.sty')
-rw-r--r-- | Master/texmf-dist/tex/latex/cmap/cmap.sty | 86 |
1 files changed, 86 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/cmap/cmap.sty b/Master/texmf-dist/tex/latex/cmap/cmap.sty new file mode 100644 index 00000000000..836c8866338 --- /dev/null +++ b/Master/texmf-dist/tex/latex/cmap/cmap.sty @@ -0,0 +1,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 |