summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/l3kernel/l3pdfmode.def
blob: 05f466d3051c83fefd0eb013c5ca0d93f0f6c420 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
%%
%% This is file `l3pdfmode.def',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% l3drivers.dtx  (with options: `package,pdfmode')
%% 
%% EXPERIMENTAL CODE
%% 
%% Do not distribute this file without also distributing the
%% source files specified above.
%% 
%% Do not distribute a modified version of this file.
%% 
%% File: l3drivers.dtx Copyright(C) 2011-2016 The LaTeX3 Project
%%
%% It may be distributed and/or modified under the conditions of the
%% LaTeX Project Public License (LPPL), either version 1.3c of this
%% license or (at your option) any later version.  The latest version
%% of this license is in the file
%%
%%    http://www.latex-project.org/lppl.txt
%%
%% This file is part of the "l3kernel bundle" (The Work in LPPL)
%% and all files in that bundle must be distributed together.
%%
%% The released version of this bundle is available from CTAN.
%%
%% -----------------------------------------------------------------------
%%
%% The development version of the bundle can be found at
%%
%%    http://www.latex-project.org/svnroot/experimental/trunk/
%%
%% for those people who are interested.
%%
%%%%%%%%%%%
%% NOTE: %%
%%%%%%%%%%%
%%
%%   Snapshots taken from the repository represent work in progress and may
%%   not work or may contain conflicting material!  We therefore ask
%%   people _not_ to put them into distributions, archives, etc. without
%%   prior consultation with the LaTeX Project Team.
%%
%% -----------------------------------------------------------------------
%%
\GetIdInfo$Id: l3drivers.dtx 6494 2016-05-14 21:10:56Z joseph $
  {L3 Experimental drivers}
\ProvidesExplFile
  {l3pdfmode.def}{\ExplFileDate}{\ExplFileVersion}
  {L3 Experimental driver: PDF mode}
\cs_new_protected:Npx \__driver_literal:n #1
  {
    \cs_if_exist:NTF \luatex_pdfextension:D
      { \luatex_pdfextension:D literal }
      { \pdftex_pdfliteral:D }
        {#1}
  }
\cs_new_protected_nopar:Npx \__driver_scope_begin:
  {
    \cs_if_exist:NTF \luatex_pdfextension:D
      { \luatex_pdfextension:D save \scan_stop: }
      { \pdftex_pdfsave:D }
  }
\cs_new_protected_nopar:Npx \__driver_scope_end:
  {
    \cs_if_exist:NTF \luatex_pdfextension:D
      { \luatex_pdfextension:D restore \scan_stop: }
      { \pdftex_pdfrestore:D }
  }
\cs_new_protected:Npx \__driver_matrix:n #1
  {
    \cs_if_exist:NTF \luatex_pdfextension:D
      { \luatex_pdfextension:D setmatrix }
      { \pdftex_pdfsetmatrix:D }
        {#1}
  }
\tl_new:N \l__driver_current_color_tl
\tl_set:Nn \l__driver_current_color_tl { 0~g~0~G }
\AtBeginDocument
  {
    \@ifpackageloaded { color }
      { \tl_set:Nn \l__driver_current_color_tl { \current@color } }
      { }
  }
\int_new:N \l__driver_color_stack_int
\cs_new_protected_nopar:Npx \__driver_color_ensure_current:
  {
    \cs_if_exist:NTF \luatex_pdfextension:D
      { \luatex_pdfextension:D colorstack }
      { \pdftex_pdfcolorstack:D }
        \exp_not:N \l__driver_color_stack_int push
          { \exp_not:N \l__driver_current_color_tl }
    \group_insert_after:N \exp_not:N \__driver_color_reset:
  }
\cs_new_protected_nopar:Npx \__driver_color_reset:
  {
    \cs_if_exist:NTF \luatex_pdfextension:D
      { \luatex_pdfextension:D colorstack }
      { \pdftex_pdfcolorstack:D }
        \exp_not:N \l__driver_color_stack_int pop \scan_stop:
  }
\cs_new_protected:Npn \__driver_box_use_clip:N #1
  {
    \__driver_scope_begin:
    \__driver_literal:n
      {
        0~
        \dim_to_decimal_in_bp:n { -\box_dp:N #1 } ~
        \dim_to_decimal_in_bp:n { \box_wd:N #1 } ~
        \dim_to_decimal_in_bp:n { \box_ht:N #1 + \box_dp:N #1 } ~
        re~W~n
      }
    \hbox_overlap_right:n { \box_use:N #1 }
    \__driver_scope_end:
    \skip_horizontal:n { \box_wd:N #1 }
  }
\cs_new_protected:Npn \__driver_box_use_rotate:Nn #1#2
  {
    \__driver_scope_begin:
    \box_set_wd:Nn #1 \c_zero_dim
    \fp_set:Nn \l__driver_cos_fp { round ( cosd ( #2 ) , 5 ) }
    \fp_compare:nNnT \l__driver_cos_fp = \c_zero_fp
      { \fp_zero:N \l__driver_cos_fp }
    \fp_set:Nn \l__driver_sin_fp { round ( sind ( #2 ) , 5 ) }
    \__driver_matrix:n
      {
        \fp_use:N \l__driver_cos_fp \c_space_tl
        \fp_compare:nNnTF \l__driver_sin_fp = \c_zero_fp
          { 0~0 }
          {
            \fp_use:N \l__driver_sin_fp
            \c_space_tl
            \fp_eval:n { -\l__driver_sin_fp }
          }
        \c_space_tl
        \fp_use:N \l__driver_cos_fp
      }
   \box_use:N #1
   \__driver_scope_end:
  }
\fp_new:N \l__driver_cos_fp
\fp_new:N \l__driver_sin_fp
\cs_new_protected:Npn \__driver_box_use_scale:Nnn #1#2#3
  {
    \__driver_scope_begin:
    \__driver_matrix:n
      {
        \fp_eval:n { round ( #2 , 5 ) } ~
        0~0~
        \fp_eval:n { round ( #3 , 5 ) }
      }
    \hbox_overlap_right:n { \box_use:N #1 }
    \__driver_scope_end:
  }
%% 
%%
%% End of file `l3pdfmode.def'.