diff options
Diffstat (limited to 'Master/texmf-dist/source/latex/oberdiek/bmpsize.dtx')
-rw-r--r-- | Master/texmf-dist/source/latex/oberdiek/bmpsize.dtx | 194 |
1 files changed, 121 insertions, 73 deletions
diff --git a/Master/texmf-dist/source/latex/oberdiek/bmpsize.dtx b/Master/texmf-dist/source/latex/oberdiek/bmpsize.dtx index 60251dc0a91..e2528b0e34d 100644 --- a/Master/texmf-dist/source/latex/oberdiek/bmpsize.dtx +++ b/Master/texmf-dist/source/latex/oberdiek/bmpsize.dtx @@ -73,7 +73,7 @@ \input docstrip.tex \Msg{************************************************************************} \Msg{* Installation} -\Msg{* Package: bmpsize 2007/04/11 v1.2 Extract size and resolution data from bitmap files (HO)} +\Msg{* Package: bmpsize 2007/04/29 v1.3 Extract size and resolution data from bitmap files (HO)} \Msg{************************************************************************} \keepsilent @@ -142,7 +142,7 @@ and the derived files %<*driver> \NeedsTeXFormat{LaTeX2e} \ProvidesFile{bmpsize.drv}% - [2007/04/11 v1.2 Extract size and resolution data from bitmap files (HO)]% + [2007/04/29 v1.3 Extract size and resolution data from bitmap files (HO)]% \documentclass{ltxdoc} \usepackage{holtxdoc} \begin{document} @@ -151,7 +151,7 @@ and the derived files %</driver> % \fi % -% \CheckSum{3510} +% \CheckSum{3562} % % \CharacterTable % {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z @@ -172,7 +172,7 @@ and the derived files % \GetFileInfo{bmpsize.drv} % % \title{The \xpackage{bmpsize} package} -% \date{2007/04/11 v1.2} +% \date{2007/04/29 v1.3} % \author{Heiko Oberdiek\\\xemail{oberdiek@uni-freiburg.de}} % % \maketitle @@ -368,7 +368,7 @@ and the derived files % \begin{macrocode} %<*base> \ProvidesPackage{bmpsize-base}% - [2007/04/11 v1.2 Basic part of bmpsize (HO)]% + [2007/04/29 v1.3 Basic part of bmpsize (HO)]% % \end{macrocode} % Modules of package \xpackage{fp} are used for calculations. % \begin{macrocode} @@ -413,6 +413,7 @@ and the derived files \let\bmpsize@unit\relax \let\bmpsize@pixelxdenom\relax \let\bmpsize@pixelydenom\relax + \let\bmpsize@orientation\relax } \def\@bmpsize@stop#1\@nil{} @@ -998,6 +999,15 @@ and the derived files % fi % % 256 ImageWidth (use width of JPG part) % % 257 ImageHeight (use height of JPG part) +% if numeq $tag 274 % Orientation +% skip 6 % type: 3 (short), count: 1 +% num 2 -> $temp +% if numge $temp 0 +% if numle $temp 8 +% assign $temp -> $orientation +% fi +% fi +% fi % if numeq $tag 282 % XResolution % skip 6 % num 4 -> $temp @@ -1254,6 +1264,31 @@ and the derived files \let\bmpsize@exifdensity\bmpsize@exifdensity \fi }% + \ifnum\bmpsize@tag=274\relax + \expandafter\@firstofone + \else + \expandafter\@gobble + \fi + {% + \@bmpsize@skip@four + \@bmpsize@skip@two + \@bmpsize@num@two\bmpsize@temp + \unless\ifnum\bmpsize@temp<0\relax + \expandafter\@firstofone + \else + \expandafter\@gobble + \fi + {% + \unless\ifnum\bmpsize@temp>8\relax + \expandafter\@firstofone + \else + \expandafter\@gobble + \fi + {% + \let\bmpsize@orientation\bmpsize@temp + }% + }% + }% \ifnum\bmpsize@tag=282\relax \expandafter\@firstofone \else @@ -2980,7 +3015,7 @@ and the derived files % \begin{macrocode} %<*package> \ProvidesPackage{bmpsize}% - [2007/04/11 v1.2 Extract size and resolution data from bitmap files (HO)]% + [2007/04/29 v1.3 Extract size and resolution data from bitmap files (HO)]% \RequirePackage{ifpdf} \ifpdf \PackageInfo{bmpsize}{Superseded by pdfTeX in PDF mode}% @@ -2997,29 +3032,7 @@ and the derived files \RequirePackage{graphics} \RequirePackage{keyval} \RequirePackage{bmpsize-base} - -\begingroup\expandafter\expandafter\expandafter\endgroup -\expandafter\ifx\csname PackageWarning\endcsname\relax - \def\@bmpsize@warning#1#2{% - \begingroup - \newlinechar=10 % - \def\MessageBreak{% - ^^J% - (bmpsize) % - \space\space\space\space - \space\space\space\space - \space\space\space\space - \space\space\space - }% - \immediate\write16{% - Package bmpsize Warning: #2 % - on input line \the\inputlineno.% - }% - \endgroup - }% -\else - \def\@bmpsize@warning{\PackageWarning{bmpsize}}% -\fi +\RequirePackage{infwarerr} \InputIfFileExists{bmpsize-\Gin@driver}{}{} @@ -3110,7 +3123,7 @@ and the derived files \ifbmpsize@ok \ifGin@bbox \@ifundefined{Gin@vllx}{% - \@bmpsize@warning{Explicit bounding box is ignored}% + \@PackageWarning{bmpsize}{Explicit bounding box is ignored}% }{% \ifx\Gin@viewport@code\relax \def\Gin@ollx{0}% @@ -3122,12 +3135,12 @@ and the derived files \let\Gin@vurx\Gin@urx \let\Gin@vury\Gin@ury \let\Gin@viewport@code\Gin@viewport - \@bmpsize@warning{% + \@PackageWarning{bmpsize}{% Explicit bounding box replaced by\MessageBreak viewport setting% }% \else - \@bmpsize@warning{Explicit bounding box is ignored}% + \@PackageWarning{bmpsize}{Explicit bounding box is ignored}% \fi }% \fi @@ -3175,7 +3188,7 @@ and the derived files % \begin{macrocode} %<*dvips> \ProvidesFile{bmpsize-dvips.def}% - [2007/04/11 v1.2 Graphics bitmap driver for dvips (HO)]% + [2007/04/29 v1.3 Graphics bitmap driver for dvips (HO)]% % \end{macrocode} % Ensure correct catcodes. % \begin{macrocode} @@ -3292,13 +3305,19 @@ and the derived files %</dvips> % \end{macrocode} % -% \subsubsection{dvipdfm} +% \subsubsection{dvipdfm and dvipdfmx} % % Identification. % \begin{macrocode} %<*dvipdfm> \ProvidesFile{bmpsize-dvipdfm.def}% - [2007/04/11 v1.2 Graphics bitmap driver for dvipdfm (HO)]% + [2007/04/29 v1.3 Graphics bitmap driver for dvipdfm (HO)]% +%</dvipdfm> +%<*dvipdfmx> +\ProvidesFile{bmpsize-dvipdfmx.def}% + [2007/04/29 v1.3 Graphics bitmap driver for dvipdfmx (HO)]% +%</dvipdfmx> +%<*dvipdfm|dvipdfmx> % \end{macrocode} % Ensure correct catcodes. % \begin{macrocode} @@ -3338,15 +3357,26 @@ and the derived files \fi % \end{macrocode} % \end{macro} -% The size of reused images of dvipdfm 0.13.2c is 1bp. +% The size of reused images of dvipdfm 0.13.2c is 1bp. It is +% the default size of an image object in user space. % Thus the reused image must be scaled to the requested % width and height. The factor is just the conversion % from pt to bp (72/72.27). % \begin{macro}{\bmpsize@dvipdfm@factor} % \begin{macrocode} -\@ifundefined{bmpsize@dvipdfm@factor}{% - \def\bmpsize@dvipdfm@factor{.99626}% -}{} +%<dvipdfm>\def\bmpsize@dvipdfm@factor{.99626} +% \end{macrocode} +% Unhappily dvipdfmx behaves differently. It remembers the +% size assuming a resolution of 100 dots per inch and additionally +% scales the reused image to this size. Thus the scaling factor +% also depends on the pixel sizes of the image: +% \begin{itemize} +% \item width: (72 / 72.27) * (100 / 72) / pixelwidth =\\ +% \mbox{}\hphantom{width:} 100 / 72.27 / pixelwidth +% \item height: 100 / 72.27 / pixelheight +% \end{itemize} +% \begin{macrocode} +%<dvipdfmx>\def\bmpsize@dvipdfmx@factor{1.3837} % \end{macrocode} % \end{macro} % \begin{macro}{\Ginclude@bmp} @@ -3413,16 +3443,27 @@ and the derived files \edef\@bmpsize@temp{@IMG@\@bmpsize@pdfescapestring{#1}}% \@ifundefined{\@bmpsize@temp}{% \global\advance\@bmpsize@count\@ne +%<*dvipdfm> \expandafter\xdef\csname\@bmpsize@temp\endcsname{% \the\@bmpsize@count }% +%</dvipdfm> +%<*dvipdfmx> + \expandafter\ifx\csname bmpsize@pixelwidth\endcsname\relax + \else + \expandafter\xdef\csname\@bmpsize@temp\endcsname{% + \the\@bmpsize@count:\bmpsize@pixelwidth:\bmpsize@pixelheight + }% + \fi +%</dvipdfmx> \special{% - pdf:image @IMG\csname\@bmpsize@temp\endcsname\space + pdf:image @IMG\the\@bmpsize@count\space width \the\Gin@req@width\space height \the\Gin@req@height\space depth 0pt (\@bmpsize@pdfescapestring{#1})% }% }{% +%<*dvipdfm> \special{% pdf:bt % xscale \strip@pt\dimexpr @@ -3432,6 +3473,28 @@ and the derived files }% \special{pdf:uxobj @IMG\csname\@bmpsize@temp\endcsname}% \special{pdf:et}% +%</dvipdfm> +%<*dvipdfmx> + \expandafter\expandafter\expandafter\@bmpsize@extract + \csname\@bmpsize@temp\endcsname\@nil + \edef\@bmpsize@xscale{% + \strip@pt\dimexpr + \bmpsize@dvipdfmx@factor\Gin@req@width\relax + }% + \edef\@bmpsize@yscale{% + \strip@pt\dimexpr + \bmpsize@dvipdfmx@factor\Gin@req@height\relax + }% + \@bmpsize@div\@bmpsize@xscale\@bmpsize@xscale\@bmpsize@pixelwidth + \@bmpsize@div\@bmpsize@yscale\@bmpsize@yscale\@bmpsize@pixelheight + \special{% + pdf:bt % + xscale \@bmpsize@xscale\space + yscale \@bmpsize@yscale + }% + \special{pdf:uxobj @IMG\@bmpsize@imgnum}% + \special{pdf:et}% +%</dvipdfmx> }% \ifdim\dimen@=\z@ \else @@ -3446,46 +3509,19 @@ and the derived files \fi } % \end{macrocode} -% \end{macro} -% \begin{macrocode} -\@bmpsize@driver@catcodes -%</dvipdfm> -% \end{macrocode} -% -% \subsubsection{dvipdfmx} -% -% Identification. % \begin{macrocode} %<*dvipdfmx> -\ProvidesFile{bmpsize-dvipdfmx.def}% - [2007/04/11 v1.2 Graphics bitmap driver for dvipdfmx (HO)]% -% \end{macrocode} -% Ensure correct catcodes. -% \begin{macrocode} -\expandafter\edef\csname @bmpsize@driver@catcodes\endcsname{% - \catcode46 \the\catcode46 % . - \catcode64 \the\catcode64 % @ +\def\@bmpsize@extract#1:#2:#3\@nil{% + \def\@bmpsize@imgnum{#1}% + \def\@bmpsize@pixelwidth{#2}% + \def\@bmpsize@pixelheight{#3}% } -\catcode64 11 % -\@makeother\. -% \end{macrocode} -% The size of reused images of dvipdfmx-20050823 is 1in in opposite -% the 1bp of dvipdfm. -% The reused image must be scaled to the requested -% width and height. The factor is the conversion -% from in to pt (1/72.27). -% \begin{macro}{\bmpsize@dvipdfm@factor} -% \begin{macrocode} -\@ifundefined{bmpsize@dvipdfm@factor}{% - \def\bmpsize@dvipdfm@factor{.01384}% -}{} +%</dvipdfmx> % \end{macrocode} % \end{macro} -% The rest is the same as for dvipdfm. % \begin{macrocode} \@bmpsize@driver@catcodes -\input{bmpsize-dvipdfm.def} -%</dvipdfmx> +%</dvipdfm|dvipdfmx> % \end{macrocode} % % \subsection{Test program \xpackage{bmpsize-test.tex}} @@ -3586,6 +3622,10 @@ and the derived files \fi \msg{\space\space Width: \bmpsize@width\space bp}% \msg{\space\space Height: \bmpsize@height\space bp}% + \ifx\bmpsize@orientation\relax + \else + \msg{\space\space Orientation: \bmpsize@orientation}% + \fi \fi \fi }% @@ -3828,6 +3868,14 @@ and the derived files % \item % Line ends sanitized. % \end{Version} +% \begin{Version}{2007/05/01 v1.3} +% \item +% Uses package \xpackage{infwarerr}. +% \item +% Image reuse algorithm fixed for dvipdfmx. +% \item +% Some support for Exif's orientation tag. +% \end{Version} % \end{History} % % \PrintIndex |