summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/latex')
-rw-r--r--Master/texmf-dist/tex/latex/bxpdfver/bxpdfver.sty118
1 files changed, 89 insertions, 29 deletions
diff --git a/Master/texmf-dist/tex/latex/bxpdfver/bxpdfver.sty b/Master/texmf-dist/tex/latex/bxpdfver/bxpdfver.sty
index 46c65cd9a26..296774068c6 100644
--- a/Master/texmf-dist/tex/latex/bxpdfver/bxpdfver.sty
+++ b/Master/texmf-dist/tex/latex/bxpdfver/bxpdfver.sty
@@ -10,12 +10,8 @@
%% package declaration
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{bxpdfver}[2024/07/24 v0.7]
+\ProvidesPackage{bxpdfver}[2024/08/03 v0.8]
\def\bxpv@pkgname{bxpdfver}
-
-%% preparations
-\RequirePackage{ifthen}[]% for \newboolean
-\newif\ifbxpv@ok
\providecommand\bxDebug[1]{}
%--------------------------------------- package options
@@ -124,13 +120,23 @@
\fi
\fi
-%--------------------------------------- helpers
+%--------------------------------------- general
+
+%% packages
+\RequirePackage{ifthen}[]% for \newboolean
+
+%% variables
+\newif\ifbxpv@ok
%% unique tokens
\def\bxpv@end{\bxpv@end@}
\def\bxpv@mt{\bxpv@mt@}
\let\bxpv@mk\noindent
+%% \ifbxpv@read@file@ok
+% Whether or not the last \bxpv@read@file succeeded.
+\newif\ifbxpv@read@file@ok
+
%% \bxpv@csletcs
\def\bxpv@csletcs#1#2{%
\expandafter\let\csname#1\expandafter\endcsname\csname#2\endcsname
@@ -187,10 +193,51 @@
\bxpv@csletcs{ifbxpv@defined}{%
if\ifx\ifdefined\@undefined false\else defined\fi}
+%% \bxpv@begin@document@hook
+% The begin-document hook.
+\@onlypreamble\bxpv@begin@document@hook
+\let\bxpv@begin@document@hook\@empty
+\AtBeginDocument{\bxpv@begin@document@hook}
+
+%--------------------------------------- environment check
+
%% \ifbxpv@old@hook@system
\newif\ifbxpv@old@hook@system
\@ifl@t@r\fmtversion{2020/10/01}{}{\bxpv@old@hook@systemtrue}
+%% \ifbxpv@pdfmanagement@ok
+% Whether this package is supporting the LaTeX PDF management
+% of the current kernel.
+% (If the PDF management is active but this switch is off,
+% then this package will switch to no-op mode.)
+\newif\ifbxpv@pdfmanagement@ok
+
+%% check for new PDF management
+\if t\bxpv@ignore@pdfmanagement\else
+ \ifx\IfPDFManagementActiveTF\@undefined\else
+ \IfPDFManagementActiveTF{%
+ \let\bxpv@drv@type=m%
+ \def\bxpv@drv@name{latex-pdf}%
+ \@ifl@t@r\fmtversion{2022/06/01}{%
+ \bxpv@pdfmanagement@oktrue
+ }{}
+ }{}
+ \fi
+\fi
+\ifx m\bxpv@drv@type
+ \ifbxpv@pdfmanagement@ok
+ \bxpv@warn
+ {New PDF management is active.\MessageBreak
+ The driver is set to '\bxpv@drv@name'}%
+ % Here \ExplSyntaxOn should be available.
+ \else
+ \bxpv@warn
+ {New PDF management is active, but\MessageBreak
+ the kernel is too old (before 2022/06/01).\MessageBreak
+ Thus this package will not work}%
+ \fi
+\fi
+
%--------------------------------------- internal dispatchers
% Initially all dispatchers are "unavailable".
@@ -234,24 +281,10 @@
\@onlypreamble\bxpv@cancel@obj@compress
\let\bxpv@cancel@obj@compress\relax
-%% \bxpv@begin@document@hook
-% The begin-document hook.
-\@onlypreamble\bxpv@begin@document@hook
-\let\bxpv@begin@document@hook\@empty
-\AtBeginDocument{\bxpv@begin@document@hook}
\g@addto@macro\bxpv@begin@document@hook{%
\bxpv@check@hyperref % must come first
}
-%% check for new PDF management
-\if t\bxpv@ignore@pdfmanagement\else
- \ifx\IfPDFManagementActiveTF\@undefined\else
- \IfPDFManagementActiveTF{%
- \global\let\bxpv@drv@type=m%
- }{}
- \fi
-\fi
-
%% Redefine internal dispatchers.
\ifx 0\bxpv@drv@type\else %--------
\begingroup
@@ -274,9 +307,31 @@
%% switch
\if m\bxpv@drv@type
- %% when in new PDF management
- \bxpv@warn
- {New PDF management is active}%
+ \ifbxpv@pdfmanagement@ok
+ % Here all l3pdf function is assumed to be available.
+ \gdef\bxpv@check@version{\bxpv@oktrue}
+ \ExplSyntaxOn %!!!!!!
+ \tl_new:N \g__bxpv_org_version
+ \exp_args:NNe \tl_gset:Nn \g__bxpv_org_version { \pdf_version: }
+ \cs_gset:Npn \bxpv@set@version
+ {
+ \token_if_eq_meaning:NNTF \bxpdfverMinorVersion \relax
+ { \pdf_version_gset:n { \g__bxpv_org_version } }
+ {
+ \pdf_version_gset:n
+ {
+ \int_use:N \bxpdfverMajorVersion
+ . \int_use:N \bxpdfverMinorVersion
+ }
+ }
+ }
+ % \pdf_uncompress: does both.
+ \cs_gset:Npn \bxpv@suppress@compress
+ { \pdf_uncompress: }
+ \cs_gset:Npn \bxpv@suppress@obj@compress
+ { \pdf_uncompress: }
+ \ExplSyntaxOff %!!!!!!
+ \fi
\else\ifnum\bxpv@pdfoutput>\z@
%% when in PDF mode
\global\let\bxpv@drv@type=p
@@ -683,7 +738,7 @@
\fi
%% variables
-\let\bxpv@dvipdfmx@known@min\relax
+\let\bxpv@dvipdfmx@known@min\relax % minimum known dviodfmx version
\let\bxpv@C@value\relax
%% \bxpv@C@bits
@@ -765,7 +820,7 @@
% C option value
\ifx\bxpv@C@bits\@empty\else
% When C option is used, its value is automatically OR'ed with
- % the current value, so we need read the config for that.
+ % the current value, so we need not read the config for that.
\def\bxpv@C@value{0}%
\def\do##1{%
\bxpv@rc@bitset{\bxpv@C@value}{##1}%
@@ -792,18 +847,27 @@
}
%% \bxpv@get@dvipdfmx@known@min
+% Gathers the information and sets \bxpv@dvipdfmx@known@min,
+% without actually spawning extractbb.
+% (Called in the begin-document hook.)
\@onlypreamble\bxpv@get@dvipdfmx@known@min
\def\bxpv@get@dvipdfmx@known@min{%
+ % initially no information
\def\bxpv@dvipdfmx@known@min{0}%
+ % l3backend-dvipdfmx of revision 2022-04-10 or later requires
+ % dvipdfmx of version 20201111 or later.
\def\bxpv@tmpa{def}%
\let\bxpv@tmpb\@gobbletwo
\@ifl@aded\bxpv@tmpa{l3backend-dvipdfmx}{%
\def\bxpv@tmpb{\@ifl@ter\bxpv@tmpa{l3backend-dvipdfmx}}%
}{}%
+ % Just in case....
\@ifl@aded\bxpv@tmpa{l3backend-dvips}{%
\def\bxpv@tmpb{\@ifl@ter\bxpv@tmpa{l3backend-dvips}}%
}{}%
\bxpv@tmpb{2022/04/10}{%
+ % Now the version is known to be 20201111 or later.
+ % This information can save much need for spawning extractbb.
\def\bxpv@dvipdfmx@known@min{20201111}%
}{}%
\bxDebug{dvipdfmx-known-min:\bxpv@dvipdfmx@known@min}%
@@ -998,10 +1062,6 @@
\let\bxpv@rf@line\relax % line content
\let\bxpv@rf@cont\relax % continue to read?
-%% \ifbxpv@read@file@ok
-% Whether or not the last \bxpv@read@file succeeded.
-\newboolean{bxpv@read@file@ok}
-
%% \bxpv@read@file{<file-name>}{<line-parser-code>}
% Reads from a text file. The line parser takes as #1 the
% content of each line.