diff options
author | Karl Berry <karl@freefriends.org> | 2017-02-12 23:32:25 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2017-02-12 23:32:25 +0000 |
commit | 88ad6ed6179838d65a8c79c1867b8c1de2db3079 (patch) | |
tree | 927a6ccc9026d909a901963660b67e7dc210b9fb /Master/texmf-dist/tex | |
parent | 1b77359a5e97dbf40e82c6b0f4c5c70424dc2cba (diff) |
bxpdfver (12feb17)
git-svn-id: svn://tug.org/texlive/trunk@43201 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex')
-rw-r--r-- | Master/texmf-dist/tex/latex/bxpdfver/bxpdfver.sty | 259 |
1 files changed, 211 insertions, 48 deletions
diff --git a/Master/texmf-dist/tex/latex/bxpdfver/bxpdfver.sty b/Master/texmf-dist/tex/latex/bxpdfver/bxpdfver.sty index 0c3afab1a70..213871f7bfb 100644 --- a/Master/texmf-dist/tex/latex/bxpdfver/bxpdfver.sty +++ b/Master/texmf-dist/tex/latex/bxpdfver/bxpdfver.sty @@ -2,7 +2,7 @@ %% package declaration \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{bxpdfver}[2016/08/11 v0.3] +\ProvidesPackage{bxpdfver}[2017/02/11 v0.4] \def\bxpv@pkgname{bxpdfver} %% preparations @@ -79,6 +79,10 @@ \let\bxpv@drv@type=0% \def\bxpv@drv@name{disabled}% } +\DeclareOption{nodvidriver}{% + \let\bxpv@drv@type=0% + \def\bxpv@drv@name{nodvidriver}% +} % (other) \DeclareOption{lenient}{% \chardef\bxpv@infolevel=1 @@ -91,8 +95,8 @@ %% unique tokens \def\bxpv@end{\bxpv@end@} -\def\bxpv@mkj{\bxpv@mk@} \def\bxpv@mt{\bxpv@mt@} +\let\bxpv@mk\noindent %% \bxpv@csletcs \def\bxpv@csletcs#1#2{% @@ -119,28 +123,44 @@ \fi } +%% \bxpv@fail@nafea +\@onlypreamble\bxpv@fail@nafea +\def\bxpv@fail@nafea#1{% + \bxpv@fail{#1, because\MessageBreak + the engine/driver does not support the feature}% +} + %--------------------------------------- internal dispatchers %% \bxpv@suppress@compress \@onlypreamble\bxpv@suppress@compress \def\bxpv@suppress@compress{% - \bxpv@fail - {Cannot suppress compression, because\MessageBreak - the engine/driver does not support the feature}% + \bxpv@fail@nafea{Cannot suppress compression}% } %% \bxpv@suppress@obj@compress \@onlypreamble\bxpv@suppress@obj@compress \def\bxpv@suppress@obj@compress{% - \bxpv@fail - {Cannot suppress object compression, because\MessageBreak - the engine/driver does not support the feature}% + \bxpv@fail@nafea{Cannot suppress object compression}% } %% \bxpv@set@version \@onlypreamble\bxpv@set@version \def\bxpv@set@version{% - \bxpv@fail - {Cannot set PDF version, because\MessageBreak - the engine/driver does not support the feature}% + \bxpv@fail@nafea{Cannot set PDF version}% +} +%% \bxpv@set@decimaldigits +\@onlypreamble\bxpv@set@decimaldigits +\def\bxpv@set@decimaldigits{% + \bxpv@fail@nafea{Cannot set PDF decimal digits}% +} +%% \bxpv@set@pkresolution +\@onlypreamble\bxpv@set@pkresolution +\def\bxpv@set@pkresolution{% + \bxpv@fail@nafea{Cannot set PK resolution}% +} +%% \bxpv@preserve@destinations +\@onlypreamble\bxpv@preserve@destinations +\def\bxpv@preserve@destinations{% + \bxpv@fail@nafea{Cannot preserve PDF destinations}% } %% \bxpv@cancel@obj@compress % The silent version of \bxpv@suppress@obj@compress. @@ -184,10 +204,14 @@ \global\let\bxpv@@compresslevel\pdfcompresslevel \global\let\bxpv@@objcompresslevel\pdfobjcompresslevel \global\let\bxpv@@minorversion\pdfminorversion + \global\let\bxpv@@decimaldigits\pdfdecimaldigits + \global\let\bxpv@@pkresolution\pdfpkresolution \bxpv@check@prim\pdfvariable{% \protected\xdef\bxpv@@compresslevel{\pdfvariable compresslevel}% \protected\xdef\bxpv@@objcompresslevel{\pdfvariable objcompresslevel}% \protected\xdef\bxpv@@minorversion{\pdfvariable minorversion}% + \protected\xdef\bxpv@@decimaldigits{\pdfvariable decimaldigits}% + \protected\xdef\bxpv@@pkresolution{\pdfvariable pkresolution}% }% % If \pdfcompresslevel is available, use it. \ifx\bxpv@@compresslevel\@undefined\else @@ -219,6 +243,33 @@ \fi }% \fi + % If \pdfdecimaldigits is available, use it. + \ifx\bxpv@@decimaldigits\@undefined\else + \global\chardef\bxpv@org@decimaldigits\bxpv@@decimaldigits + \gdef\bxpv@set@decimaldigits{% + \ifx\bxpdfverDecimalDigits\relax + \global\bxpv@@decimaldigits\bxpv@org@decimaldigits + \else + \global\bxpv@@decimaldigits\bxpdfverDecimalDigits + \fi + }% + \fi + % If \pdfpkresolution is available, use it. + \ifx\bxpv@@pkresolution\@undefined\else + \global\mathchardef\bxpv@org@pkresolution\bxpv@@pkresolution + \gdef\bxpv@set@pkresolution{% + \ifx\bxpdfverPkResolution\relax + \global\bxpv@@pkresolution\bxpv@org@pkresolution + \else + \global\bxpv@@pkresolution\bxpdfverPkResolution + \fi + }% + \fi + % On pdfTeX or LuaTeX, \pdfpreservedestionations can be no-op. + \bxpv@oktrue \bxpv@check@prim\ngbanner{\bxpv@okfalse}% + \ifbxpv@ok + \global\let\bxpv@preserve@destinations\relax + \fi \else % XeTeX should do just as dvipdfmx. \bxpv@check@prim\XeTeXversion{% @@ -235,6 +286,9 @@ \global\let\bxpv@suppress@compress\relax \global\let\bxpv@suppress@obj@compress\relax \global\let\bxpv@set@version\relax + \global\let\bxpv@set@decimaldigits\relax + %\global\let\bxpv@set@pkresolution\relax + \global\let\bxpv@preserve@destinations\relax \g@addto@macro\bxpv@begin@document@hook{% \bxpv@begin@document@dvipdfmx } @@ -274,6 +328,27 @@ \bxpv@set@version } +%%<*> \setpdfdecimaldigits{<number>} +\@onlypreamble\setpdfdecimaldigits +\newcommand*\setpdfdecimaldigits[1]{% + \bxpv@assign@num\bxpdfverDecimalDigits{#1}{0}{4}% + \bxpv@set@decimaldigits +} + +%%<*> \setpdfpkresolution{<number>} +\@onlypreamble\setpdfpkresolution +\newcommand*\setpdfpkresolution[1]{% + \bxpv@assign@num\bxpdfverPkResolution{#1}{0}{10000}% + \bxpv@set@pkresolution +} + +%%<*> \preservepdfdestinations +\@onlypreamble\preservepdfdestinations +\newcommand*\preservepdfdestinations{% + \bxpv@preserve@destinations + \global\bxpdfverDestinationsPreservedtrue +} + %%<+> \ifbxpdfverCompressionSuppressed \newboolean{bxpdfverCompressionSuppressed} @@ -283,11 +358,61 @@ %%<+> \bxpdfverMinorVersion % The PDF minor version (eg. '4' for 1.4) that this package % will impose. It is a number constant, or \relax. -% (number constant or \relax) \@ifdefinable{\bxpdfverMinorVersion}{% \let\bxpdfverMinorVersion\relax } +%%<+> \bxpdfverDecimalDigits +% The PDF decimal-digits value that this package +% will impose. It is a number constant, or \relax. +\@ifdefinable{\bxpdfverDecimalDigits}{% + \let\bxpdfverDecimalDigits\relax +} + +%%<+> \bxpdfverPkResolution +% The PK resolution value that this package +% will impose. It is a number constant, or \relax. +\@ifdefinable{\bxpdfverPkResolution}{% + \let\bxpdfverPkResolution\relax +} + +%%<+> \ifbxpdfverDestinationsPreserved +\newboolean{bxpdfverDestinationsPreserved} + +%% \bxpv@assign@num\CS{<value>}{<min>}{<max>} +\@onlypreamble\bxpv@assign@num +\def\bxpv@assign@num#1#2#3#4{% + \begingroup + \edef\bxpv@tmpa{#2}% + \ifx\bxpv@tmpa\@empty + \global\let#1\relax + \else + \@tempswatrue + \afterassignment\bxpv@assign@num@a + \@tempcnta=\bxpv@tmpa\bxpv@mk + \if@tempswa + \ifnum\@tempcnta<#3\relax \@tempswafalse \fi + \ifnum\@tempcnta>#4\relax \@tempswafalse \fi + \if@tempswa + \global\mathchardef#1=\@tempcnta + \else + \PackageError\bxpv@pkgname + {Number is out of range (#3..#4)\MessageBreak + (value=\the\@tempcnta)}% + {\@ehc} + \fi + \else + \PackageError\bxpv@pkgname + {Illegal number format\MessageBreak + (value=\bxpv@tmpa)}% + {\@ehc} + \fi + \fi + \endgroup} +\@onlypreamble\bxpv@assign@num@a +\def\bxpv@assign@num@a#1\bxpv@mk{% + \ifx\bxpv@mt#1\bxpv@mt\else \@tempswafalse \fi} + %--------------------------------------- version values %% variables @@ -389,9 +514,19 @@ %% variables \let\bxpv@C@value\relax +%% \bxpv@C@bits +\@onlypreamble\bxpv@C@bits +\let\bxpv@C@bits\@empty + %% \bxpv@page@specials \let\bxpv@page@specials\@empty +%% \bxpv@put@special +\@onlypreamble\bxpv@put@special +\def\bxpv@put@special#1{% + \edef\bxpv@page@specials{\bxpv@page@specials\special{#1}}% +} + %% \bxpv@begin@document@dvipdfmx \@onlypreamble\bxpv@begin@document@dvipdfmx \def\bxpv@begin@document@dvipdfmx{% @@ -403,7 +538,8 @@ \fi % compression \ifbxpdfverCompressionSuppressed - \bxpv@check@dvipdfmx@version{Cannot suppress compression}% + \bxpv@check@dvipdfmx@version{20160307}% + {Cannot suppress compression}% \ifbxpv@ok % New dvipdfmx supports this special. \g@addto@macro\bxpv@page@specials{% @@ -413,21 +549,46 @@ \fi % object compression \ifbxpdfverObjCompressionSuppressed - \bxpv@check@dvipdfmx@version{Cannot suppress object compression}% + \bxpv@check@dvipdfmx@version{20160307}% + {Cannot suppress object compression}% \ifbxpv@ok - \bxpv@cache@fetch{dvipdfmxcfg}% - \def\bxpv@C@value{0}% - \ifx\bxpv@cache@@dvipdfmxcfg\@empty\else - \def\bxpv@next##1##2{\def\bxpv@C@value{##1}}% - \expandafter\bxpv@next\bxpv@cache@@dvipdfmxcfg - \fi - \bxpv@rc@bitset{\bxpv@C@value}{64}% - \let\bxpv@C@value\bxpv@rc@num - \g@addto@macro\bxpv@page@specials{% - \special{dvipdfmx:config C \bxpv@C@value}% - }% + \g@addto@macro\bxpv@C@bits{\do{64}}% + \fi + \fi + % PDF decimal digits + \ifx\bxpdfverDecimalDigits\relax\else + \bxpv@check@dvipdfmx@version{20160307}% + {Cannot set PDF decimal digits}% + \ifbxpv@ok + \bxpv@put@special{dvipdfmx:config d \the\bxpdfverDecimalDigits}% \fi \fi + % PK resolution + \ifx\bxpdfverPkResolution\relax\else + \iffalse % This will never work.... + \bxpv@put@special{dvipdfmx:config r \the\bxpdfverPkResolution}% + \fi + \fi + % PDF destinations + \ifbxpdfverDestinationsPreserved + \bxpv@check@dvipdfmx@version{20160307}% + {Cannot preserve PDF destinations}% + \ifbxpv@ok + \g@addto@macro\bxpv@C@bits{\do{16}}% + \fi + \fi + % C option value + \ifx\bxpv@C@bits\@empty\else + \bxpv@cache@fetch{dvipdfmxcfg}% + \def\bxpv@next##1##2\bxpv@mk{\def\bxpv@C@value{##1}}% + \expandafter\bxpv@next\bxpv@cache@@dvipdfmxcfg{0}\bxpv@mk + \bxpv@rc@bitset{\bxpv@C@value}{64}% + \def\do##1{% + \bxpv@rc@bitset{\bxpv@C@value}{##1}% + \let\bxpv@C@value\bxpv@rc@num}% + \bxpv@C@bits + \bxpv@put@special{dvipdfmx:config C \bxpv@C@value}% + \fi % special added to every page \ifx\bxpv@page@specials\@empty\else \edef\bxpv@page@specials{\bxpv@page@specials}% @@ -443,19 +604,19 @@ %% \bxpv@check@dvipdfmx@version \@onlypreamble\bxpv@check@dvipdfmx@version -\def\bxpv@check@dvipdfmx@version#1{% +\def\bxpv@check@dvipdfmx@version#1#2{% \bxpv@cache@fetch{dvipdfmxver}% \bxpv@okfalse \ifnum\bxpv@cache@@dvipdfmxver=\z@ \bxpv@fail - {#1, because the\MessageBreak + {#2, because the\MessageBreak version of dvipdfmx in use is unknown - \MessageBreak (v.20160307 or later is required)}% - \else\ifnum\bxpv@cache@@dvipdfmxver<20160307 + \MessageBreak (v.#1 or later is required)}% + \else\ifnum\bxpv@cache@@dvipdfmxver<#1 \bxpv@fail - {#1, because the\MessageBreak + {#2, because the\MessageBreak version of dvipdfmx in use (v.\bxpv@cache@@dvipdfmxver) is too old - \MessageBreak (v.20160307 or later is required)}% + \MessageBreak (v.#1 or later is required)}% \else \PackageInfo\bxpv@pkgname {dvipdfmx version is \bxpv@cache@@dvipdfmxver\@gobble}% @@ -717,27 +878,29 @@ %--------------------------------------- start-up \ifx t\bxUseDebug -\typeout{% - mversion=\meaning\bxpdfverMinorVersion^^J% - compress=\meaning\bxpv@compress^^J% - objcompress=\meaning\bxpv@obj@compress^^J% - drvtype=\meaning\bxpv@drv@type^^J% - drvname=\meaning\bxpv@drv@name^^J% - +version=\meaning\bxpv@set@version^^J% - +compress=\meaning\bxpv@suppress@compress^^J% - +objcompress=\meaning\bxpv@suppress@obj@compress^^J% -} -\ifx p\bxpv@drv@type + \typeout{**bxpdfver-----------% + ^^Jdrvtype=\meaning\bxpv@drv@type + ^^Jdrvname=\meaning\bxpv@drv@name} \AtBeginDocument{% - \def\do#1{\ifx#1\@undefined\else\the#1\fi}% - \typeout{% - pdfminorversion=\do\pdfminorversion^^J% - pdfcompresslevel=\do\pdfcompresslevel^^J% - pdfobjcompresslevel=\do\pdfobjcompresslevel^^J% + \def\do#1=#2{\ifx#2\@undefined\else + ^^J#1=\the#2 [\meaning#2]% + \fi}% + \def\next#1{\expandafter\meaning\csname if#1\endcsname}% + \typeout{**bxpdfver-----------% + ^^JMinorVersion=\meaning\bxpdfverMinorVersion + ^^JCompressionSuppressed=\next{bxpdfverCompressionSuppressed}% + ^^JObjCompressionSuppressed=\next{bxpdfverObjCompressionSuppressed}% + ^^JDecimalDigits=\meaning\bxpdfverDecimalDigits + ^^JPkResolution=\meaning\bxpdfverPkResolution + \do minorversion=\bxpv@@minorversion + \do compresslevel=\bxpv@@compresslevel + \do objcompresslevel=\bxpv@@objcompresslevel + \do decimaldigits=\bxpv@@decimaldigits + \do pkresolution=\bxpv@@pkresolution + ^^JCvalue=\meaning\bxpv@C@value }% } \fi -\fi %% Applies the setting specified by package options \ifx\bxpv@version\relax\else |