\NeedsTeXFormat{pLaTeX2e}
\ProvidesPackage{otf}[2004/08/17 v1.2.6.1 psitau]
%for processing options 
\newif\if@kana \@kanafalse
\newif\if@macro \@macrotrue
\newif\if@deluxe \@deluxefalse
\newif\if@replace \@replacetrue
\newif\if@bold \@boldfalse
\DeclareOption{nomacro}{\@macrofalse}
\DeclareOption{nomacros}{\@macrofalse}
\DeclareOption{noreplace}{\@replacefalse}
\DeclareOption{bold}{\@replacetrue\@boldtrue}
\DeclareOption{expert}{\@replacetrue\@kanatrue}
\DeclareOption{deluxe}{\@boldfalse\@replacetrue\@deluxetrue}
\DeclareOption{multi}{\AtEndOfPackage{\RequirePackage{mlutf}\RequirePackage{mlcid}}}
\ProcessOptions\relax
%user interface
%force catcode of \" be 12
\count@\catcode`\"
\catcode`\"=12
\if@deluxe
	\DeclareRobustCommand{\UTF}[1]{\begingroup%
		\edef\reserved@a{\gtdefault}\edef\reserved@b{\mgdefault}%
		\ifx\k@family\reserved@a \kanjifamily{utfjg}\else\ifx\k@family\reserved@b
			\kanjifamily{utfjmg}\else\kanjifamily{utfj}\fi\fi%
		\uppercase{\set@character="#1}%
		\endgroup%
	}
	\DeclareRobustCommand{\CID}[1]{\begingroup%
		\edef\reserved@a{\gtdefault}\edef\reserved@b{\mgdefault}%
		\ifx\k@family\reserved@a \kanjifamily{cidjg}\else\ifx\k@family\reserved@b
			\kanjifamily{cidjmg}\else\kanjifamily{cidj}\fi\fi%
		\set@character=#1%
		\endgroup%
	}
\else
	\DeclareRobustCommand{\UTF}[1]{\begingroup%
		\edef\reserved@a{\gtdefault}\ifx\k@family\reserved@a \kanjiseries{bx}\fi%
		\kanjifamily{utfj}\uppercase{\set@character="#1}%
		\endgroup%
	}
	\DeclareRobustCommand{\CID}[1]{\begingroup%
		\edef\reserved@a{\gtdefault}\ifx\k@family\reserved@a \kanjiseries{bx}\fi%
		\kanjifamily{cidj}\set@character=#1%
		\endgroup%
	}
\fi
\gdef\Redefine@UTF{\@ifpackageloaded{hyperref}{%
	\def\hyper@UTF##1{\ifHy@pdfstring\0x##1\else\csname UTF \endcsname{##1}\fi}
	\def\UTF{\protect\hyper@UTF}}{}
}
\AtBeginDocument{\Redefine@UTF}
%internal macros
%macros by iNOUE Koich!
\newcommand\set@character{\afterassignment\put@character\@tempcnta}
\newcommand\put@character{%
	\@tempcntb=\@tempcnta
	\divide\@tempcntb by "1000
	\kanjishape{\ifcase\@tempcntb0\or1\or2\or3\or4\or5\or6\or7\or8\or9\or a\or b\or c\or d\or e\or f\fi}%
	\selectfont%
	\multiply\@tempcntb by "1000
	\advance\@tempcnta by -\@tempcntb
	\@tempcntb=\@tempcnta
	\divide\@tempcntb by "40
	\multiply\@tempcntb by "C0
	\advance\@tempcnta by \@tempcntb
	\advance\@tempcnta by "3030
	\char\jis\@tempcnta%
}
\catcode`\"=\count@
%end of changing catcode of \"
\def\@UnDeclareFontShape#1#2#3#4{\def\reserved@a{#1/#2/#3/#4}
	\@undeclare@fontshape\@vpt\@vipt\@viipt\@viiipt\@ixpt\@xpt
	\@xipt\@xiipt\@xivpt\@xviipt\@xxpt\@xxvpt\f@size\@nil}
\def\@undeclare@fontshape#1{\ifx\@nil#1\else
	\expandafter\let\csname\reserved@a/#1\endcsname\@undefined
	\expandafter\@undeclare@fontshape\fi}
\def\Declare@FontShape#1#2#3#4{%
	\Declare@FontShapeEnc{JY1}{#1}{#2}{#4}{h}#3\@nil
	\Declare@FontShapeEnc{JT1}{#1}{#2}{#4}{v}#3\@nil}
\def\Declare@FontShapeEnc#1#2#3#4#5#6{\ifx\@nil#6\else
	\DeclareFontShape{#1}{#2}{#3}{#6}{<->s*[\utf@sc@le]#4#6-#5}{}%
	\Declare@FontShape@Enc{#1}{#2}{#3}{#4}{#5}\fi}
\def\Declare@FontShape@Enc#1\fi{\fi\Declare@FontShapeEnc#1}
%for jsclasses
\newif\if@jsclasses \@jsclassesfalse
\@ifclassloaded{jsarticle}{\@jsclassestrue}{}
\@ifclassloaded{jsbook}{\@jsclassestrue}{}
\if@jsclasses\def\utf@sc@le{0.92469}\else\def\utf@sc@le{0.962216}\fi
%definitions of font
\DeclareKanjiFamily{JY1}{utfj}{}
\DeclareKanjiFamily{JT1}{utfj}{}
\DeclareKanjiFamily{JY1}{cidj}{}
\DeclareKanjiFamily{JT1}{cidj}{}
\Declare@FontShape{utfj}{m}{0123456789abcdef}{utfjmr}
\Declare@FontShape{cidj}{m}{01234}{cidjmr}
%definition of maru gothic
\if@deluxe
	\def\mgdefault{mg}
	\DeclareKanjiFamily{JY1}{mg}{}
	\DeclareKanjiFamily{JT1}{mg}{}
	\DeclareRelationFont{JY1}{mg}{m}{}{OT1}{cmss}{m}{}
	\DeclareRelationFont{JT1}{mg}{m}{}{OT1}{cmss}{m}{}
	\DeclareMathAlphabet{\mathmg}{JY1}{mg}{m}{n}
	\DeclareRobustCommand\mgfamily{\not@math@alphabet\mgfamily\mathmg%
		\kanjifamily\mgdefault\selectfont}
	\DeclareTextFontCommand{\textmg}{\mgfamily}
	\DeclareKanjiFamily{JY1}{rubymg}{}
	\DeclareKanjiFamily{JT1}{rubymg}{}
	\DeclareRelationFont{JY1}{rubymg}{m}{}{OT1}{cmss}{m}{}
	\DeclareRelationFont{JT1}{rubymg}{m}{}{OT1}{cmss}{m}{}
	\if@kana
		\DeclareFontShape{JY1}{mg}{m}{n}{<-> s * [\utf@sc@le] expmgothr-h}{}
		\DeclareFontShape{JT1}{mg}{m}{n}{<-> s * [\utf@sc@le] expmgothr-v}{}
		\DeclareFontShape{JY1}{rubymg}{m}{n}{<-> s * [\utf@sc@le] rubymgothr-h}{}
		\DeclareFontShape{JT1}{rubymg}{m}{n}{<-> s * [\utf@sc@le] rubymgothr-v}{}
	\else
		\DeclareFontShape{JY1}{mg}{m}{n}{<-> s * [\utf@sc@le] nmlmgothr-h}{}
		\DeclareFontShape{JT1}{mg}{m}{n}{<-> s * [\utf@sc@le] nmlmgothr-v}{}
	\fi
\fi
%definition of normal fonts
\if@kana
	\DeclareKanjiFamily{JY1}{ruby}{}
	\DeclareKanjiFamily{JT1}{ruby}{}
	\newcommand{\rubydefault}{ruby}
	\DeclareFontShape{JY1}{ruby}{m}{n}{<-> s * [\utf@sc@le] rubyminr-h}{}
	\DeclareFontShape{JT1}{ruby}{m}{n}{<-> s * [\utf@sc@le] rubyminr-v}{}
	\@UnDeclareFontShape{JY1}{mc}{m}{n}
	\@UnDeclareFontShape{JT1}{mc}{m}{n}
	\@UnDeclareFontShape{JY1}{gt}{m}{n}
	\@UnDeclareFontShape{JT1}{gt}{m}{n}
	\DeclareFontShape{JY1}{mc}{m}{n}{<-> s * [\utf@sc@le] expminr-h}{}
	\DeclareFontShape{JT1}{mc}{m}{n}{<-> s * [\utf@sc@le] expminr-v}{}
	\DeclareRelationFont{JY1}{gt}{m}{}{OT1}{cmss}{m}{}
	\DeclareRelationFont{JT1}{gt}{m}{}{OT1}{cmss}{m}{}
	\if@deluxe
		\DeclareFontShape{JY1}{gt}{m}{n}{<-> s * [\utf@sc@le] expgothr-h}{}
		\DeclareFontShape{JT1}{gt}{m}{n}{<-> s * [\utf@sc@le] expgothr-v}{}
		\DeclareKanjiFamily{JY1}{rubyg}{}
		\DeclareKanjiFamily{JT1}{rubyg}{}
		\DeclareRelationFont{JY1}{rubyg}{m}{}{OT1}{cmss}{m}{}
		\DeclareRelationFont{JT1}{rubyg}{m}{}{OT1}{cmss}{m}{}
		\DeclareFontShape{JY1}{rubyg}{m}{n}{<-> s * [\utf@sc@le] rubygothr-h}{}
		\DeclareFontShape{JT1}{rubyg}{m}{n}{<-> s * [\utf@sc@le] rubygothr-v}{}
		\DeclareRobustCommand\rubyfamily{\edef\reserved@a{\gtdefault}%
			\edef\reserved@b{\mgdefault}%
			\ifx\k@family\reserved@a \kanjifamily{rubyg}\else\ifx\k@family\reserved@b
			\kanjifamily{rubymg}\else \kanjifamily{ruby}\fi\fi%
			\selectfont}
	\else
		\if@bold
			\DeclareFontShape{JY1}{gt}{m}{n}{<-> s * [\utf@sc@le] expgothb-h}{}
			\DeclareFontShape{JT1}{gt}{m}{n}{<-> s * [\utf@sc@le] expgothb-v}{}
		\else
			\DeclareFontShape{JY1}{gt}{m}{n}{<-> s * [\utf@sc@le] expgothr-h}{}
			\DeclareFontShape{JT1}{gt}{m}{n}{<-> s * [\utf@sc@le] expgothr-v}{}
		\fi
		\DeclareRobustCommand\rubyfamily{\edef\reserved@a{\gtdefault}%
			\ifx\k@family\reserved@a \kanjiseries{bx}\fi%
			\kanjifamily\rubydefault\selectfont}
	\fi
	\AtBeginDocument{\ifx\rubykatuji\@undefined\else\def\rubykatuji{\rubyfamily\tiny}\fi}
\else
	\if@replace
		\@UnDeclareFontShape{JY1}{mc}{m}{n}
		\@UnDeclareFontShape{JT1}{mc}{m}{n}
		\@UnDeclareFontShape{JY1}{gt}{m}{n}
		\@UnDeclareFontShape{JT1}{gt}{m}{n}
		\DeclareFontShape{JY1}{mc}{m}{n}{<-> s * [\utf@sc@le] nmlminr-h}{}
		\DeclareFontShape{JT1}{mc}{m}{n}{<-> s * [\utf@sc@le] nmlminr-v}{}
		\if@bold
			\DeclareFontShape{JY1}{gt}{m}{n}{<-> s * [\utf@sc@le] nmlgothb-h}{}
			\DeclareFontShape{JT1}{gt}{m}{n}{<-> s * [\utf@sc@le] nmlgothb-v}{}
		\else
			\DeclareFontShape{JY1}{gt}{m}{n}{<-> s * [\utf@sc@le] nmlgothr-h}{}
			\DeclareFontShape{JT1}{gt}{m}{n}{<-> s * [\utf@sc@le] nmlgothr-v}{}
		\fi
	\fi
\fi
%definition of bold fonts
\if@deluxe
	\@UnDeclareFontShape{JY1}{mc}{bx}{n}
	\@UnDeclareFontShape{JT1}{mc}{bx}{n}
	\@UnDeclareFontShape{JY1}{gt}{bx}{n}
	\@UnDeclareFontShape{JT1}{gt}{bx}{n}
	\if@kana
		\DeclareFontShape{JY1}{mc}{bx}{n}{<-> s * [\utf@sc@le] expminb-h}{}
		\DeclareFontShape{JT1}{mc}{bx}{n}{<-> s * [\utf@sc@le] expminb-v}{}
		\DeclareFontShape{JY1}{gt}{bx}{n}{<-> s * [\utf@sc@le] expgothb-h}{}
		\DeclareFontShape{JT1}{gt}{bx}{n}{<-> s * [\utf@sc@le] expgothb-v}{}
		\DeclareFontShape{JY1}{ruby}{bx}{n}{<-> s * [\utf@sc@le] rubyminb-h}{}
		\DeclareFontShape{JT1}{ruby}{bx}{n}{<-> s * [\utf@sc@le] rubyminb-v}{}
		\DeclareFontShape{JY1}{rubyg}{bx}{n}{<-> s * [\utf@sc@le] rubygothb-h}{}
		\DeclareFontShape{JT1}{rubyg}{bx}{n}{<-> s * [\utf@sc@le] rubygothb-v}{}
	\else
		\DeclareFontShape{JY1}{mc}{bx}{n}{<-> s * [\utf@sc@le] nmlminb-h}{}
		\DeclareFontShape{JT1}{mc}{bx}{n}{<-> s * [\utf@sc@le] nmlminb-v}{}
		\DeclareFontShape{JY1}{gt}{bx}{n}{<-> s * [\utf@sc@le] nmlgothb-h}{}
		\DeclareFontShape{JT1}{gt}{bx}{n}{<-> s * [\utf@sc@le] nmlgothb-v}{}
	\fi
	\DeclareKanjiFamily{JY1}{utfjg}{}
	\DeclareKanjiFamily{JT1}{utfjg}{}
	\DeclareKanjiFamily{JY1}{cidjg}{}
	\DeclareKanjiFamily{JT1}{cidjg}{}
	\Declare@FontShape{utfj}{bx}{0123456789abcdef}{utfjmb}
	\Declare@FontShape{cidj}{bx}{01234}{cidjmb}
	\Declare@FontShape{utfjg}{m}{0123456789abcdef}{utfjgr}
	\Declare@FontShape{cidjg}{m}{01234}{cidjgr}
	\Declare@FontShape{utfjg}{bx}{0123456789abcdef}{utfjgb}
	\Declare@FontShape{cidjg}{bx}{01234}{cidjgb}
	\DeclareKanjiFamily{JY1}{utfjmg}{}
	\DeclareKanjiFamily{JT1}{utfjmg}{}
	\DeclareKanjiFamily{JY1}{cidjmg}{}
	\DeclareKanjiFamily{JT1}{cidjmg}{}
	\Declare@FontShape{utfjmg}{m}{0123456789abcdef}{utfjmgr}
	\Declare@FontShape{cidjmg}{m}{01234}{cidjmgr}
\else
	\if@kana
		\DeclareFontShape{JY1}{ruby}{bx}{n}{<-> s * [\utf@sc@le] rubygothb-h}{}
		\DeclareFontShape{JT1}{ruby}{bx}{n}{<-> s * [\utf@sc@le] rubygothb-v}{}
	\fi
	\if@bold
		\Declare@FontShape{utfj}{bx}{0123456789abcdef}{utfjgb}
		\Declare@FontShape{cidj}{bx}{01234}{cidjgb}
	\else
		\Declare@FontShape{utfj}{bx}{0123456789abcdef}{utfjgr}
		\Declare@FontShape{cidj}{bx}{01234}{cidjgr}
	\fi
\fi
%definition of light fonts
\DeclareRobustCommand\ltseries
        {\not@math@alphabet\ltseries\relax
         \kanjiseries\ltdefault\selectfont}
\def\ltdefault{l}
\if@deluxe
	\if@kana
		\DeclareFontShape{JY1}{mc}{l}{n}{<-> s * [\utf@sc@le] expminl-h}{}
		\DeclareFontShape{JT1}{mc}{l}{n}{<-> s * [\utf@sc@le] expminl-v}{}
		\DeclareFontShape{JY1}{ruby}{l}{n}{<-> s * [\utf@sc@le] rubyminl-h}{}
		\DeclareFontShape{JT1}{ruby}{l}{n}{<-> s * [\utf@sc@le] rubyminl-v}{}
	\else
		\DeclareFontShape{JY1}{mc}{l}{n}{<-> s * [\utf@sc@le] nmlminl-h}{}
		\DeclareFontShape{JT1}{mc}{l}{n}{<-> s * [\utf@sc@le] nmlminl-v}{}
	\fi
	\Declare@FontShape{utfj}{l}{0123456789abcdef}{utfjml}
	\Declare@FontShape{cidj}{l}{01234}{cidjml}
\fi
%extra fonts
\if@deluxe
	\DeclareFontShape{JY1}{gt}{eb}{n}{<-> s * [\utf@sc@le] nmlgotheb-h}{}
	\DeclareFontShape{JT1}{gt}{eb}{n}{<-> s * [\utf@sc@le] nmlgotheb-v}{}
	\DeclareFontShape{JY1}{mc}{m}{prp}{<-> s * [\utf@sc@le] phiraminw3-h}{}
	\DeclareFontShape{JY1}{mc}{bx}{prp}{<-> s * [\utf@sc@le] phiraminw6-h}{}
	\DeclareFontShape{JY1}{gt}{m}{prp}{<-> s * [\utf@sc@le] phirakakuw3-h}{}
	\DeclareFontShape{JY1}{gt}{bx}{prp}{<-> s * [\utf@sc@le] phirakakuw6-h}{}
	\DeclareFontShape{JY1}{mg}{m}{prp}{<-> s * [\utf@sc@le] phiramaruw4-h}{}
	\DeclareFontShape{JT1}{mc}{m}{prp}{<-> s * [\utf@sc@le] phiraminw3-v}{}
	\DeclareFontShape{JT1}{mc}{bx}{prp}{<-> s * [\utf@sc@le] phiraminw6-v}{}
	\DeclareFontShape{JT1}{gt}{m}{prp}{<-> s * [\utf@sc@le] phirakakuw3-v}{}
	\DeclareFontShape{JT1}{gt}{bx}{prp}{<-> s * [\utf@sc@le] phirakakuw6-v}{}
	\DeclareFontShape{JT1}{mg}{m}{prp}{<-> s * [\utf@sc@le] phiramaruw4-v}{}
	\DeclareRobustCommand\propshape
		{\not@math@alphabet\propshape\relax
		\kanjishape\propdefault\selectfont}
	\DeclareRobustCommand\ebseries
		{\not@math@alphabet\ebseries\relax
		\kanjiseries\ebdefault\selectfont}
	\def\propdefault{prp}
	\def\ebdefault{eb}
\fi\if@macro
	%input ajmacros.sty
	\IfFileExists{ajmacros.sty}{\RequirePackage{ajmacros}}{\PackageError{otf}{No File ajmacros.sty!}{}}%2003/03/12
	%for literature
	\DeclareRobustCommand\ajKunoji{\iftdir\mbox{\UTF{3033}\UTF{3035}}\else
		\PackageError{otf}{A TATE character in YOKO mode!}{Change a direction to TATE.}%2003/03/12
		\fi}
	\DeclareRobustCommand\ajKunojiwithBou{\iftdir\mbox{\bou{\mbox{\UTF{3033}}}\bou{\mbox{\UTF{3035}}}}\else
		\PackageError{otf}{A TATE character in YOKO mode!}{Change a direction to TATE.}%2003/03/12
		\fi}
	\DeclareRobustCommand\ajDKunoji{\iftdir\mbox{\UTF{3034}\UTF{3035}}\else
		\PackageError{otf}{A TATE character in YOKO mode!}{Change a direction to TATE.}%2003/03/12
		\fi}
	\DeclareRobustCommand\ajDKunojiwithBou{\iftdir\mbox{\bou{\mbox{\UTF{3034}}}\bou{\mbox{\UTF{3035}}}}\else
		\PackageError{otf}{A TATE character in YOKO mode!}{Change a direction to TATE.}%2003/03/12
		\fi}
	\newcommand\ajNinoji{\CID{12106}}
	\newcommand\ajvarNinoji{\iftdir\CID{12107}\else
		\PackageError{otf}{A TATE character in YOKO mode!}{Change a direction to TATE.}%2003/03/12
		\fi}
	\newcommand\ajYusuriten{\iftdir\CID{16193}\else
		\PackageError{otf}{A TATE character in YOKO mode!}{Change a direction to TATE.}%2003/03/12
		\fi}
	\newcommand\ajMasu{\UTF{303c}}
	\newcommand\ajYori{\UTF{309f}}
	\newcommand\ajKoto{\UTF{30ff}}
	\newcommand\ajUta{\UTF{303d}}
	%dingbats
	\newcommand\ajCommandKey{\UTF{2318}}
	\newcommand\ajReturnKey{\UTF{23ce}}
	\newcommand\ajCheckmark{\UTF{2713}}
	\newcommand\ajVisibleSpace{\UTF{2423}}
	\newcommand\ajSenteMark{\UTF{2617}}
	\newcommand\ajGoteMark{\UTF{2616}}
	\newcommand\ajClub{\UTF{2663}}
	\newcommand\ajHeart{\UTF{2661}}
	\newcommand\ajSpade{\UTF{2660}}
	\newcommand\ajDiamond{\UTF{2662}}
	\newcommand\ajvarClub{\UTF{2667}}
	\newcommand\ajvarHeart{\UTF{2665}}
	\newcommand\ajvarSpade{\UTF{2664}}
	\newcommand\ajvarDiamond{\UTF{2666}}
	\newcommand\ajPhone{\UTF{260e}}
	\newcommand\ajPostal{\UTF{3020}}
	\newcommand\ajvarPostal{\UTF{3036}}
	\newcommand\ajSun{\UTF{2600}}
	\newcommand\ajCloud{\UTF{2601}}
	\newcommand\ajUmbrella{\UTF{2602}}
	\newcommand\ajSnowman{\UTF{2603}}
	\newcommand\ajJIS{\UTF{3004}}
	\newcommand\ajJAS{\CID{12088}}
	\newcommand\ajBall{\CID{12097}}
	\newcommand\ajHotSpring{\UTF{2668}}
	\newcommand\ajWhiteSesame{\UTF{fe46}}
	\newcommand\ajBlackSesame{\UTF{fe45}}
	\newcommand\ajWhiteFlorette{\UTF{2740}}
	\newcommand\ajBlackFlorette{\UTF{273f}}
	\newcommand\ajRightBArrow{\CID{8206}}
	\newcommand\ajLeftBArrow{\CID{8207}}
	\newcommand\ajUpBArrow{\CID{8208}}
	\newcommand\ajDownBArrow{\CID{8209}}
	\newcommand\ajRightHand{\CID{8219}}
	\newcommand\ajLeftHand{\CID{8220}}
	\newcommand\ajUpHand{\CID{8221}}
	\newcommand\ajDownHand{\CID{8222}}
	\newcommand\ajRightScissors{\CID{12175}}
	\newcommand\ajLeftScissors{\CID{12176}}
	\newcommand\ajUpScissors{\CID{12177}}
	\newcommand\ajDownScissors{\CID{12178}}
	\newcommand\ajRightWArrow{\CID{12196}}
	\newcommand\ajLeftWArrow{\CID{12197}}
	\newcommand\ajUpWArrow{\CID{12198}}
	\newcommand\ajDownWArrow{\CID{12199}}
	\newcommand\ajRightDownArrow{\CID{12202}}
	\newcommand\ajLeftDownArrow{\CID{12203}}
	\newcommand\ajLeftUpArrow{\CID{12204}}
	\newcommand\ajRightUpArrow{\CID{12205}}
\fi
\endinput
