summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/media9/pdfbase.sty
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2017-01-24 21:38:53 +0000
committerKarl Berry <karl@freefriends.org>2017-01-24 21:38:53 +0000
commit86a1f26765430f88d161714db0e3c7b59a6c9d33 (patch)
treeee2cb8916e95512bfd1fe9a1b6565a80b8d69738 /Master/texmf-dist/tex/latex/media9/pdfbase.sty
parent3ed65554de0c7beba0ca3a61160af91053530e3f (diff)
media9 (24jan17)
git-svn-id: svn://tug.org/texlive/trunk@43044 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/media9/pdfbase.sty')
-rw-r--r--Master/texmf-dist/tex/latex/media9/pdfbase.sty106
1 files changed, 45 insertions, 61 deletions
diff --git a/Master/texmf-dist/tex/latex/media9/pdfbase.sty b/Master/texmf-dist/tex/latex/media9/pdfbase.sty
index 2cdf0976b8b..9584b8a88ed 100644
--- a/Master/texmf-dist/tex/latex/media9/pdfbase.sty
+++ b/Master/texmf-dist/tex/latex/media9/pdfbase.sty
@@ -123,8 +123,8 @@
\RequirePackage{l3keys2e}
\RequirePackage{atenddvi}
-\def\g@pbs@date@tl{2017/01/10}
-\def\g@pbs@version@tl{0.12}
+\def\g@pbs@date@tl{2017/01/24}
+\def\g@pbs@version@tl{0.13}
\ProvidesExplPackage{pdfbase}{\g@pbs@date@tl}{\g@pbs@version@tl}
{driver independent access to low-level PDF features}
@@ -483,8 +483,8 @@
\bool_if:NT\g_pbs_pkgbigfiles_bool{
\special{psfile=\jobname.pbsdat}
- %open auxiliary file \jobname.pbsdat for writing hex encoded streams of the
- %files to be embedded. This file is inserted into PS during dvips run
+ %open auxiliary file \jobname.pbsdat for writing hex encoded streams of
+ %the files to be embedded. This file is inserted into PS during dvips run
\iow_new:N\g_pbs_mstreams_stream
\iow_open:Nn\g_pbs_mstreams_stream{\jobname.pbsdat}
\iow_now:Nn\g_pbs_mstreams_stream{
@@ -521,17 +521,17 @@
{stream}{/stream}
{fstream}{/stream}
}~
- /OBJ~pdfmark~
+ /OBJ~pdfmark
}
}
\str_case:nn{#2}{
- {dict}{\special{ps:~mark~\l_pbs_usenum_tl~<<#3>>/PUT~pdfmark~}}
+ {dict}{\special{ps:~mark~\l_pbs_usenum_tl~<<#3>>/PUT~pdfmark}}
{array}{
- \special{ps:~mark~\l_pbs_usenum_tl~0~[#3]/PUTINTERVAL~pdfmark~}
+ \special{ps:~mark~\l_pbs_usenum_tl~0~[#3]/PUTINTERVAL~pdfmark}
}
{stream}{\special{ps::[nobreak]
~mark~\l_pbs_usenum_tl~(\pbs_second_of_two:nn#3)/PUT~pdfmark~
- ~mark~\l_pbs_usenum_tl~<<\pbs_first_of_two:nn#3>>/PUT~pdfmark~
+ ~mark~\l_pbs_usenum_tl~<<\pbs_first_of_two:nn#3>>/PUT~pdfmark
}}
{fstream}{
\tl_set:Nn\l_pbs_offset_tl{0}
@@ -557,7 +557,7 @@
\pbs_second_of_two:nn#3
})~
/ASCIIHexDecode~filter~/PUT~
- pdfmark~
+ pdfmark
}
}
\tl_set:Nx\l_pbs_offset_tl{\int_eval:n{\l_pbs_offset_tl+32767}}
@@ -571,7 +571,7 @@
}{
\special{ps:~
mark~\l_pbs_usenum_tl~<<\pbs_first_of_two:nn#3>>~/PUT~pdfmark~
- mark~\l_pbs_usenum_tl~/CLOSE~pdfmark~
+ mark~\l_pbs_usenum_tl~/CLOSE~pdfmark
}
}
\message{>}
@@ -598,7 +598,7 @@
/_objdef~{pbs@obj\int_use:N\g_pbs_obj_int}
/Rect~[pbs@llx~pbs@lly~pbs@urx~pbs@ury]
#4
- /ANN~pdfmark~
+ /ANN~pdfmark
}
\tl_gset:Nx\g_pbs_pdflastann_tl{{pbs@obj\int_use:N\g_pbs_obj_int}}
\int_gincr:N\g_pbs_obj_int
@@ -626,20 +626,23 @@
}
\cs_new_nopar:Nn\pbs_pdfxform:nnn{ % #1 not used
- \bool_if:nT{
- \dim_compare_p:n{\box_wd:N#3>\paperwidth} ||
- \dim_compare_p:n{\box_ht:N#3+\box_dp:N#3>\paperheight}
+ %rescale box to fit within the papersize while distilling
+ \tl_gset:cx{scale_{pbs@obj\int_use:N\g_pbs_obj_int}}{\fp_eval:n{min(1.0,
+ \dim_ratio:nn{\paperwidth}{\box_wd:N#3},
+ \dim_ratio:nn{\paperheight}{\box_ht:N#3+\box_dp:N#3}
+ )}}
+ \box_scale:Nnn#3{
+ \tl_use:c{scale_{pbs@obj\int_use:N\g_pbs_obj_int}}
}{
- \msg_warning:nn{pdfbase}{content~too~large}
+ \tl_use:c{scale_{pbs@obj\int_use:N\g_pbs_obj_int}}
}
- %mark bbox of box#3
\group_begin:
+ %mark bbox of box#3
\dim_set:Nn\unitlength{1pt}
\begin{picture}(0,0)
- %mark BBox of the graphics
\put(0,-\dim_to_decimal:n{\box_dp:N#3}){
\special{ps:
- currentpoint~/pbs@lly~exch~def~/pbs@llx~exch~def~
+ currentpoint~/pbs@lly~exch~def~/pbs@llx~exch~def
}
}
\put(
@@ -647,45 +650,30 @@
\dim_to_decimal:n{\box_ht:N#3}
){
\special{ps:
- currentpoint~/pbs@ury~exch~def~/pbs@urx~exch~def~
- }
- }
- %define some length values in current PS coordinate units
- \put(0,0){
- \special{ps:
- currentpoint~/origin@y~exch~def~/origin@x~exch~def~
- }
- }
- \dim_set:Nn\unitlength{1in}
- \put(1,1){
- \special{ps:
- currentpoint~origin@y~exch~sub~/one@inch@y~exch~def~
- origin@x~sub~/one@inch@x~exch~def~
+ currentpoint~/pbs@ury~exch~def~/pbs@urx~exch~def
}
}
\end{picture}
\group_end:
- \tl_gset:cx{origin:{pbs@obj\int_use:N\g_pbs_obj_int}}{
- origin@pbs@\int_use:N\g_pbs_obj_int
- }
\special{ps:~
gsave~
- %keep a record of lower left corner coordinates
- true~setglobal~globaldict~
- /origin@pbs@\int_use:N\g_pbs_obj_int~[currentpoint]~cvx~put~
- false~setglobal~
+ currentpoint~/pbs@cury~exch~def~/pbs@curx~exch~def~
%translate graphics to upper left page corner
\bool_if:nF{\g_pbs_powerdot_bool||\g_pbs_lscape_bool}{
{
pbs@llx~neg~pbs@ury~neg~translate~
- one@inch@x~DVImag~div~neg~one@inch@y~DVImag~div~neg~translate
+ Resolution~neg~VResolution~neg~translate %one inch left, one inch up
}?pdfmark~
}
%distill graphics into XObject
- mark~
+ gsave~pbs@curx~pbs@cury~translate~ %move origin (0,0) to the current
+ mark~ %position
/_objdef~{pbs@obj\int_use:N\g_pbs_obj_int}
- /BBox~[pbs@llx~pbs@lly~pbs@urx~pbs@ury]
- /BP~pdfmark~
+ /BBox~[
+ pbs@llx~pbs@curx~sub~pbs@lly~pbs@cury~sub~
+ pbs@urx~pbs@curx~sub~pbs@ury~pbs@cury~sub
+ ]
+ /BP~pdfmark~grestore~
\int_compare:nT{#2>\c_zero}{
%operations needed if used as annotation appearance
{
@@ -707,40 +695,36 @@
}{%flip around horizontal axis in portrait mode
[1~0~0~-1~0~pbs@lly~pbs@ury~add]~concat
}ifelse
- }?pdfmark~
+ }?pdfmark
}
}
\begin{picture}(0,0)\put(0,0){\box_use:N#3}\end{picture}
\special{ps:~mark~/EP~pdfmark~grestore}
\tl_gset:Nx\g_pbs_pdflastxform_tl{{pbs@obj\int_use:N\g_pbs_obj_int}}
\int_gincr:N\g_pbs_obj_int
- \int_compare:nTF{#2>\c_zero}{
+ \int_compare:nT{#2>\c_zero}{
%Form XObjects for use as annotation appearances require that
- %dvips generated PostScript to be further precessed with ps2pdf
+ %dvips generated PostScript to be further processed with ps2pdf
%may not have the exaggerated dpi resolution resulting from dvips
%option `-Ppdf'.
\tl_if_exist:NF\g_pbs_dpiwarned_tl{
\tl_new:N\g_pbs_dpiwarned_tl
\AtEndDvi{\special{ps::[nobreak]\pbs_dpiwarning:}}
}
- }{%Form XObject to be inserted using /SP pdfmark:
- %The /SP pdfmark for placement of Form XObjects works reliably only
- %since gs-9.14. As gs-9.14 had some other TeX-related issues, we
- %require 9.15.
- \tl_if_exist:NF\g_pbs_gsoldwarned_tl{
- \tl_new:N\g_pbs_gsoldwarned_tl
- \AtEndDvi{\special{ps::[nobreak]\pbs_gsoldwarning:}}
- }
}
}
\cs_new_nopar:Nn\pbs_pdfrefxform:n{% #1: xform obj ID
+ %The /SP pdfmark for placement of Form XObjects works reliably only
+ %since gs-9.14. As gs-9.14 had some other TeX-related issues, we
+ %require 9.15.
+ \tl_if_exist:NF\g_pbs_gsoldwarned_tl{
+ \tl_new:N\g_pbs_gsoldwarned_tl
+ \AtEndDvi{\special{ps::[nobreak]\pbs_gsoldwarning:}}
+ }
\special{ps:~
- gsave~
- currentpoint~pop~\tl_use:c{origin:#1}~pop~sub~
- currentpoint~exch~pop~\tl_use:c{origin:#1}~exch~pop~sub~translate~
- mark~#1~/SP~pdfmark~
- grestore~
+ gsave~currentpoint~translate~1~\tl_use:c{scale_#1}~div~dup~scale~
+ mark~#1~/SP~pdfmark~grestore
}
}
@@ -752,13 +736,13 @@
||\str_if_eq_p:Vn\l_pbs_ext_tl{eps}
}{
\special{ps:~
- mark~/_objdef~{pbs@obj\int_use:N\g_pbs_obj_int}~/NI~pdfmark~
+ mark~/_objdef~{pbs@obj\int_use:N\g_pbs_obj_int}~/NI~pdfmark
}
\special{psfile=#1~hsize=0~vsize=0}
\special{ps:~
{
0~0~1~[1~0~0~1~0~0]~{}~image~%empty dummy, in case #1 is not
- }?pdfmark~ %a valid raster image file
+ }?pdfmark %a valid raster image file
}
\tl_gset:Nx\g_pbs_pdflastximage_tl{{pbs@obj\int_use:N\g_pbs_obj_int}}
\int_gincr:N\g_pbs_obj_int