summaryrefslogtreecommitdiff
path: root/language/korean/kotex-oblivoir/memhangul-ucs/hfontsel.sty
blob: 93ecf2ca9751e484c16827b7b6b66224afc55864 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
%% File `hfontsel.sty`
%%
%% Copyright (c) 2006-2013 Kangsoo Kim <karnes at ktug org>
%%
%% 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.3c or later is part of all distributions of LaTeX
%% version 2006/05/20 or later.
%%
%% 사용법은 다음과 같음
%%    * 전체 정의
%%      \SelectHfonts{utbt,utgt,uttz}{utbt,utgt,utgt}
%%    * 한자 부분을 한글 부분과 같게. 주의.
%%      은타자는 한자가 없으므로 타자체로 은타자를 설정한 경우
%%      이 방식을 쓰면 ttfamily에서 오류.
%%      \SelectHfonts{utbt,utgt,utgt}{*}
%%    * 몇 개만 바꿀 때. 별표 부분은 모두 기본폰트(은글꼴)로 설정됨.
%%      \SelectHfonts{utbt,*,*}{*,*,utgt}
%%
%% 2007/06/03
%%  \SelectHfonts 명령에 의해 생성되는 \hfontfamilynameprefix (2letters)를
%%  [hfontspec] 옵션에 의하여 \usehangulfontspec의 인자로 사용한다. oblivoir
%%  에서는 이 방법을 쓰지 않음.
%% 2007/05/25
%%  dhucs 4.0 compatible
%%  \hfontfamilynameprefix는 사용되지 않을 것이나, 하위호환성을 위해 유지함.
%% 2006/12/15
%%  bug fix. thanks to Dohyun Kim.
%% 2006/09/06
%%  unfonts-type1을 쓸 때 \hfontfamilynameprefix가 {ut}로 되돌려지던 문제점 수정.
%%  non-default 상태에서는 hanja/roman의 설정에 영향을 받는다.
%%
\ProvidesPackage{hfontsel}[2013/09/27]

\newif\if@pshfont\@pshfonttrue
\DeclareOption{ps}{\@pshfonttrue}
\DeclareOption{unttf}{\@pshfontfalse}
\newif\if@hfontspec\@hfontspecfalse
\DeclareOption{hfontspec}{\@hfontspectrue}
\ProcessOptions

\newif\if@defaulthfnt\@defaulthfnttrue
\if@pshfont
\def\defaulthfntprefix{ut}
\else
\def\defaulthfntprefix{un}
\fi

\def\FirstTwoOfFour#1#2#3#4{#1#2}
\newcommand*\SelectHfonts[2]{%
    \def\reserved@a{#2}\def\reserved@b{*}%
    \ifx\reserved@a\reserved@b
		\hangul@fontmap#1\@nil\hanja@fontmap#1\@nil
	\else
		\hangul@fontmap#1\@nil\hanja@fontmap#2\@nil
	\fi
	\if@hfontspec
    \expandafter\usehangulfontspec\expandafter{\hfontfamilynameprefix}	
    \fi
}
\def\hangul@fontmap#1,#2,#3\@nil{%
	\ifx*#1\def\h@ng@ls@rif{\defaulthfntprefix bt}\else\def\h@ng@ls@rif{#1}\fi
	\ifx*#2\def\h@ng@ls@ns{\defaulthfntprefix gt}\else\def\h@ng@ls@ns{#2}\fi
	\ifx*#3\def\h@ng@lt@z@{\defaulthfntprefix tz}\else\def\h@ng@lt@z@{#3}\fi
	\SetHangulFonts{\h@ng@ls@rif}{\h@ng@ls@ns}{\h@ng@lt@z@}%
}
\def\hanja@fontmap#1,#2,#3\@nil{%
	\ifx*#1\def\h@nj@s@rif{\defaulthfntprefix bt}\else\def\h@nj@s@rif{#1}\@defaulthfntfalse\fi
	\ifx*#2\def\h@nj@s@ns{\defaulthfntprefix gt}\else\def\h@nj@s@ns{#2}\fi
	\ifx*#3\def\h@nj@t@z@{\defaulthfntprefix gt}\else\def\h@nj@t@z@{#3}\fi
	\SetHanjaFonts{\h@nj@s@rif}{\h@nj@s@ns}{\h@nj@t@z@}%
%%%% 2006/09/06, 2007/05/25 downward compatibility
    \if@defaulthfnt\def\hfontfamilynameprefix{ut}\else
	   \def\hfontfamilynameprefix{\expandafter\FirstTwoOfFour\h@nj@s@rif}\fi
}

%%% hangul font spec
\if@hfontspec
\usehangulfontspec{\defaulthfntprefix}
\fi

%%% default setting
%\SelectHfonts{\defaulthfntprefix bt,\defaulthfntprefix gt,\defaulthfntprefix tz}{*}

\endinput