\documentclass{article}

%
% Test suite for Mandeubsida hangul GSUB features
% Copyright (C) 2014  Matthew Skala
%
% This program is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation, version 3.
%
% As a special exception, if you create a document which uses this font, and
% embed this font or unaltered portions of this font into the document, this
% font does not by itself cause the resulting document to be covered by the
% GNU General Public License. This exception does not however invalidate any
% other reasons why the document might be covered by the GNU General Public
% License. If you modify this font, you may extend this exception to your
% version of the font, but you are not obligated to do so. If you do not
% wish to do so, delete this exception statement from your version.
%
% This program is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with this program.  If not, see <http://www.gnu.org/licenses/>.
%
% Matthew Skala
% http://ansuz.sooke.bc.ca/
% mskala@ansuz.sooke.bc.ca
%

\usepackage{fontspec}
\usepackage{xcolor}

\definecolor{darkgreen}{rgb}{0,0.35,0}
\definecolor{purplish}{rgb}{0.4,0,0.6}

\usepackage[letterpaper,breaklinks,bookmarks,plainpages=false,
   colorlinks,citecolor=darkgreen,linkcolor=purplish]{hyperref}

\defaultfontfeatures{Mapping=tex-text,Path=../otf/}

\setmainfont[BoldFont={MandeubsidaBatangBoldPS}]{MandeubsidaBatangPS}
% \setmainfont{MandeubsidaSunMoonPS}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{document}
\pagestyle{plain}\thispagestyle{empty}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

This file is intended to serve as a test suite for debugging the
hangul-related GSUB features in the Madeubsida fonts.  The \TeX\ source will
be included in distributions, but the build system will not automatically
build it; those wishing to run the test can build it manually.  A single
syllable (kiyeok-kiyeok-yae-mieum, ``GGYAEM'') is expressed by several
different sequences of Unicode code points, varying in the extent to which
the letters are combined as precomposed code points.  Ideally, in the
default configuration all the sequences should end up substituted by a
single precomposed syllable glyph.  For debugging purposes, the test is
also repeated with the relevant OpenType features explicitly turned on and
off.

\section*{Default OpenType features}

\begin{tabular}{ccccc}
  \small U+1100 & \small U+1100 & \small U+1164 & \small U+11B7 & \\
  \Large ㄱ & \Large ㄱ & \Large ㅒ & \Large ㅁ &
    \Huge\raisebox{0pt}[0pt][0pt]{\char"1100\char"1100\char"1164\char"11B7} \\
  \small U+1101 & \small U+1161 & \small U+11B7 & & \\
  \Large ㄲ & \Large ㅒ & \Large ㅁ & &
    \Huge\raisebox{0pt}[0pt][0pt]{\char"1101\char"1164\char"11B7} \\
  \small U+1100 & \small U+AC54 & \small U+11B7 & & \\
  \Large ㄱ & \Large 걔 & \Large ㅁ & &
    \Huge\raisebox{0pt}[0pt][0pt]{\char"1100\char"AC54\char"11B7} \\
  \small U+AEA0 & \small U+11B7 & & \\
  \Large 꺠 & \Large ㅁ & & &
    \Huge\raisebox{0pt}[0pt][0pt]{\char"AEA0\char"11B7} \\
  \small U+1100 & \small U+AC64 & & & \\
  \Large ㄱ & \Large 걤 & & &
    \Huge\raisebox{0pt}[0pt][0pt]{\char"1100\char"AC64} \\
  \small U+AEB0 & & & & \\
  \Large 꺰 & & & &
    \Huge\raisebox{0pt}[0pt][0pt]{\char"AEB0} \\
\end{tabular}

\addfontfeature{RawFeature={-ccmp,-liga}}
\section*{With -ccmp, -liga}

\begin{tabular}{ccccc}
  \small U+1100 & \small U+1100 & \small U+1164 & \small U+11B7 & \\
  \Large ㄱ & \Large ㄱ & \Large ㅒ & \Large ㅁ &
    \Huge\raisebox{0pt}[0pt][0pt]{\char"1100\char"1100\char"1164\char"11B7} \\
  \small U+1101 & \small U+1161 & \small U+11B7 & & \\
  \Large ㄲ & \Large ㅒ & \Large ㅁ & &
    \Huge\raisebox{0pt}[0pt][0pt]{\char"1101\char"1164\char"11B7} \\
  \small U+1100 & \small U+AC54 & \small U+11B7 & & \\
  \Large ㄱ & \Large 걔 & \Large ㅁ & &
    \Huge\raisebox{0pt}[0pt][0pt]{\char"1100\char"AC54\char"11B7} \\
  \small U+AEA0 & \small U+11B7 & & \\
  \Large 꺠 & \Large ㅁ & & &
    \Huge\raisebox{0pt}[0pt][0pt]{\char"AEA0\char"11B7} \\
  \small U+1100 & \small U+AC64 & & & \\
  \Large ㄱ & \Large 걤 & & &
    \Huge\raisebox{0pt}[0pt][0pt]{\char"1100\char"AC64} \\
  \small U+AEB0 & & & & \\
  \Large 꺰 & & & &
    \Huge\raisebox{0pt}[0pt][0pt]{\char"AEB0} \\
\end{tabular}

\addfontfeature{RawFeature={+ccmp,-liga}}
\section*{With +ccmp, -liga}

\begin{tabular}{ccccc}
  \small U+1100 & \small U+1100 & \small U+1164 & \small U+11B7 & \\
  \Large ㄱ & \Large ㄱ & \Large ㅒ & \Large ㅁ &
    \Huge\raisebox{0pt}[0pt][0pt]{\char"1100\char"1100\char"1164\char"11B7} \\
  \small U+1101 & \small U+1161 & \small U+11B7 & & \\
  \Large ㄲ & \Large ㅒ & \Large ㅁ & &
    \Huge\raisebox{0pt}[0pt][0pt]{\char"1101\char"1164\char"11B7} \\
  \small U+1100 & \small U+AC54 & \small U+11B7 & & \\
  \Large ㄱ & \Large 걔 & \Large ㅁ & &
    \Huge\raisebox{0pt}[0pt][0pt]{\char"1100\char"AC54\char"11B7} \\
  \small U+AEA0 & \small U+11B7 & & \\
  \Large 꺠 & \Large ㅁ & & &
    \Huge\raisebox{0pt}[0pt][0pt]{\char"AEA0\char"11B7} \\
  \small U+1100 & \small U+AC64 & & & \\
  \Large ㄱ & \Large 걤 & & &
    \Huge\raisebox{0pt}[0pt][0pt]{\char"1100\char"AC64} \\
  \small U+AEB0 & & & & \\
  \Large 꺰 & & & &
    \Huge\raisebox{0pt}[0pt][0pt]{\char"AEB0} \\
\end{tabular}

\addfontfeature{RawFeature={-ccmp,+liga}}
\section*{With -ccmp, +liga}

\begin{tabular}{ccccc}
  \small U+1100 & \small U+1100 & \small U+1164 & \small U+11B7 & \\
  \Large ㄱ & \Large ㄱ & \Large ㅒ & \Large ㅁ &
    \Huge\raisebox{0pt}[0pt][0pt]{\char"1100\char"1100\char"1164\char"11B7} \\
  \small U+1101 & \small U+1161 & \small U+11B7 & & \\
  \Large ㄲ & \Large ㅒ & \Large ㅁ & &
    \Huge\raisebox{0pt}[0pt][0pt]{\char"1101\char"1164\char"11B7} \\
  \small U+1100 & \small U+AC54 & \small U+11B7 & & \\
  \Large ㄱ & \Large 걔 & \Large ㅁ & &
    \Huge\raisebox{0pt}[0pt][0pt]{\char"1100\char"AC54\char"11B7} \\
  \small U+AEA0 & \small U+11B7 & & \\
  \Large 꺠 & \Large ㅁ & & &
    \Huge\raisebox{0pt}[0pt][0pt]{\char"AEA0\char"11B7} \\
  \small U+1100 & \small U+AC64 & & & \\
  \Large ㄱ & \Large 걤 & & &
    \Huge\raisebox{0pt}[0pt][0pt]{\char"1100\char"AC64} \\
  \small U+AEB0 & & & & \\
  \Large 꺰 & & & &
    \Huge\raisebox{0pt}[0pt][0pt]{\char"AEB0} \\
\end{tabular}

\addfontfeature{RawFeature={+ccmp,+liga}}
\section*{With +ccmp, +liga}

\begin{tabular}{ccccc}
  \small U+1100 & \small U+1100 & \small U+1164 & \small U+11B7 & \\
  \Large ㄱ & \Large ㄱ & \Large ㅒ & \Large ㅁ &
    \Huge\raisebox{0pt}[0pt][0pt]{\char"1100\char"1100\char"1164\char"11B7} \\
  \small U+1101 & \small U+1161 & \small U+11B7 & & \\
  \Large ㄲ & \Large ㅒ & \Large ㅁ & &
    \Huge\raisebox{0pt}[0pt][0pt]{\char"1101\char"1164\char"11B7} \\
  \small U+1100 & \small U+AC54 & \small U+11B7 & & \\
  \Large ㄱ & \Large 걔 & \Large ㅁ & &
    \Huge\raisebox{0pt}[0pt][0pt]{\char"1100\char"AC54\char"11B7} \\
  \small U+AEA0 & \small U+11B7 & & \\
  \Large 꺠 & \Large ㅁ & & &
    \Huge\raisebox{0pt}[0pt][0pt]{\char"AEA0\char"11B7} \\
  \small U+1100 & \small U+AC64 & & & \\
  \Large ㄱ & \Large 걤 & & &
    \Huge\raisebox{0pt}[0pt][0pt]{\char"1100\char"AC64} \\
  \small U+AEB0 & & & & \\
  \Large 꺰 & & & &
    \Huge\raisebox{0pt}[0pt][0pt]{\char"AEB0} \\
\end{tabular}




%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\end{document}
