%%
%% This is file `pangram.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% pangram.dtx  (with options: `package')
%% 
%%   Copyright (C) 2022--2023 by Zhang Tingxuan <alphaztx@163.com>
%% 
%%   This work may be distributed and/or modified under the
%%   conditions of the LaTeX Project Public License, either
%%   version 1.3c of this license or (at your option) any later
%%   version. The latest version of this license is in:
%% 
%%     http://www.latex-project.org/lppl.txt
%% 
%%   and version 1.3 or later is part of all distributions of
%%   LaTeX version 2005/12/01 or later.
%% 
%%   This work has the LPPL maintenance status `maintained'.
%% 
%%   The Current Maintainer of this work is Zhang Tingxuan.
%% 
%%   This work consists of the files pangram.dtx,
%%             and the derived files pangram.ins,
%%                                   pangram.sty,
%%                                   pangram.pdf,
%%                               and README.md.
%% 
\NeedsTeXFormat{LaTeX2e}[2022/06/01]
\ProvidesExplPackage{pangram}{2023/03/01}{0.0c}{a tool for testing fonts}
\clist_new:N \l__pangram_sizes_clist
\int_new:N \l__pangram_size_index_int
\clist_set:Nn \l__pangram_sizes_clist
  {
    5pt,  7pt,  8pt,  9pt, 10pt, 11pt,
   12pt, 14pt, 16pt, 18pt, 20pt, 22pt,
   24pt, 36pt, 48pt, 60pt, 72pt
  }
\tl_const:Nn \c__pangram_text_default_tl
  { The ~ quick ~ brown ~ fox ~ jumps ~ over ~ the ~ lazy ~ dog. ~ 0123456789 }
\tl_const:Nn \c__pangram_text_uppercase_tl
  { THE ~ QUICK ~ BROWN ~ FOX ~ JUMPS ~ OVER ~ THE ~ LAZY ~ DOG. ~ 0123456789 }
\tl_const:Nn \c__pangram_text_glass_tl
  { I ~ can ~ eat ~ glass ~ and ~ it ~ doesn't ~ hurt ~ me. }
\NewDocumentCommand \NewPangramClass { m +m }
  {
    \tl_const:cn { c__pangram_text_#1_tl } { #2 }
  }
\cs_new:Npn \__pangram_resetsizes:n #1
  {
    \tl_if_blank:nF { #1 }
      {
        \clist_set:Nn \l__pangram_sizes_clist { #1 }
      }
  }
\keys_define:nn { pangram }
  {
    textclass.tl_set:N  = \l__pangram_textclass_tl ,
    textclass.default:n = default ,
    textclass.initial:n = default ,
    sizes.code:n        = \__pangram_resetsizes:n { #1 } ,
    linegap.skip_set:N  = \l__pangram_linegap_skip ,
    linegap.default:n   = 5pt plus 3pt minus 2pt ,
    linegap.initial:n   = 5pt plus 3pt minus 2pt ,
    tagskip.skip_set:N  = \l__pangram_tagskip_skip ,
    tagskip.default:n   = 5pt ,
    tagskip.initial:n   = 5pt ,
    tagfont.tl_set:N    = \l__pangram_tagfont_tl ,
    tagfont.default:n   = \ttfamily \footnotesize ,
    tagfont.initial:n   = \ttfamily \footnotesize ,
    font.tl_set:N       = \l__pangram_font_tl ,
    before.tl_set:N     = \l__pangram_before_tl ,
    after.tl_set:N      = \l__pangram_after_tl ,
  }
\NewDocumentCommand \PangramSetup { +m }
  { \keys_set:nn { pangram } { #1 } }
\NewDocumentCommand \pangram { +O{} }
  {
    \group_begin:
    \keys_set:nn { pangram } { #1 }
    \clearpage
    \skip_set:Nn \parskip { \c_zero_dim }
    \int_set:Nn \l__pangram_size_index_int { 0 }
    \tl_use:N \l__pangram_before_tl
    \int_do_while:nNnn
      { \l__pangram_size_index_int } < { \clist_count:N \l__pangram_sizes_clist }
      {
        \mode_leave_vertical:
        \int_incr:N \l__pangram_size_index_int
        \hbox_to_zero:n
          {
            \hss
            \tl_use:N \l__pangram_tagfont_tl
            \clist_item:Nn \l__pangram_sizes_clist { \l__pangram_size_index_int }
            \skip_horizontal:N \l__pangram_tagskip_skip
          }
        \hbox_to_zero:n
          {
            \tl_use:N \l__pangram_font_tl
            \fontsize
              { \clist_item:Nn \l__pangram_sizes_clist { \l__pangram_size_index_int } }
              { \c_zero_dim } % \z@
            \selectfont
            \tl_use:c { c__pangram_text_ \tl_use:N \l__pangram_textclass_tl _tl }
            \hss
          }
        \int_compare:nNnT
          { \l__pangram_size_index_int } = { \clist_count:N \l__pangram_sizes_clist }
          { \skip_set:Nn \l__pangram_linegap_skip { \c_zero_dim } }
        \par
        \skip_vertical:N \l__pangram_linegap_skip
      }
    \tl_use:N \l__pangram_after_tl
    \clearpage
    \group_end:
  }
\endinput
%%
%% End of file `pangram.sty'.
