diff options
Diffstat (limited to 'Master/texmf-dist/tex/latex/GS1/GS1.sty')
-rw-r--r-- | Master/texmf-dist/tex/latex/GS1/GS1.sty | 43 |
1 files changed, 38 insertions, 5 deletions
diff --git a/Master/texmf-dist/tex/latex/GS1/GS1.sty b/Master/texmf-dist/tex/latex/GS1/GS1.sty index e7cfb071b29..7c97bf56eee 100644 --- a/Master/texmf-dist/tex/latex/GS1/GS1.sty +++ b/Master/texmf-dist/tex/latex/GS1/GS1.sty @@ -31,8 +31,8 @@ %% The released version of this bundle is available from CTAN. %% %% ------------------------------------------------------------------------- -\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} \ProvidesExplPackage {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} @@ -119,6 +119,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. + } \cs_new_nopar:Npn \GS_set_code_digit_seq:Nn #1#2 { \seq_set_eq:NN #1 \c_empty_seq @@ -220,8 +228,6 @@ { \seq_set_eq:NN \l__GS_code_seq #1 - \leavevmode - \int_compare:nNnTF { \l_GS_code_size_int } { = } { 8 } { \hbox_to_wd:nn { \l_GS_module_wd_dim * 7 } { } @@ -313,7 +319,34 @@ \seq_put_left:Nn \l__GS_code_seq { 0 } } - \GS_use_as_EAN_barcode:N \l__GS_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__GS_module_min_width_dim } + { + \msg_warning:nnxx { GS1 } { module/minwidth } + { \dim_use:N \l_GS_module_wd_dim } + { \dim_use:N \c__GS_module_min_width_dim } + \dim_set:Nn \l_GS_module_wd_dim + { + \c__GS_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__GS_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: } \NewDocumentCommand \GSSetup |