diff options
author | Karl Berry <karl@freefriends.org> | 2012-08-27 22:12:41 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2012-08-27 22:12:41 +0000 |
commit | bb64113f0c117e1f3236a66b9f963b9bca4955e0 (patch) | |
tree | db5f9841c4aabf9cfb2e1c2984e292032ceb6ec0 /Master/texmf-dist/source | |
parent | a65852350dd289d0de23e9b5019613e89de47a4e (diff) |
GS1 (27aug12)
git-svn-id: svn://tug.org/texlive/trunk@27540 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source')
-rw-r--r-- | Master/texmf-dist/source/latex/GS1/GS1.dtx | 53 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/GS1/rule-D.dtx | 4 |
2 files changed, 44 insertions, 13 deletions
diff --git a/Master/texmf-dist/source/latex/GS1/GS1.dtx b/Master/texmf-dist/source/latex/GS1/GS1.dtx index 2db8a55ece2..fa8f46bb372 100644 --- a/Master/texmf-dist/source/latex/GS1/GS1.dtx +++ b/Master/texmf-dist/source/latex/GS1/GS1.dtx @@ -17,8 +17,8 @@ %% ------------------------------------------------------------------------- % %<*driver|package|test> -\RequirePackage{l3names} -\GetIdInfo$Id: GS1.dtx 9 2012-08-01 09:31:32Z mjk $ +\RequirePackage{expl3} +\GetIdInfo$Id: GS1.dtx 15 2012-08-27 10:25:03Z mjk $ {GS1 code handler and barcode generator} %</driver|package|test> %<*driver> @@ -219,8 +219,10 @@ % from 0.8 up to 2.0 with steps of 0.05. Factors less than 0.8 % shouldn't be used. \emph{Currently \texttt{scale} won't be used!} % \item[\texttt{scale\_to\_font=}\meta{boolean}]\hfill\\ -% Ignore \texttt{scale} and calculate your own scale by the width of -% digit 0 of the current font. \emph{See note to \texttt{scale} above!} +% Ignore \texttt{module_width} and instead set the module width +% depending on the width of digit 0 of the current font. Note, that +% this will not scale the whole bar code but only the module width. To +% scale the whole bar code, you should use \texttt{scale}. % \item[\texttt{add\_control=}\meta{boolean}]\hfill\\ % Add the control digit to the GS1 code. If there's already a control % digit, replace it by the calculated one. The predefined default is @@ -396,7 +398,6 @@ % % There are some basic dimensions for the modules at the specification: % \begin{variable}{\c__GS_module_min_width_dim, \c__GS_module_norm_width_dim} -% \cmd{\c@@_module_min_width_dim} Currently not used. % \begin{macrocode} \dim_const:Nn \c_@@_module_min_width_dim {0.264mm} \dim_const:Nn \c_@@_module_norm_width_dim {0.33mm} @@ -476,6 +477,14 @@ nor~a~EAN-13~with~or~without~control~digit.\\\\ The~GS1~module~currently~only~supports~EAN-8~and~EAN~13. } + +\msg_new:nnn { GS1 } { module/minwidth } + { + Resulting~module~width~is~less~than~allowed~minimum~\msg_line_context:.\\\\ + GS1~specification~declares~a~minimum~module~width~of~#2.\\ + Currently~the~module~with~would~be~#1.\\ + To~avoid~problems,~I'll~increase~module~width~to~#2. + } % \end{macrocode} % % \subsubsection{Functions} @@ -757,8 +766,6 @@ Control~digit~should~be~ \tl_use:N \l_testb_tl {} ~ { \seq_set_eq:NN \l_@@_code_seq #1 - \leavevmode - \int_compare:nNnTF { \l_GS_code_size_int } { = } { 8 } { \hbox_to_wd:nn { \l_GS_module_wd_dim * 7 } { } @@ -892,10 +899,34 @@ Control~digit~should~be~ \tl_use:N \l_testb_tl {} ~ \seq_put_left:Nn \l_@@_code_seq { 0 } } -% \end{macrocode} -% \textsc{ToDo:} Use options \texttt{scale} and \texttt{scale_to_font}. -% \begin{macrocode} - \GS_use_as_EAN_barcode:N \l_@@_code_seq + \bool_if:NT \l_GS_scale_to_font_bool { + \hbox_set:Nn \l_tmpa_box { 0 } + \dim_set:Nn \l_GS_module_wd_dim { \box_wd:N \l_tmpa_box / 7 } + } + + \dim_set:Nn \l_tmpa_dim + { \fp_to_decimal:N \l_GS_scale_fp \l_GS_module_wd_dim } + + \dim_compare:nNnT + { \l_tmpa_dim } + { < } + { \c_@@_module_min_width_dim } + { + \msg_warning:nnxx { GS1 } { module/minwidth } + { \dim_use:N \l_GS_module_wd_dim } + { \dim_use:N \c_@@_module_min_width_dim } + \dim_set:Nn \l_GS_module_wd_dim + { + \c_@@_module_min_width_dim * + 100 / \fp_to_int:n { 100 * \l_GS_scale_fp } + } + } + + \hbox_set:Nn \l_tmpa_box { \GS_use_as_EAN_barcode:N \l_@@_code_seq } + \box_scale:Nnn \l_tmpa_box + { \fp_to_int:n { 100 * \l_GS_scale_fp } / 100 } + { \fp_to_int:n { 100 * \l_GS_scale_fp } / 100 } + \box_use:N \l_tmpa_box \group_end: } % \end{macrocode} diff --git a/Master/texmf-dist/source/latex/GS1/rule-D.dtx b/Master/texmf-dist/source/latex/GS1/rule-D.dtx index 817583b77f8..1912a83d62a 100644 --- a/Master/texmf-dist/source/latex/GS1/rule-D.dtx +++ b/Master/texmf-dist/source/latex/GS1/rule-D.dtx @@ -17,8 +17,8 @@ %% ------------------------------------------------------------------------- % %<*driver|package> -\RequirePackage{l3names} -\GetIdInfo$Id: rule-D.dtx 3 2012-07-27 10:33:18Z mjk $ +\RequirePackage{expl3} +\GetIdInfo$Id: rule-D.dtx 15 2012-08-27 10:25:03Z mjk $ {rule functions for LaTeX3} %</driver|package> %<*driver> |