# How can I enable XeTeX to typeset partial Hangeul (Korean)?

When I compile the following code containing partial Korean Hangeul characters with XeTeX, the characters are not displayed properly. When compiling with LuaTeX they are set overlapping each other, as they should.

What is the reason for the different output? I would prefer to use XeTeX, but can I enable it to work with these characters as well?

\documentclass{scrarticle}
\usepackage{ifxetex,ifluatex}

\ifxetex
\usepackage{fontspec}
\usepackage{xeCJK}
\setCJKmainfont{Batang}
\else\ifluatex
\usepackage{fontspec}
\usepackage{luatexko}
\fi\fi

\usepackage{xcolor}
\newcommand{\noV}{{\color{black!20}ᅟᅳ}}

\begin{document}

Only works in Lua\TeX: \noV ᆯ

Only works in Lua\TeX: \noV ᆼ

Full characters always work: 한글

\end{document}


XeTeX Output:

LuaTeX Output:

# Edit:

\color does not seem to be the culprit

...
\begin{document}

Still only works in Lua\TeX: ᅟᅳᆯ

Still only works in Lua\TeX: ᅟᅳᆼ
% Stack.EX can compose them too :o

Full characters always work: 한글

\end{document}


XeTeX Output:

LuaTeX Output:

Since this editor already displays the partial chars in combination, for clarity, I'll list the characters separately:
the filler "ᅟ" (U+115F)
followed by the vowel "ᅳ" (U+1173)
followed by "ᆯ" resp. "ᆼ" (U+11AF and U+110B)

• The color command is the problem. \color insert whatsits between the chars and so disable ligatures and similar. xetex has no tools to handle this. So either don't use a color, or use lualatex. – Ulrike Fischer Mar 23 at 7:22
• @UlrikeFischer The problem remains without \color as well. I've updated my question to include more detail. Instead of overlapping the composite symbols, XeTeX prints the same result as if I had used single symbols like ㄹ (U+3139) instead. – Nawit Mar 23 at 9:38
• I don't have your font but I tried with \setCJKmainfont{UnBatang.ttf} and it looks ok. I have a current texlive 2021 on windows. – Ulrike Fischer Mar 23 at 9:43
• Stupid me, blaming poor XeTeX... Yes, the font was the issue, thanks! – Nawit Mar 23 at 9:56

\setCJKmainfont{UnBatang}