% omegacjk.sty
%
% Copyright (C) 2004 Jin-Hwan Cho and Haruhiko Okumura

% OCP for input encodings: Default = UTF8
\ocp\OCPin=inutf8
\DeclareOption{gb}{\ocp\OCPin=ingb}
\DeclareOption{sjis}{\ocp\OCPin=insjis}
\DeclareOption{uhc}{\ocp\OCPin=inuhc}
\ProcessOptions

% OCP for CJK typesetting
\ocp\OCPboundCJK=boundCJK
% Chinese
\ocp\OCPinterCHN=interCHN
% Japanese
\ocp\OCPinterJPN=interJPN
% Korean
\ocp\OCPinterKOR=interKOR

% OCPlists for CJK languages
\ocplist\CJKOCP=
  \addbeforeocplist 1 \OCPboundCJK
  \nullocplist
% Chinese
\ocplist\ChineseOCP=
  \addbeforeocplist 2 \OCPinterCHN
  \CJKOCP
% Japanese
\ocplist\JapaneseOCP=
  \addbeforeocplist 2 \OCPinterJPN
  \CJKOCP
% Korean
\ocplist\KoreanOCP=
  \addbeforeocplist 2 \OCPinterKOR
  \CJKOCP

%% Set the default font
% \font\defaultCJKfont=cyberb
% \def\selectCJKfont{\defaultCJKfont}
% \DeclareFontFamily{OT1}{omcjk}{}
% \DeclareFontShape{OT1}{omcjk}{m}{n}{<-> cyberb}{}
% \def\selectCJKfont{\fontfamily{omcjk}\selectfont}
%% cid-x.map:
%% cyberb    Identity-H   cyberbit/UCS

%% Chinese
% \font\defaultCHNfont=simsun
% \def\selectCHNfont{\defaultCHNfont}
\DeclareFontFamily{OT1}{omzh}{}
\DeclareFontShape{OT1}{omzh}{m}{n}{<-> s * [0.92469] omzhsr}{}
\DeclareFontShape{OT1}{omzh}{bx}{n}{<-> s * [0.92469] omzhsg}{}
\def\selectCHNfont{\fontfamily{omzh}\selectfont}

%% Japanese
% \font\defaultJPNfont=msmincho
% \def\selectJPNfont{\defaultJPNfont}

\DeclareFontFamily{OT1}{omja}{}
\DeclareFontShape{OT1}{omja}{m}{n}{<-> s * [0.92469] omrml}{}
\DeclareFontShape{OT1}{omja}{m}{sc}{<-> s * [0.92469] omrml}{}
\DeclareFontShape{OT1}{omja}{bx}{n}{<-> s * [0.92469] omgbm}{}
\def\selectJPNfont{\fontfamily{omja}\selectfont}

%% cid-x.map:
%% omrml   UniJIS-UCS2-H Ryumin-Light
%% omgbm   UniJIS-UCS2-H GothicBBB-Medium

%% Korean
% \font\defaultKORfont=batang
% \def\selectKORfont{\defaultKORfont}
\DeclareFontFamily{OT1}{omko}{}
\DeclareFontShape{OT1}{omko}{m}{n}{<-> s * [0.92469] omhysm}{}
\DeclareFontShape{OT1}{omko}{m}{sc}{<-> s * [0.92469] omhysm}{}
\DeclareFontShape{OT1}{omko}{bx}{n}{<-> s * [0.92469] omhygt}{}
\def\selectKORfont{\fontfamily{omko}\selectfont}

% CJK space control: Preserve spaces between CJK characters by default
\let\CJKspace\space

% zenkaku width (fullwidth)
\newdimen\zw \zw=0.92469em

% \boundCJKglue == \xkanjiskip in pTeX (changed later)
\newskip\boundCJKskip \boundCJKskip=0em plus .1em minus .05em
\def\boundCJKglue{\hskip\boundCJKskip}

% \interCJKglue == \kanjiskip in pTeX (changed later)
\newskip\interCJKskip \interCJKskip=0em plus .1em minus .05em
\def\interCJKglue{\hskip\interCJKskip}

% CJK boxes for fullwidth characters (used in Japanese)
\def\halfCJKmidbox#1{\leavevmode\hbox to .5\zw{\hss #1\hss}}
\def\halfCJKleftbox#1{\leavevmode\hbox to .5\zw{#1\hss}}
\def\halfCJKrightbox#1{\leavevmode\hbox to .5\zw{\hss #1}}

% Set the default OCPlist
\AtBeginDocument{\InputTranslation currentfile \OCPin}

% Chinese
\newenvironment{chinese}{%
  \pushocplist\ChineseOCP
  \let\selectCJKfont\selectCHNfont
  \let\CJKspace\relax % remove spaces
  \boundCJKskip=0em plus .1em minus .05em
  \interCJKskip=0em plus .1em minus .05em
  \parindent=0.92469em
}{\clearocplists}

% Japanese
\newenvironment{japanese}{%
  \pushocplist\JapaneseOCP
  \let\selectCJKfont\selectJPNfont
  \let\CJKspace\relax % remove spaces
  \boundCJKskip=.25em plus .15em minus .06em
  \interCJKskip=0em plus .1em minus .01em
  \parindent=0.92469em
}{\clearocplists}

% Korean KSCms-UHC(CP949) encoding
\newenvironment{korean}{%
  \pushocplist\KoreanOCP
  \let\selectCJKfont\selectKORfont
  \let\CJKspace\space % preserve spaces
  \boundCJKskip=0em plus .02em minus .01em
  \interCJKskip=0em plus .02em minus .01em
  \parindent=0.92469em
}{\clearocplists}

\def\verbatim@font{\normalfont\ttfamily\spaceskip=0.5em}

\def\pTeX{p\kern-.05em\TeX}
\def\pLaTeX{p\LaTeX}
\def\pLaTeXe{p\LaTeXe}

\endinput
