% \iffalse meta-comment
%
% File: lxgw.dtx
% -----------------------------------------------------------------------
%   Runtime: Copyright (C) 2025 by Mingyu Xia <myhsia@outlook.com>      *
%                                                                       *
%   Fonts:   Copyright (C) 2021-2025 by LXGW <https://github.com/lxgw>  *
% -----------------------------------------------------------------------
%   This work may be distributed and/or modified under the conditions   *
%   of the SIL Open Font License (OFL) version 1.1.                     *
%   The latest version of this license is in                            *
%                                                                       *
%       https://openfontlicense.org                                     *
%                                                                       *
%   This work has the OFL maintenance status `maintained'.              *
%                                                                       *
%   The Current Maintainer of this work on CTAN is Mingyu Xia.          *
%                                                                       *
%   The Current Designer of this font family is LXGW.                   *
% -----------------------------------------------------------------------
%   This work consists of the files lxgw.dtx,                           *
%                                   lxgw.ins,                           *
%                 the derived files ctex-fontset-lxgw.def,              *
%                                   ctex-zhmap-lxgw.tex,                *
%                                   ctex-spa-lxgw.tex,                  *
%                                   ctexpunct-lxgw.spa,                 *
%                    the font files LXGWWenKaiLite-Regular.ttf,         *
%                                   LXGWWenKaiGBLite-Regular.ttf,       *
%                                   LXGWZhenKaiGB-Regular.ttf,          *
%                                   LXGWMarkerGothic-Regular.ttf,       *
%                                   LXGWXiaolai-Regular.ttf,            *
%                                   LXGWYozai-Regular.ttf,              *
%                                   LXGWYozai-Medium.ttf,               *
%           the documentation files lxgw.pdf,                           *
%                               and README.md.                          *
% -----------------------------------------------------------------------
%                                                                       *
%   Any modification of this file should ensure that the copyright and  *
%   license information is placed in the derived files.                 *
%                                                                       *
% -----------------------------------------------------------------------
%
%<*internal>
\iffalse
%</internal>
%
%<*readme>
[![CTAN Version](https://img.shields.io/ctan/v/lxgw-fonts)](https://ctan.org/pkg/lxgw-fonts)
[![GitHub Last Commit](https://img.shields.io/github/last-commit/myhsia/LXGW-CTAN)](https://github.com/myhsia/LXGW-CTAN/commits)
[![GitHub Repo stars](https://img.shields.io/github/stars/myhsia/LXGW-CTAN)](https://github.com/myhsia/LXGW-CTAN)

The `LXGW` Font Family
======================

The `LXGW` Font Family provides an open-source CJK font family with a
comprehensive character set for Chinese (Simplified/Traditional), Cantonese,
and Japanese. A `fontset` configuration of this font family for the `ctex-kit`
is also provided in this package.

Issues
------

The issue tracker for `LXGW` is currently located
[on GitHub](https://github.com/myhsia/LXGW-CTAN).

Copyright and License
---------------------

Runtime: Copyright (C) 2025 by Mingyu Xia <myhsia@outlook.com>

Fonts:   Copyright (C) 2021-2025 by LXGW <https://github.com/lxgw>

This work may be distributed and/or modified under the conditions
of the SIL Open Font License (OFL) version 1.1.
The latest version of this license is in

    https://openfontlicense.org

This work has the OFL maintenance status `maintained'.

The Current Maintainer of this work on CTAN is Mingyu Xia.

The Current Designer of this font family is LXGW.
%</readme>
%
%<*internal>
\fi
%</internal>
%
%<*driver>
\documentclass{l3doc}
\usepackage[mono = false, osf]{libertine}
\usepackage[punct = plain, fontset = lxgw, scheme = plain]{ctex}
\defaultfontfeatures{Extension = .ttf, Scale = .95}
\usepackage{tikz, framed}
\ExplSyntaxOn \makeatletter
\dim_set:Nn \FrameSep {2pt}
\tex_tracinglostchars:D = 0
\tex_XeTeXcharclass:D "2370 = 1
\DeclareDocumentCommand \key { s m }
  {
    \IfBooleanTF {#1} { \color_select:n { red } #2 ~ }
      {
        \seq_set_from_clist:Nn \l_tmpa_seq {#2}
        \seq_set_map:NNn \l_tmpb_seq \l_tmpa_seq
          {
            \color_group_begin:
            \color_select:n { red } \exp_not:n { ##1 }
            \color_group_end:
          }
        \seq_use:Nn \l_tmpb_seq { ,~ } \:=\:
      }
  }
\cs_gset_eq:NN \val \meta
\newlist{keyval}{itemize}{10}
\setlist[keyval]{leftmargin = 0pt, labelsep = 0pt}
\def \HoLogo@LXGW#1{^^A
  \tex_XeTeXcharclass:D "004C = 1^^A L
  \tex_XeTeXcharclass:D "0058 = 1^^A X
  \tex_XeTeXcharclass:D "0047 = 1^^A G
  \tex_XeTeXcharclass:D "0057 = 1^^A W
  LX\kern-.05emG\kern-.05emW}
\makeatother \ExplSyntaxOff
\makeindex
\begin{document}
  \DocInput{\jobname.dtx}
\end{document}
%</driver>
% \fi
%
% \makeatletter
% \title{The \hologo{LXGW} Font Family\thanks{^^A
%   \url{https://github.com/lxgw},
%   \url{https://github.com/myhsia/LXGW-CTAN}
% }\texorpdfstring{\enspace \textbar \enspace\parbox{4em}{^^A
%     \songti
%     \scalebox{\fpeval{4/7}}{落霞与孤鹜齐飞}\\[-.75em]
%     \scalebox{\fpeval{4/7}}{秋水共长天一色}^^A
%   }}{}^^A
% }
%
% \author{^^A
%   Designer: \hologo{LXGW} (霞鹜),\texorpdfstring{\quad}{ }
%   Maintainer: Mingyu Xia (夏明宇)\thanks{\texttt{^^A
%     \href{mailto:xiamingyu@westlake.edu.cn}{xiamingyu@westlake.edu.cn}^^A
%   }}
% }
%
% \date{Released 2025-12-11\quad \texttt{v1.521H}}
%
% \def\Copyright{^^A
%   \begin{center}
%   \setlength \fboxrule {1.2pt} \fbox{\setlength \fboxrule {.6pt}^^A
%     \fbox{\parbox {.8\linewidth} {^^A
%     This package packs a selection of open-source fonts from the
%     \href{https://github.com/lxgw/LxgwWenKai-Lite}
%       {\songti 霞鹜文楷},
%     \href{https://github.com/lxgw/LxgwWenKaiGB-Lite}
%       {\CJKfontspec{LXGWWenKaiGBLite-Regular}\selectfont
%         霞鹜文楷\textsuperscript{国标}},
%     \href{https://github.com/lxgw/LxgwZhenKai}
%       {\songti \bfseries 霞鹜臻楷},
%     \href{https://github.com/lxgw/LxgwMarkerGothic}
%       {\heiti 霞鹜漫黑},
%     \href{https://github.com/lxgw/kose-font}
%       {\fangsong 小赖字体}, and
%     \href{https://github.com/lxgw/yozai-font}
%       {\kaishu 悠哉字体},
%     which are released into public domain by
%     \href{https://lxgw.github.io/}{\hologo{LXGW}} since 2021.
%     They are licensed under the
%     \href{https://ctan.org/license/ofl}{SIL Open Font License (OFL)}.
%   }}}
%   \end{center}}
% \def\@thanks{\Copyright}
%
% \maketitle
% \tikz[remember picture, overlay]
%   \node [ rotate = -10, font = \songti,
%           scale = 50, opacity = .1 ] at
%         ([shift = {(10 * \f@size \p@, 8 * \f@size \p@)}]
%           current page.south west) {鹜};
% \makeatother
%
% \begin{documentation}
%
% \begin{abstract}
%   The \hologo{LXGW} Font Family provides an open-source CJK font family with a
%   comprehensive character set for Chinese (Simplified/Traditional), Cantonese,
%   and Japanese. A |fontset| configuration of this font family for the
%   \pkg{ctex-kit} is also provided in this package.
% \end{abstract}
%
% \section{Usage}
%
% Users are allowed to use the friendly interface:
% the |fontset| key in the \pkg{ctex} package
% \begin{quote}
%   |\usepackage[fontset = lxgw]{ctex}|
% \end{quote}
% or the \cls{ctex} classes
% \begin{quote}
%   |\documentclass[fontset = lxgw]{ctex|^^A
%   \meta{art\textup\textbar book\textup\textbar rep\textup\textbar beamer}|}|
% \end{quote}
% with \hologo{XeLaTeX}, \hologo{LuaLaTeX}, \hologo{LaTeX} + \hologo{DVIPDFMx},
% and \hologo{upLaTeX} + \hologo{DVIPDFMx} supported. \hologo{pdfLaTeX} is not
% supported temporarily since the long mapping time of |zhmap|.
% Additionally, the following four commands are provided for convenience.
% \begin{function}{\songti, \heiti, \fangsong, \kaishu} \footnotesize
%   \begin{syntax}
%   \songti   宋体 (|CJKmainfont|):^^A
% \file{LXGWWenKaiGBLite-Regular.ttf}, \file{LXGWZhenKaiGB-Regular.ttf}.\\
%   \heiti    黑体 (|CJKsansfont|):^^A
% \file{LXGWMarkerGothic-Regular.ttf} (with the |AutoFakeBold| option).\\
%   \fangsong 仿宋 (|CJKmonofont|):^^A
% \file{LXGWXiaolai-Regular.ttf} (with the |AutoFakeBold| option).\\
%   \kaishu   楷书 (itshape of |CJKmainfont|):^^A
% \file{LXGWYozai-Regular.ttf}, \file{LXGWYozai-Medium.ttf}.
%   \end{syntax}
% \end{function}
% \NB{tag}{cmt}
% \begin{NOTE}{tag}
% \end{NOTE}
% Note that the names of the four control sequences make no sense here,
% just to \emph{keep the same naming habit of \pkg{ctex-kit}}.
%
% The implementation of this user-friendly interface is included in
% \ref{subsec:fontset}, \ref{subsec:spa}, and~\ref{subsec:zhmap}.
%
% \section{Font Demos}
%
% The following lists the Chinese/English name, filename, and demos of the
% fonts: Cantonese, Japanese, Chinese (Simplified/Traditional)
% versions of ``\textbf{I Can Eat Glass}'', missing
% character markers are provided with punctuation compression disabled and
% fulfilling line.
% \def\0{^^A
%   \makebox[\linewidth][s]{^^A
%     我可以食玻璃，\textbf{佢傷唔到我㗎。}^^A
%     私はガラスを食べられます。\textbf{それは私を傷つけません。}}\\
%   \makebox[\linewidth][s]{^^A
%     我能吞下玻璃而不伤身体。\textbf{我能吞下玻璃而不伤身体。}^^A
%     我能吞下玻璃而不傷身體。^^^^2370^^^^2370^^^^2370^^A
%   }^^A
% }
% \begin{keyval}
%   \item[\key*{\songti 霞鹜文楷 (\pkg{LXGW WenKai})}]
%         \file{LXGWWenKaiLite-Regular.ttf}, \file{LXGWZhenKaiGB-Regular.ttf}
%   \begin{framed}
%     \songti\0
%   \end{framed}
%   \item[\key*{\CJKfontspec[BoldFont = LXGWZhenKaiGB-Regular]^^A
%                {LXGWWenKaiGBLite-Regular}\selectfont
%         霞鹜文楷\textsubscript{\textbf{国标}}
%         (\pkg{LXGW WenKai\textsubscript{\textbf{GB}}})}]
%         \file{LXGWWenKaiGBLite-Regular.ttf},
%         \file{LXGWZhenKaiGB-Regular.ttf}
%   \begin{framed}
%     \CJKfontspec[BoldFont = LXGWZhenKaiGB-Regular]^^A
%       {LXGWWenKaiGBLite-Regular}\selectfont\0
%   \end{framed}
%   \item[\key*{\heiti 霞鹜漫黑 (\pkg{LXGW Marker Gothic})}]
%         \file{LXGWMarkerGothic-Regular.ttf}
%   \begin{framed}
%     \heiti\0
%   \end{framed}
%   \item[\key*{\fangsong 小赖字体 (\pkg{Xiaolai Font})}]
%         \file{LXGWXiaolai-Regular.ttf}
%   \begin{framed}
%     \fangsong\0
%   \end{framed}
%   \item[\key*{\kaishu 悠哉字体 (\pkg{Yozai Font})}]
%         \file{LXGWYozai-Regular.ttf}, \file{LXGWYozai-Medium.ttf}
%   \begin{framed}
%     \kaishu\0
%   \end{framed}
% \end{keyval}
%
% \end{documentation}
% \clearpage \appendix
% \begin{implementation}
%
% \section{The Source Code}
%
% \subsection{The \texttt{ctex-fontset-lxgw.def} file}\label{subsec:fontset}
%
% Start the optionlist |fontset| for l3docstrip.
%    \begin{macrocode}
%<*fontset>
%    \end{macrocode}
% Declare the \pkg{ctex-kit} font configuration file with date, version, and
% description.
%    \begin{macrocode}
\ProvidesExplFile {ctex-fontset-lxgw.def} {2025-12-11} {v1.521H}
  {lxgw fontset configuration for ctex-kit}
%    \end{macrocode}
% Load CJK font family, interface, accepts the following 4 branches,
% provided by \pkg{ctex-kit}.
%    \begin{macrocode}
\ctex_fontset_case:nnnn
%    \end{macrocode}
% \DescribeOption{\hologo{pdfTeX} (generate PDF)}
% This branch is no longer supported here, and a
% \underline{|fontset-unavailable|} error will raise.
%    \begin{macrocode}
  { \ctex_fontset_error:n { lxgw } }
%    \end{macrocode}
% \begin{texnote}
% For some fontset that supports this branch, line |4| -- |5| should be
% replaced as a line
% \begin{verbatim}
%   \ctex_fontset_case:nnn
% \end{verbatim}
% \end{texnote}
% \DescribeOption{\hologo{pdfTeX} (generate DVI)}
% For those use \hologo{LaTeX} + \hologo{DVIPDFMx}.
%    \begin{macrocode}
  {
%    \end{macrocode}
% Load the \file{.spa} file for the \pkg{CJKpunct} package.
%    \begin{macrocode}
    \ctex_file_input:n { ctexpunct-lxgw.spa }
%    \end{macrocode}
% Case choice controlled by the |zhmap| key of \pkg{ctex-kit}.
%    \begin{macrocode}
    \ctex_zhmap_case:nnn
%    \end{macrocode}
% \begin{arguments}
%   \item Content of this argument will be outputted to the input stream when
%   |zhmap = zhmCJK|
%   \begin{verbatim}[commandchars = \\\{\}]
%     \color{gray}\cs{cs_gset_eq:NN} \cs{ctex_zhmap_case:nnn} \cs{use_i:nnn}
%   \end{verbatim}
% The \hologo{LXGW} font family uses the default |unicode| cmap (Character To
% Glyph Index Mapping Table), not |UniGB-UTF16-H|.
%    \begin{macrocode}
      {
        \setCJKmainfont { LXGWWenKaiLite-Regular.ttf   }
          [
            BoldFont   = LXGWZhenKaiGB-Regular.ttf,
            ItalicFont = LXGWYozai-Regular.ttf,
          ]
        \setCJKsansfont { LXGWMarkerGothic-Regular.ttf } [ AutoFakeBold ]
        \setCJKmonofont { LXGWXiaolai-Regular.ttf      } [ AutoFakeBold ]
        \setCJKfamilyfont { zhsong } { LXGWWenKaiLite-Regular.ttf   }
          [ BoldFont = LXGWZhenKaiGB-Regular.ttf ]
        \setCJKfamilyfont { zhhei  } { LXGWMarkerGothic-Regular.ttf }
          [ AutoFakeBold ]
        \setCJKfamilyfont { zhfs   } { LXGWXiaolai-Regular.ttf      }
          [ AutoFakeBold ]
        \setCJKfamilyfont { zhkai  } { LXGWYozai-Regular.ttf        }
          [ BoldFont = LXGWYozai-Medium.ttf ]
%    \end{macrocode}
% Configure the usages of the edge information of the defined CJK families.
%    \begin{macrocode}
        \ctex_punct_set:n { lxgw }
        \ctex_punct_map_family:nn   { \CJKrmdefault         } { zhsong  }
        \ctex_punct_map_family:nn   { \CJKsfdefault         } { zhhei   }
        \ctex_punct_map_family:nn   { \CJKttdefault         } { zhfs    }
        \ctex_punct_map_bfseries:nn { \CJKrmdefault, zhsong } { zhsongb }
        \ctex_punct_map_bfseries:nn { \CJKsfdefault, zhhei  } { zhheib  }
        \ctex_punct_map_itshape:nn  { \CJKrmdefault         } { zhkai   }
      }
%    \end{macrocode}
%   \item Content of this argument will be outputted to the input stream when
%   |zhmap = true|
%   \begin{verbatim}[commandchars = \\\{\}]
%     \color{gray}\cs{cs_gset_eq:NN} \cs{ctex_zhmap_case:nnn} \cs{use_ii:nnn}
%   \end{verbatim}
%   Load the mapping file \file{ctex-zhmap-lxgw.tex} for \pkg{zhmatrices} and
%   set \cs{CJKrmdefault}, \cs{CJKsfdefault}, \cs{CJKttdefault} respectively.
%    \begin{macrocode}
      {
        \ctex_load_zhmap:nnnn { rm } { zhhei } { zhfs } { lxgw }
%    \end{macrocode}
%   Configure the usages of the edge information of \cs{CJKrmdefault}.
%    \begin{macrocode}
        \ctex_punct_set:n { lxgw }
        \ctex_punct_map_family:nn   { \CJKrmdefault } { zhsong }
        \ctex_punct_map_bfseries:nn { \CJKrmdefault } { zhhei  }
        \ctex_punct_map_itshape:nn  { \CJKrmdefault } { zhkai  }
      }
%    \end{macrocode}
%   \item Content of this argument will be outputted to the input stream when
%   |zhmap = false|
%   \begin{verbatim}[commandchars = \\\{\}]
%     \color{gray}\cs{cs_gset_eq:NN} \cs{ctex_zhmap_case:nnn} \cs{use_iii:nnn}
%   \end{verbatim}
%   Here will raise a \underline{|fontset-unavailable|} error.
%    \begin{macrocode}
      { \ctex_fontset_error:n { lxgw } }
  }
%    \end{macrocode}
% \end{arguments}
% \DescribeOption{\hologo{upTeX}}
% For those use \hologo{upLaTeX} + \hologo{DVIPDFMx}.
% Configure the basic font mapping for \hologo{upTeX}. Due to the definition in
% \pkg{zhmetrics-uptex}, configure
% \begin{multicols}{3}
% \begin{enumerate}
%   \item |upshape|  of serif font.
%   \item |bfseries| of serif font.
%   \item |itshape|  of serif font.
%   \item |upshape|  of sans font.
%   \item |bfseries| of sans font.
%   \item |upshape|  of mono font.
% \end{enumerate}
% \end{multicols}
%    \begin{macrocode}
  {
    \ctex_set_upmap_unicode:nnn { upserif   }
      { LXGWWenKaiLite-Regular.ttf   } { LXGWZhenKaiGB-Regular.ttf }
    \ctex_set_upmap_unicode:nnn { upsans    }
      { LXGWMarkerGothic-Regular.ttf } { }
    \ctex_set_upmap_unicode:nnn { upmono    }
      { LXGWXiaolai-Regular.ttf      } { }
    \ctex_set_upmap_unicode:nnn { upserifit }
      { LXGWYozai-Regular.ttf        } { }
%    \end{macrocode}
%   Config the \textsf{NFSS} font families |zhsong|, |zhhei|, |zhfs|, and
%   |zhkai| to the \textsf{JFM} name in normal type and bold type.
%   Leave empty for those font families with no bold version.
%    \begin{macrocode}
    \ctex_set_upfamily:nnn { zhsong } { upzhserif    } { upzhserifb   }
    \ctex_set_upfamily:nnn { zhhei  } { upzhsans     } { }
    \ctex_set_upfamily:nnn { zhfs   } { upzhmono     } { }
    \ctex_set_upfamily:nnn { zhkai  } { upzhserifit  } { }
  }
%    \end{macrocode}
% \DescribeOption{\hologo{XeTeX}, \hologo{LuaTeX}}
% For those use \hologo{XeLaTeX} or \hologo{LuaLaTeX}.
%    \begin{macrocode}
  {
    \setCJKmainfont { LXGWWenKaiLite-Regular }
      [
        Extension  = .ttf,
        BoldFont   = LXGWZhenKaiGB-Regular,
        ItalicFont = LXGWYozai-Regular
      ]
    \setCJKsansfont { LXGWMarkerGothic-Regular }
      [ Extension = .ttf, AutoFakeBold ]
    \setCJKmonofont { LXGWXiaolai-Regular      }
      [ Extension = .ttf, AutoFakeBold  ]
    \setCJKfamilyfont { zhsong } { LXGWWenKaiLite-Regular   }
      [ Extension = .ttf, BoldFont = LXGWZhenKaiGB-Regular ]
    \setCJKfamilyfont { zhhei  } { LXGWMarkerGothic-Regular }
      [ Extension = .ttf, AutoFakeBold ]
    \setCJKfamilyfont { zhfs   } { LXGWXiaolai-Regular      }
      [ Extension = .ttf, AutoFakeBold ]
    \setCJKfamilyfont { zhkai  } { LXGWYozai-Regular        }
      [ Extension = .ttf, BoldFont = LXGWYozai-Medium ]
  }
%    \end{macrocode}
% \begin{macro}{\songti, \heiti, \fangsong, \kaishu}
% Shortcuts that same as those in the \pkg{ctex-kit}.
%    \begin{macrocode}
\NewDocumentCommand \songti   { } { \CJKfamily { zhsong } }
\NewDocumentCommand \heiti    { } { \CJKfamily { zhhei  } }
\NewDocumentCommand \fangsong { } { \CJKfamily { zhfs   } }
\NewDocumentCommand \kaishu   { } { \CJKfamily { zhkai  } }
%    \end{macrocode}
% \end{macro}
% End the optionlist |fontset| for l3docstrip.
%    \begin{macrocode}
%</fontset>
%    \end{macrocode}
%
% \subsection{The \texttt{ctex-spa-make.tex} and
%   the \texttt{ctexpunct-lxgw.spa} file}\label{subsec:spa}
%
% The \file{.spa} file of the corresponding font will be used
% for the \pkg{CJKpunct} package to achieve the punctuation compression,
% which can ensure the best typeset effect (under the \hologo{pdfTeX} engine).
% Run the following script, \file{ctex-spa-make.tex}, by executing
% \begin{verbatim}
%   xetex ctex-spa-make
% \end{verbatim}
% in the terminal. Then, one can obtain the \file{ctexpunct-lxgw.spa} file.
% \paragraph{Implementation of the script}
% Start the optionlist |makespa| for l3docstrip.
%    \begin{macrocode}
%<*makespa>
%    \end{macrocode}
% Assign the module name of the variables and control sequences, which will be
% automatically replaced by \pkg{l3docstrip}.
%    \begin{macrocode}
%<@@=ctex>
%    \end{macrocode}
% Loading the macro file \file{ctex-spa-macro.tex} provided by \pkg{ctex-kit}.
%    \begin{macrocode}
\input ctex-spa-macro %
%    \end{macrocode}
% However, the macro file needs to be hacked due to the interface change
% of \hologo{XeTeX}.
%    \begin{macrocode}
\ExplSyntaxOn
\cs_set_protected:Npn \@@_write_family:nn #1#2
  {
    \group_begin:
      \tex_font:D \l_@@_punct_font = "[#2]" ~ at ~ 100 pt \scan_stop:
      \l_@@_punct_font
      \clist_clear:N \l_@@_punct_bounds_clist
      \seq_map_inline:Nn \c_@@_punct_seq
        {
          \exp_args:No \_@@_save_bounds:n
            { \int_use:N \tex_XeTeXcharglyph:D ##1 }
        }
      \iow_now:Nx \g_@@_spa_iow
        {
          \token_to_str:N \ctexspadef {#1}
            { \l_@@_punct_bounds_clist , , , }
        }
    \group_end:
  }
\ExplSyntaxOff
%    \end{macrocode}
% List all the CJK families with the corresponding font files in terms of
% ``case-pairs''.
%    \begin{macrocode}
\MAKESPA {ctexpunct-lxgw.spa}
  {
    {lxgwzhsong}      {LXGWWenKaiLite-Regular} ,
    {lxgwzhsongb}     {LXGWZhenKaiGB-Regular} ,
    {lxgwgbzhsong}    {LXGWWenKaiGBLite-Regular} ,
    {lxgwgbzhsongb}   {LXGWZhenKaiGB-Regular} ,
    {lxgwzhhei}       {LXGWMarkerGothic-Regular} ,
    {lxgwzhfs}        {LXGWXiaolai-Regular} ,
    {lxgwzhkai}       {LXGWYozai-Regular} ,
    {lxgwzhkaib}      {LXGWYozai-Medium} ,
  }
%    \end{macrocode}
% End of the script.
%    \begin{macrocode}
\primitive\end
%    \end{macrocode}
% Restore the module name.
%    \begin{macrocode}
%<@@=>
%    \end{macrocode}
% End the optionlist |zhmap| for l3docstrip.
%    \begin{macrocode}
%</makespa>
%    \end{macrocode}
% \iffalse
%    \begin{macrocode}
%<*lxgw-spa>
%    \end{macrocode}
%    \begin{macrocode}
\ctexspadef{lxgwzhsong}{12,11,6,4,72,6,68,5,72,6,71,7,72,6,68,7,66,5,52,5,70,-1,72,4,0,0,12,12,7,71,8,65,10,77,12,76,20,70,18,70,17,72,7,50,12,12,6,72,7,71,6,72,7,68,5,66,5,52,-1,70,4,72,11,12,4,6,6,72,5,68,,,}
\ctexspadef{lxgwzhsongb}{6,8,6,8,71,4,64,5,71,5,70,6,71,5,67,6,65,4,47,4,62,3,66,3,-1,-1,10,10,7,67,4,65,14,67,16,68,17,68,14,67,16,71,6,49,11,11,5,71,6,70,5,71,6,67,4,65,4,47,3,62,3,66,8,6,8,6,4,71,5,64,,,}
\ctexspadef{lxgwgbzhsong}{12,11,6,4,72,6,68,5,72,6,71,7,72,6,68,7,66,5,52,5,70,-1,72,4,0,0,12,12,7,71,8,65,10,77,12,76,20,70,18,70,17,72,7,50,12,12,6,72,7,71,6,72,7,68,5,66,5,52,-1,70,4,72,11,12,4,6,6,72,5,68,,,}
\ctexspadef{lxgwgbzhsongb}{6,8,6,8,71,4,64,5,71,5,70,6,71,5,67,6,65,4,47,4,62,3,66,3,-1,-1,10,10,7,67,4,65,14,67,16,68,17,68,14,67,16,71,6,49,11,11,5,71,6,70,5,71,6,67,4,65,4,47,3,62,3,66,8,6,8,6,4,71,5,64,,,}
\ctexspadef{lxgwzhhei}{11,8,11,8,65,10,54,6,70,7,61,12,73,7,63,7,63,7,43,7,54,4,73,5,0,0,19,18,7,64,8,57,12,77,11,78,11,78,11,78,18,73,10,45,11,11,7,69,12,61,7,73,7,63,7,63,7,43,4,54,5,73,8,11,8,11,10,65,6,54,,,}
\ctexspadef{lxgwzhfs}{71,12,59,6,62,7,56,4,58,11,66,9,65,8,62,10,61,10,54,4,61,4,59,6,0,0,9,12,12,68,4,65,8,78,42,43,43,43,42,43,42,42,31,32,10,8,4,66,8,67,6,67,9,66,10,59,7,52,6,60,6,59,11,70,6,56,6,62,5,52,,,}
\ctexspadef{lxgwzhkai}{70,13,57,6,69,5,54,3,70,3,72,3,65,3,63,10,69,2,54,1,59,4,62,6,-2,-2,9,10,12,64,6,67,11,74,13,74,44,44,43,42,45,43,25,26,7,8,3,70,3,72,2,66,10,63,2,70,2,53,4,60,6,62,11,72,6,58,4,69,3,54,,,}
\ctexspadef{lxgwzhkaib}{70,12,56,5,68,4,53,2,69,2,72,3,65,3,62,9,69,1,53,0,59,3,61,6,-3,-3,8,10,12,63,5,67,10,73,12,74,43,44,43,41,44,42,24,25,7,7,2,70,3,71,2,65,10,62,1,70,2,52,3,59,6,61,10,72,6,57,4,68,2,54,,,}
%    \end{macrocode}
%    \begin{macrocode}
%</lxgw-spa>
%    \end{macrocode}
% \fi
%
% \subsection{The \texttt{ctex-zhmap-lxgw.tex} file}\label{subsec:zhmap}
%
% Start the optionlist |zhmap| for l3docstrip.
%    \begin{macrocode}
%<*zhmap>
%    \end{macrocode}
% Forked from the |zhmap| optionlist of \file{ctex.dtx}\footnote{^^A
%   \url{https://github.com/CTeX-org/ctex-kit/blob/master/ctex/ctex.dtx}}.
%
%    \begin{macrocode}
\begingroup\catcode61\catcode48\catcode32=10\relax%
  \catcode 35=6  % #
  \catcode 45=12 % -
  \catcode123=1  % {
  \catcode125=2  % }
  \toks0{\endlinechar=\the\endlinechar\relax}%
  \toks2{\endlinechar=-1 }%
  \def\x#1 #2 {%
    \toks0\expandafter{\the\toks0 \catcode#1=\the\catcode#1\relax}%
    \toks2\expandafter{\the\toks2 \catcode#1=#2 }}%
  \x  13  5 % carriage return
  \x  32 10 % space
  \x  35  6 % #
  \x  40 12 % (
  \x  41 12 % )
  \x  45 12 % -
  \x  46 12 % .
  \x  47 12 % /
  \x  58 12 % :
  \x  60 12 % <
  \x  61 12 % =
  \x  64 11 % @
  \x  91 12 % [
  \x  93 12 % ]
  \x 123  1 % {
  \x 125  2 % }
  \edef\x#1{\endgroup%
    \edef\noexpand#1{%
      \the\toks0 %
      \let\noexpand\noexpand\noexpand#1%
          \noexpand\noexpand\noexpand\undefined%
      \noexpand\noexpand\noexpand\endinput}%
    \the\toks2}%
\expandafter\x\csname ctex@zhmap@endinput\endcsname
\begingroup\expandafter\endgroup
\expandafter\let\csname ifzhmappdf\expandafter\endcsname\csname
  \expandafter\ifx\csname ifctexpdf\endcsname\relax
    \expandafter\ifx\csname pdfoutput\endcsname\relax
      iffalse\else\ifnum\pdfoutput < 1 iffalse\else iftrue\fi\fi
  \else ifctexpdf\fi
\endcsname
\begingroup
\expandafter\ifx\csname ProvidesFile\endcsname\relax
  \long\def\x#1\ProvidesFile#2[#3]{%
    #1%
    \immediate\write-1{File: #2 #3}%
    \expandafter\xdef\csname ver@#2\endcsname{#3}}
  \expandafter\x%
\fi
\endgroup
%    \end{macrocode}
% Provides the identification information of the font map loader.
%    \begin{macrocode}
\ProvidesFile{ctex-zhmap-lxgw.tex}%
  [2025-12-11 v1.521H lxgw font map loader for DVIPDFMx (CTEX)]
%    \end{macrocode}
% Font map loader for pdfTeX and DVIPDFMx
%    \begin{macrocode}
\ifzhmappdf
%    \end{macrocode}
% Since \hologo{pdfTeX} maps too slowly, this mode is obsolete.
%    \begin{macrocode}
\iffalse
  \pdfmapline{=gbk@UGBK@          <LXGWWenKaiLite-Regular.ttf}
  \pdfmapline{=gbksong@UGBK@      <LXGWWenKaiLite-Regular.ttf}
  \pdfmapline{=gbkkai@UGBK@       <LXGWYozai-Regular.ttf}
  \pdfmapline{=gbkhei@UGBK@       <LXGWMarkerGothic-Regular.ttf}
  \pdfmapline{=gbkfs@UGBK@        <LXGWXiaolai-Regular.ttf}
  \pdfmapline{=cyberb@Unicode@    <LXGWWenKaiLite-Regular.ttf}
  \pdfmapline{=unisong@Unicode@   <LXGWWenKaiLite-Regular.ttf}
  \pdfmapline{=unikai@Unicode@    <LXGWYozai-Regular.ttf}
  \pdfmapline{=unihei@Unicode@    <LXGWMarkerGothic-Regular.ttf}
  \pdfmapline{=unifs@Unicode@     <LXGWXiaolai-Regular.ttf}
  \pdfmapline{=gbksongsl@UGBK@    <LXGWWenKaiLite-Regular.ttf}
  \pdfmapline{=gbkkaisl@UGBK@     <LXGWYozai-Regular.ttf}
  \pdfmapline{=gbkheisl@UGBK@     <LXGWMarkerGothic-Regular.ttf}
  \pdfmapline{=gbkfssl@UGBK@      <LXGWXiaolai-Regular.ttf}
  \pdfmapline{=unisongsl@Unicode@ <LXGWWenKaiLite-Regular.ttf}
  \pdfmapline{=unikaisl@Unicode@  <LXGWYozai-Regular.ttf}
  \pdfmapline{=uniheisl@Unicode@  <LXGWMarkerGothic-Regular.ttf}
  \pdfmapline{=unifssl@Unicode@   <LXGWXiaolai-Regular.ttf}
\fi
%    \end{macrocode}
% Configuration for \hologo{pdfTeX} (generate DVI).
%    \begin{macrocode}
\else
%    \end{macrocode}
% Configure the upright shape of \cs{songti}, \cs{kaishu}, \cs{heiti},
% and \cs{fangsong} mapping for GBK encoding and UTF8 encoding.
%    \begin{macrocode}
  \special{pdf:mapline gbk@UGBK@          unicode LXGWWenKaiLite-Regular.ttf}
  \special{pdf:mapline gbksong@UGBK@      unicode LXGWWenKaiLite-Regular.ttf}
  \special{pdf:mapline gbkkai@UGBK@       unicode LXGWYozai-Regular.ttf}
  \special{pdf:mapline gbkhei@UGBK@       unicode LXGWMarkerGothic-Regular.ttf}
  \special{pdf:mapline gbkfs@UGBK@        unicode LXGWXiaolai-Regular.ttf}
  \special{pdf:mapline cyberb@Unicode@    unicode LXGWWenKaiLite-Regular.ttf}
  \special{pdf:mapline unisong@Unicode@   unicode LXGWWenKaiLite-Regular.ttf}
  \special{pdf:mapline unikai@Unicode@    unicode LXGWYozai-Regular.ttf}
  \special{pdf:mapline unihei@Unicode@    unicode LXGWMarkerGothic-Regular.ttf}
  \special{pdf:mapline unifs@Unicode@     unicode LXGWXiaolai-Regular.ttf}
%    \end{macrocode}
% Similar for the (fake) slant shape, set the
% \emph{Afine Transformation coefficient} to |0.167|, which is the same as the
% default value of |AutoFakeSlant| in the \pkg{xeCJK} package.
%    \begin{macrocode}
  \special{pdf:mapline gbksongsl@UGBK@    unicode LXGWWenKaiLite-Regular.ttf -s .167}
  \special{pdf:mapline gbkkaisl@UGBK@     unicode LXGWYozai-Regular.ttf -s .167}
  \special{pdf:mapline gbkheisl@UGBK@     unicode LXGWMarkerGothic-Regular.ttf -s .167}
  \special{pdf:mapline gbkfssl@UGBK@      unicode LXGWXiaolai-Regular.ttf -s .167}
  \special{pdf:mapline unisongsl@Unicode@ unicode LXGWWenKaiLite-Regular.ttf -s .167}
  \special{pdf:mapline unikaisl@Unicode@  unicode LXGWYozai-Regular.ttf -s .167}
  \special{pdf:mapline uniheisl@Unicode@  unicode LXGWMarkerGothic-Regular.ttf -s .167}
  \special{pdf:mapline unifssl@Unicode@   unicode LXGWXiaolai-Regular.ttf -s .167}
\fi
%    \end{macrocode}
% End the optionlist |zhmap| for l3docstrip.
%    \begin{macrocode}
%</zhmap>
%    \end{macrocode}
% \end{implementation}
% \clearpage
% \PrintIndex
