\NeedsTeXFormat{pLaTeX2e}
\ProvidesPackage{otf}[2025/02/18 TeX JP org, v1.7b8 psitau, u0.31 ttk]
\RequirePackage{keyval}
%for processing options
\newif\if@kana \@kanafalse
\newif\if@ruby \@rubytrue
\newif\if@macro \@macrotrue
\newif\if@deluxe \@deluxefalse
\newif\if@replace \@replacetrue
\newif\if@bold \@boldfalse
\newif\if@burasage \@burasagefalse
\newif\if@newglyph \@newglyphfalse
\newif\if@otf@uplatex \@otf@uplatexfalse
\newif\if@otf@scale \@otf@scalefalse
\newif\if@jsclasses \@jsclassesfalse

\DeclareOption{nomacro}{\@macrofalse}
\DeclareOption{nomacros}{\@macrofalse}
\DeclareOption{noreplace}{\@replacefalse}
\DeclareOption{noruby}{\@rubyfalse}
\DeclareOption{bold}{\@replacetrue\@boldtrue}
\DeclareOption{expert}{\@replacetrue\@kanatrue}
\DeclareOption{deluxe}{\@boldfalse\@replacetrue\@deluxetrue}
\DeclareOption{multi}{\AtEndOfPackage{\RequirePackage{mlutf}\RequirePackage{mlcid}}}
\DeclareOption{burasage}{\@burasagetrue}
\let\@otf@engine@given=*
\DeclareOption{platex}{\let\@otf@engine@given=p\@otf@uplatexfalse}
\DeclareOption{uplatex}{\let\@otf@engine@given=u\@otf@uplatextrue}
\DeclareOption{autodetect-engine}{\let\@otf@engine@given=*}
\DeclareOption{jis2004}{\@newglyphtrue}
\DeclareOption*{\otfpkg@setkey}
\def\otfpkg@setkey{\expandafter\otfpkg@setkey@a\expandafter{\CurrentOption}}
\def\otfpkg@setkey@a{\setkeys{otfpkg}}
\define@key{otfpkg}{scale}{\@otf@scaletrue\def\utf@sc@le{#1}}

\def\otf@JYn{\if@otf@uplatex JY2\else JY1\fi}
\def\otf@JTn{\if@otf@uplatex JT2\else JT1\fi}
\def\otf@OTorT{\if@otf@uplatex T\else OT\fi}
\def\otf@pfx@{\if@otf@uplatex up\else \fi}
\def\brsg@pfx@{\if@burasage brsg\else\fi}
\def\ruby@pfx@{\if@ruby ruby\else nml\fi}
\def\nlck@sfx@{\if@newglyph n\else\fi}
\ProcessOptions\relax

% Autodetect engine
\ifnum \ifx\ucs\@undefined\z@\else\ucs"3000 \fi ="3000 %upTeX
	\ifx *\@otf@engine@given
		\PackageInfo{otf}{Autodetected engine: upLaTeX}
		\@otf@uplatextrue
	\fi
	\ifx p\@otf@engine@given
		\PackageError{otf}
		{Option 'platex' is specified but you are running upLaTeX.}
		{\@ehc}
	\fi
	\if@otf@uplatex\else
		\PackageError{otf}
			{You are running upLaTeX.\MessageBreak
			 Please use pLaTeX instead, or remove 'platex' from\MessageBreak
			 the package option list}
			{\@ehc}
		\@otf@uplatextrue
	\fi
\else %pTeX
	\ifx *\@otf@engine@given
		\PackageInfo{otf}{Autodetected engine: pLaTeX}
		\@otf@uplatexfalse
	\fi
	\ifx u\@otf@engine@given
		\PackageError{otf}
		{Option 'uplatex' is specified but you are running pLaTeX.}
		{\@ehc}
	\fi
	\if@otf@uplatex
		\PackageError{otf}
			{You are running pLaTeX.\MessageBreak
			 Please use upLaTeX instead, or remove 'uplatex' from\MessageBreak
			 the package option list}
			{\@ehc}
		\@otf@uplatexfalse
	\fi
\fi
%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}% (1) pLaTeX, upLaTeXともに\UTF{}に従来のsubfontを使う
		\uppercase{\if@otf@uplatex\set@character@\else\set@character\fi="#1}% (2) upLaTeXでは\UTF{}に新vfを使う
		\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% (1) pLaTeX, upLaTeXともに\CID{}に従来のsubfontを使う
		\if@otf@uplatex\set@character@\else\set@character\fi=#1% (2) upLaTeXでは\CID{}に新vfを使う
		\endgroup%
	}
\else
	\DeclareRobustCommand{\UTF}[1]{\begingroup%
		\edef\reserved@a{\gtdefault}\ifx\k@family\reserved@a \kanjiseries{bx}\fi%
		\kanjifamily{utfj}%
%		\uppercase{\set@character="#1}% (1) pLaTeX, upLaTeXともに\UTF{}に従来のsubfontを使う
		\uppercase{\if@otf@uplatex\set@character@\else\set@character\fi="#1}% (2) upLaTeXでは\UTF{}に新vfを使う
		\endgroup%
	}
	\DeclareRobustCommand{\CID}[1]{\begingroup%
		\edef\reserved@a{\gtdefault}\ifx\k@family\reserved@a \kanjiseries{bx}\fi%
		\kanjifamily{cidj}%
%		\set@character=#1% (1) pLaTeX, upLaTeXともに\CID{}に従来のsubfontを使う
		\if@otf@uplatex\set@character@\else\set@character\fi=#1% (2) upLaTeXでは\CID{}に新vfを使う
		\endgroup%
	}
\fi
\gdef\Redefine@UTF{\@ifpackageloaded{hyperref}{%
	\def\hyper@UTF##1{\ifHy@pdfstring\hyper@UTF@{##1}\else\csname UTF \endcsname{##1}\fi}
	\def\UTF{\protect\hyper@UTF}}{}
}
% support surrogate pair in \hyper@UTF@{} by ZR-san
\def\otf@end{\otf@end@}
\def\otf@mark{\otf@mark@}
\def\otf@triexpandafter{%
	\expandafter\expandafter\expandafter
}
\begingroup \catcode`\|=0
\gdef\otf@cond#1|fi{%
	#1\expandafter\@firstoftwo
	|else \expandafter\@secondoftwo
	|fi
}
\endgroup
\def\otf@next#1#2#3#4#5{%
	\@namedef{otf@qh/#1#2}{#3}%
	\@namedef{otf@hq/#3}{#1#2}%
	\@namedef{otf@lhq/#4#5}{#1#2}%
}
\@for\otf@x:={%
	00001,01102,02203,03304,10405,11506,12607,13708,%
	20809,2190A,22A0B,23B0C,30C0D,31D0E,32E0F,33F10}\do{%
	\expandafter\otf@next\otf@x
}
\def\otf@next#1{%
	\lowercase{\def\otf@y{#1}}%
	\@namedef{otf@hd/#1}{#1}%
	\@namedef{otf@hd/\otf@y}{#1}%
}
\@tfor\otf@x:=0123456789ABCDEF\do{%
	\expandafter\otf@next\otf@x
}
\def\hyper@UTF@#1{%
	\expandafter\otf@hy@utf@pre@a#1\relax{}\otf@mark\otf@end
}
\def\otf@hy@utf@pre@a{%
	\expandafter\otf@hy@utf@pre@b\romannumeral-`>%
}
\def\otf@hy@utf@pre@b#1#{%
	\otf@cond \ifx\otf@end#1\otf@end \fi{%
		\otf@hy@utf@bombout
	}{%
		\otf@hy@utf@pre@c#1%
	}%
}
\def\otf@hy@utf@pre@c#1{%
	\otf@cond \ifx#1\relax \fi{%
		\otf@hy@utf@pre@end
	}{%
		\otf@triexpandafter\otf@hy@utf@pre@d
		\csname otf@hd/\string#1\endcsname
	}%
}
\def\otf@hy@utf@pre@d#1{%
	\otf@cond \ifx#1\relax \fi{%
		\otf@hy@utf@bombout
	}{%
		\otf@hy@utf@pre@e#1%
	}%
}
\def\otf@hy@utf@pre@e#1#2\otf@mark#3\otf@end{%
	\otf@cond \if 0#1\fi{%
		\otf@cond \ifx\otf@end#3\otf@end \fi{%
			\otf@hy@utf@pre@f{#2}{#3}%
		}{%
			\otf@hy@utf@pre@f{#2}{#3#1}%
		}%
	}{%
		\otf@hy@utf@pre@f{#2}{#3#1}%
	}%
}
\def\otf@hy@utf@pre@f#1#2{%
	\otf@hy@utf@pre@a#1\otf@mark#2\otf@end
}
\def\otf@hy@utf@pre@end#1\otf@mark#2\otf@end{%
	\otf@cond \ifx\otf@end#1\otf@end \fi{%
		\otf@hy@utf@sw{#2}%
	}{%
		\otf@hy@utf@error
	}%
}
\def\otf@hy@utf@bombout#1\otf@end{%
	\otf@hy@utf@error
}

\def\otf@hy@utf@sw#1{%
	\otf@cond \ifnum"0#1>"10FFFF \fi{%
		\otf@hy@utf@error
	}{%
		\otf@hy@utf@sw@a{#1}%
	}%
}
\def\otf@hy@utf@sw@a#1{%
	\otf@cond \ifnum"0#1>"FFFF \fi{%
		\otf@hy@utf@big#1"000000\otf@end
	}{%
		\otf@hy@utf@small#1"0000\otf@end
	}%
}
\def\otf@hy@utf@small#1#2#3#4#5#6\otf@end{%
	\otf@hy@utf@small@a#1#2#3#4#5\otf@end
}
\def\otf@hy@utf@small@a#1"#2\otf@end{%
	\otf@hy@utf@unit{#2#1}%
}
\def\otf@hy@utf@big#1#2#3#4#5#6#7#8\otf@end{%
	\otf@hy@utf@big@a#1#2#3#4#5#6#7\otf@end
}
\def\otf@hy@utf@big@a#1"#2\otf@end{%
	\otf@hy@utf@big@b#2#1\otf@end
}
\def\otf@hy@utf@big@b#1#2#3#4{%
	\otf@triexpandafter\otf@hy@utf@big@c
	\csname otf@lhq/#1#2\otf@triexpandafter\endcsname
	\csname otf@hq/#3\otf@triexpandafter\endcsname
	\csname otf@hq/#4\endcsname
}
\def\otf@hy@utf@big@c#1#2#3#4#5#6{%
	\otf@triexpandafter\otf@hy@utf@big@d
	\csname otf@qh/2#1\otf@triexpandafter\endcsname
	\csname otf@qh/#2#3\otf@triexpandafter\endcsname
	\csname otf@qh/#4#5\otf@triexpandafter\endcsname
	\csname otf@qh/3#6\endcsname
}
\def\otf@hy@utf@big@d#1#2#3#4#5\otf@end{%
	\otf@hy@utf@unit{D#1#2#3}%
	\otf@hy@utf@unit{D#4#5}%
}
\def\otf@hy@utf@error{%
	\otf@hy@utf@unit{FFFD}%
}
\def\otf@hy@utf@unit#1{%
	\0x#1%
}
\AtBeginDocument{\Redefine@UTF}
%internal macros
%macros by iNOUE Koich!
\ifx\kanjishapeforce\@undefined
  \let\otf@kanjishape\kanjishape
\else
  \let\otf@kanjishape\kanjishapeforce
\fi
\newcommand\set@character{\afterassignment\put@character\@tempcnta}
\newcommand\put@character{%
	\@tempcntb=\@tempcnta
	\divide\@tempcntb by "1000
	\otf@kanjishape{\ifcase\@tempcntb0\or1\or2\or3\or4\or5\or6\or7\or8\or9\or a\or b\or c\or d\or e\or f\or
	   \or  \or  \or  \or  \or  \or  \or  \or  \or  \or  \or g\or  \or h\or i\or j\or
	  k\or l\or m\or n\or o\or p\or q\or r\or s\or t\or u\or v\or w\or x\or y\or z\fi}%
	\selectfont%
	\multiply\@tempcntb by "1000
	\advance\@tempcnta by -\@tempcntb
	\@tempcntb=\@tempcnta
	\divide\@tempcntb by "40
	\multiply\@tempcntb by "C0
	\advance\@tempcnta by \@tempcntb
	\if@otf@uplatex
		\advance\@tempcnta by "113030
		\kchar\@tempcnta%
	\else
		\advance\@tempcnta by "3030
		\char\jis\@tempcnta%
	\fi
}
\newcommand\set@character@{\afterassignment\put@character@\@tempcnta}
\newcommand\put@character@{%
	\otf@kanjishape{-}\selectfont%
	\advance\@tempcnta by "110000
	\kchar\@tempcnta%
}
\catcode`\"=\count@
%end of changing catcode of \"
\def\Declare@FontShape#1#2#3#4{%
	\Declare@FontShapeEnc{\otf@JYn}{#1}{#2}{#4}{h}#3\@nil
	\Declare@FontShapeEnc{\otf@JTn}{#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}
\if@otf@scale
	\relax
\else
	\@ifundefined{Cjascale}{%
		%for jsclasses
		\@ifclassloaded{jsreport}{\@jsclassestrue}{}
		\@ifclassloaded{jsarticle}{\@jsclassestrue}{}
		\@ifclassloaded{jsbook}{\@jsclassestrue}{}
		\if@jsclasses\def\utf@sc@le{0.92469}\else\def\utf@sc@le{0.962216}\fi
	}{\edef\utf@sc@le{\Cjascale}}
\fi
%definitions of alt-normal font family
\@ifundefined{if@enablejfam}{%
	\let\if@jfam@used\iffalse
}{%
	\let\if@jfam@used\if@enablejfam
}
\if@replace
	\DeclareErrorKanjiFont{\otf@JYn}{hmc}{m}{n}{10}
	\DeclareKanjiSubstitution{\otf@JYn}{hmc}{m}{n}
	\DeclareKanjiSubstitution{\otf@JTn}{hmc}{m}{n}
	\DeclareKanjiFamily{\otf@JYn}{hmc}{}
	\DeclareKanjiFamily{\otf@JTn}{hmc}{}
	\DeclareKanjiFamily{\otf@JYn}{hgt}{}
	\DeclareKanjiFamily{\otf@JTn}{hgt}{}
	\DeclareRelationFont{\otf@JYn}{hmc}{m}{}{\otf@OTorT1}{cmr}{m}{}
	\DeclareRelationFont{\otf@JTn}{hmc}{m}{}{\otf@OTorT1}{cmr}{m}{}
	\DeclareRelationFont{\otf@JYn}{hmc}{bx}{}{\otf@OTorT1}{cmr}{bx}{}
	\DeclareRelationFont{\otf@JTn}{hmc}{bx}{}{\otf@OTorT1}{cmr}{bx}{}
	\if@deluxe
		\DeclareRelationFont{\otf@JYn}{hgt}{m}{}{\otf@OTorT1}{cmss}{m}{}
		\DeclareRelationFont{\otf@JTn}{hgt}{m}{}{\otf@OTorT1}{cmss}{m}{}
		\DeclareRelationFont{\otf@JYn}{hgt}{bx}{}{\otf@OTorT1}{cmss}{bx}{}
		\DeclareRelationFont{\otf@JTn}{hgt}{bx}{}{\otf@OTorT1}{cmss}{bx}{}
	\else
		\DeclareRelationFont{\otf@JYn}{hgt}{m}{}{\otf@OTorT1}{cmr}{bx}{}
		\DeclareRelationFont{\otf@JTn}{hgt}{m}{}{\otf@OTorT1}{cmr}{bx}{}
		\DeclareRelationFont{\otf@JYn}{hgt}{bx}{}{\otf@OTorT1}{cmr}{bx}{}
		\DeclareRelationFont{\otf@JTn}{hgt}{bx}{}{\otf@OTorT1}{cmr}{bx}{}
	\fi
	\@ifpackageloaded{jisx0213}{\relax}{\def\mcdefault{hmc}\def\gtdefault{hgt}}
	\if@jfam@used
		\if@compatibility\else
			\DeclareSymbolFont{mincho}{\otf@JYn}{hmc}{m}{n}
			\DeclareSymbolFontAlphabet{\mathmc}{mincho}
			\SetSymbolFont{mincho}{bold}{\otf@JYn}{hmc}{bx}{n}
			\DeclareMathAlphabet{\mathgt}{\otf@JYn}{hgt}{m}{n}
			\SetMathAlphabet{\mathgt}{bold}{\otf@JYn}{hgt}{bx}{n}
			\jfam\symmincho
		\fi
	\fi
\fi
\if@kana
	\DeclareKanjiFamily{\otf@JYn}{ruby}{}
	\DeclareKanjiFamily{\otf@JTn}{ruby}{}
	\newcommand{\rubydefault}{ruby}
	\if@deluxe
		\DeclareKanjiFamily{\otf@JYn}{rubyg}{}
		\DeclareKanjiFamily{\otf@JTn}{rubyg}{}
		\DeclareRelationFont{\otf@JYn}{rubyg}{m}{}{\otf@OTorT1}{cmss}{m}{}
		\DeclareRelationFont{\otf@JTn}{rubyg}{m}{}{\otf@OTorT1}{cmss}{m}{}
		\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
		\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}
\fi
%definition of normal font shape
\if@kana
	\DeclareFontShape{\otf@JYn}{hmc}{m}{n}{<-> s * [\utf@sc@le] \otf@pfx@ \brsg@pfx@ expminr\nlck@sfx@-h}{}
	\DeclareFontShape{\otf@JTn}{hmc}{m}{n}{<-> s * [\utf@sc@le] \otf@pfx@ \brsg@pfx@ expminr\nlck@sfx@-v}{}
	\DeclareFontShape{\otf@JYn}{ruby}{m}{n}{<-> s * [\utf@sc@le] \otf@pfx@ \ruby@pfx@ minr-h}{}
	\DeclareFontShape{\otf@JTn}{ruby}{m}{n}{<-> s * [\utf@sc@le] \otf@pfx@ \ruby@pfx@ minr-v}{}
\else
	\if@replace
		\DeclareFontShape{\otf@JYn}{hmc}{m}{n}{<-> s * [\utf@sc@le] \otf@pfx@ \brsg@pfx@ nmlminr\nlck@sfx@-h}{}
		\DeclareFontShape{\otf@JTn}{hmc}{m}{n}{<-> s * [\utf@sc@le] \otf@pfx@ \brsg@pfx@ nmlminr\nlck@sfx@-v}{}
	\fi
\fi
\if@replace\if@deluxe
	\if@kana
		\DeclareFontShape{\otf@JYn}{hmc}{bx}{n}{<-> s * [\utf@sc@le] \otf@pfx@ \brsg@pfx@ expminb\nlck@sfx@-h}{}
		\DeclareFontShape{\otf@JTn}{hmc}{bx}{n}{<-> s * [\utf@sc@le] \otf@pfx@ \brsg@pfx@ expminb\nlck@sfx@-v}{}
		\DeclareFontShape{\otf@JYn}{hgt}{m}{n}{<-> s * [\utf@sc@le] \otf@pfx@ \brsg@pfx@ expgothr\nlck@sfx@-h}{}
		\DeclareFontShape{\otf@JTn}{hgt}{m}{n}{<-> s * [\utf@sc@le] \otf@pfx@ \brsg@pfx@ expgothr\nlck@sfx@-v}{}
		\DeclareFontShape{\otf@JYn}{hgt}{bx}{n}{<-> s * [\utf@sc@le] \otf@pfx@ \brsg@pfx@ expgothb\nlck@sfx@-h}{}
		\DeclareFontShape{\otf@JTn}{hgt}{bx}{n}{<-> s * [\utf@sc@le] \otf@pfx@ \brsg@pfx@ expgothb\nlck@sfx@-v}{}
		\DeclareFontShape{\otf@JYn}{ruby}{bx}{n}{<-> s * [\utf@sc@le] \otf@pfx@ \ruby@pfx@ minb-h}{}
		\DeclareFontShape{\otf@JTn}{ruby}{bx}{n}{<-> s * [\utf@sc@le] \otf@pfx@ \ruby@pfx@ minb-v}{}
		\DeclareFontShape{\otf@JYn}{rubyg}{m}{n}{<-> s * [\utf@sc@le] \otf@pfx@ \ruby@pfx@ gothr-h}{}
		\DeclareFontShape{\otf@JTn}{rubyg}{m}{n}{<-> s * [\utf@sc@le] \otf@pfx@ \ruby@pfx@ gothr-v}{}
		\DeclareFontShape{\otf@JYn}{rubyg}{bx}{n}{<-> s * [\utf@sc@le] \otf@pfx@ \ruby@pfx@ gothb-h}{}
		\DeclareFontShape{\otf@JTn}{rubyg}{bx}{n}{<-> s * [\utf@sc@le] \otf@pfx@ \ruby@pfx@ gothb-v}{}
	\else
		\DeclareFontShape{\otf@JYn}{hmc}{bx}{n}{<-> s * [\utf@sc@le] \otf@pfx@ \brsg@pfx@ nmlminb\nlck@sfx@-h}{}
		\DeclareFontShape{\otf@JTn}{hmc}{bx}{n}{<-> s * [\utf@sc@le] \otf@pfx@ \brsg@pfx@ nmlminb\nlck@sfx@-v}{}
		\DeclareFontShape{\otf@JYn}{hgt}{m}{n}{<-> s * [\utf@sc@le] \otf@pfx@ \brsg@pfx@ nmlgothr\nlck@sfx@-h}{}
		\DeclareFontShape{\otf@JTn}{hgt}{m}{n}{<-> s * [\utf@sc@le] \otf@pfx@ \brsg@pfx@ nmlgothr\nlck@sfx@-v}{}
		\DeclareFontShape{\otf@JYn}{hgt}{bx}{n}{<-> s * [\utf@sc@le] \otf@pfx@ \brsg@pfx@ nmlgothb\nlck@sfx@-h}{}
		\DeclareFontShape{\otf@JTn}{hgt}{bx}{n}{<-> s * [\utf@sc@le] \otf@pfx@ \brsg@pfx@ nmlgothb\nlck@sfx@-v}{}
	\fi
\else
	\if@kana
		\if@bold
			\DeclareFontShape{\otf@JYn}{hgt}{m}{n}{<-> s * [\utf@sc@le] \otf@pfx@ \brsg@pfx@ expgothb\nlck@sfx@-h}{}
			\DeclareFontShape{\otf@JTn}{hgt}{m}{n}{<-> s * [\utf@sc@le] \otf@pfx@ \brsg@pfx@ expgothb\nlck@sfx@-v}{}
			\DeclareFontShape{\otf@JYn}{ruby}{bx}{n}{<-> s * [\utf@sc@le] \otf@pfx@ \ruby@pfx@ gothb-h}{}
			\DeclareFontShape{\otf@JTn}{ruby}{bx}{n}{<-> s * [\utf@sc@le] \otf@pfx@ \ruby@pfx@ gothb-v}{}
		\else
			\DeclareFontShape{\otf@JYn}{hgt}{m}{n}{<-> s * [\utf@sc@le] \otf@pfx@ \brsg@pfx@ expgothr\nlck@sfx@-h}{}
			\DeclareFontShape{\otf@JTn}{hgt}{m}{n}{<-> s * [\utf@sc@le] \otf@pfx@ \brsg@pfx@ expgothr\nlck@sfx@-v}{}
			\DeclareFontShape{\otf@JYn}{ruby}{bx}{n}{<-> s * [\utf@sc@le] \otf@pfx@ \ruby@pfx@ gothr-h}{}
			\DeclareFontShape{\otf@JTn}{ruby}{bx}{n}{<-> s * [\utf@sc@le] \otf@pfx@ \ruby@pfx@ gothr-v}{}
		\fi
	\else
		\if@bold
			\DeclareFontShape{\otf@JYn}{hgt}{m}{n}{<-> s * [\utf@sc@le] \otf@pfx@ \brsg@pfx@ nmlgothb\nlck@sfx@-h}{}
			\DeclareFontShape{\otf@JTn}{hgt}{m}{n}{<-> s * [\utf@sc@le] \otf@pfx@ \brsg@pfx@ nmlgothb\nlck@sfx@-v}{}
		\else
			\DeclareFontShape{\otf@JYn}{hgt}{m}{n}{<-> s * [\utf@sc@le] \otf@pfx@ \brsg@pfx@ nmlgothr\nlck@sfx@-h}{}
			\DeclareFontShape{\otf@JTn}{hgt}{m}{n}{<-> s * [\utf@sc@le] \otf@pfx@ \brsg@pfx@ nmlgothr\nlck@sfx@-v}{}
		\fi
	\fi
	\DeclareFontShape{\otf@JYn}{hmc}{bx}{n}{<->ssub*hgt/m/n}{}
	\DeclareFontShape{\otf@JTn}{hmc}{bx}{n}{<->ssub*hgt/m/n}{}
	\DeclareFontShape{\otf@JYn}{hgt}{bx}{n}{<->ssub*hgt/m/n}{}
	\DeclareFontShape{\otf@JTn}{hgt}{bx}{n}{<->ssub*hgt/m/n}{}
\fi\fi
%definition of extra fonts: maru gothic family, light series, eb series, prop. shape
\if@deluxe
	\def\mgdefault{mg}
	\def\propdefault{prp}
	\def\ebdefault{eb}
	\def\ltdefault{l}
	\DeclareKanjiFamily{\otf@JYn}{mg}{}
	\DeclareKanjiFamily{\otf@JTn}{mg}{}
	\DeclareRelationFont{\otf@JYn}{mg}{m}{}{\otf@OTorT1}{cmss}{m}{}
	\DeclareRelationFont{\otf@JTn}{mg}{m}{}{\otf@OTorT1}{cmss}{m}{}
	\DeclareMathAlphabet{\mathmg}{\otf@JYn}{mg}{m}{n}
	\DeclareRobustCommand\mgfamily{\not@math@alphabet\mgfamily\mathmg%
		\kanjifamily\mgdefault\selectfont}
	\DeclareTextFontCommand{\textmg}{\mgfamily}
	\DeclareKanjiFamily{\otf@JYn}{rubymg}{}
	\DeclareKanjiFamily{\otf@JTn}{rubymg}{}
	\DeclareRelationFont{\otf@JYn}{rubymg}{m}{}{\otf@OTorT1}{cmss}{m}{}
	\DeclareRelationFont{\otf@JTn}{rubymg}{m}{}{\otf@OTorT1}{cmss}{m}{}
	\DeclareRobustCommand\propshape
		{\not@math@alphabet\propshape\relax
		\kanjishape\propdefault\selectfont}
	\DeclareRobustCommand\ebseries
		{\not@math@alphabet\ebseries\relax
		\kanjiseries\ebdefault\selectfont}
	\DeclareRobustCommand\ltseries
		{\not@math@alphabet\ltseries\relax
		\kanjiseries\ltdefault\selectfont}
	\if@kana
		\DeclareFontShape{\otf@JYn}{mg}{m}{n}{<-> s * [\utf@sc@le] \otf@pfx@ \brsg@pfx@ expmgothr\nlck@sfx@-h}{}
		\DeclareFontShape{\otf@JTn}{mg}{m}{n}{<-> s * [\utf@sc@le] \otf@pfx@ \brsg@pfx@ expmgothr\nlck@sfx@-v}{}
		\DeclareFontShape{\otf@JYn}{rubymg}{m}{n}{<-> s * [\utf@sc@le] \otf@pfx@ \ruby@pfx@ mgothr-h}{}
		\DeclareFontShape{\otf@JTn}{rubymg}{m}{n}{<-> s * [\utf@sc@le] \otf@pfx@ \ruby@pfx@ mgothr-v}{}
		\DeclareFontShape{\otf@JYn}{hmc}{l}{n}{<-> s * [\utf@sc@le] \otf@pfx@ \brsg@pfx@ expminl\nlck@sfx@-h}{}
		\DeclareFontShape{\otf@JTn}{hmc}{l}{n}{<-> s * [\utf@sc@le] \otf@pfx@ \brsg@pfx@ expminl\nlck@sfx@-v}{}
		\DeclareFontShape{\otf@JYn}{hgt}{eb}{n}{<-> s * [\utf@sc@le] \otf@pfx@ \brsg@pfx@ expgotheb\nlck@sfx@-h}{}
		\DeclareFontShape{\otf@JTn}{hgt}{eb}{n}{<-> s * [\utf@sc@le] \otf@pfx@ \brsg@pfx@ expgotheb\nlck@sfx@-v}{}
		\DeclareFontShape{\otf@JYn}{ruby}{l}{n}{<-> s * [\utf@sc@le] \otf@pfx@ \ruby@pfx@ minl-h}{}
		\DeclareFontShape{\otf@JTn}{ruby}{l}{n}{<-> s * [\utf@sc@le] \otf@pfx@ \ruby@pfx@ minl-v}{}
		\DeclareFontShape{\otf@JYn}{rubyg}{eb}{n}{<-> s * [\utf@sc@le] \otf@pfx@ \ruby@pfx@ gotheb-h}{}
		\DeclareFontShape{\otf@JTn}{rubyg}{eb}{n}{<-> s * [\utf@sc@le] \otf@pfx@ \ruby@pfx@ gotheb-v}{}
	\else
		\DeclareFontShape{\otf@JYn}{mg}{m}{n}{<-> s * [\utf@sc@le] \otf@pfx@ \brsg@pfx@ nmlmgothr\nlck@sfx@-h}{}
		\DeclareFontShape{\otf@JTn}{mg}{m}{n}{<-> s * [\utf@sc@le] \otf@pfx@ \brsg@pfx@ nmlmgothr\nlck@sfx@-v}{}
		\DeclareFontShape{\otf@JYn}{hmc}{l}{n}{<-> s * [\utf@sc@le] \otf@pfx@ \brsg@pfx@ nmlminl\nlck@sfx@-h}{}
		\DeclareFontShape{\otf@JTn}{hmc}{l}{n}{<-> s * [\utf@sc@le] \otf@pfx@ \brsg@pfx@ nmlminl\nlck@sfx@-v}{}
		\DeclareFontShape{\otf@JYn}{hgt}{eb}{n}{<-> s * [\utf@sc@le] \otf@pfx@ \brsg@pfx@ nmlgotheb\nlck@sfx@-h}{}
		\DeclareFontShape{\otf@JTn}{hgt}{eb}{n}{<-> s * [\utf@sc@le] \otf@pfx@ \brsg@pfx@ nmlgotheb\nlck@sfx@-v}{}
	\fi
	\DeclareFontShape{\otf@JYn}{hmc}{m}{prp}{<-> s * [\utf@sc@le] \otf@pfx@ phiraminw3-h}{}
	\DeclareFontShape{\otf@JYn}{hmc}{bx}{prp}{<-> s * [\utf@sc@le] \otf@pfx@ phiraminw6-h}{}
	\DeclareFontShape{\otf@JYn}{hgt}{m}{prp}{<-> s * [\utf@sc@le] \otf@pfx@ phirakakuw3-h}{}
	\DeclareFontShape{\otf@JYn}{hgt}{bx}{prp}{<-> s * [\utf@sc@le] \otf@pfx@ phirakakuw6-h}{}
	\DeclareFontShape{\otf@JYn}{mg}{m}{prp}{<-> s * [\utf@sc@le] \otf@pfx@ phiramaruw4-h}{}
	\DeclareFontShape{\otf@JTn}{hmc}{m}{prp}{<-> s * [\utf@sc@le] \otf@pfx@ phiraminw3-v}{}
	\DeclareFontShape{\otf@JTn}{hmc}{bx}{prp}{<-> s * [\utf@sc@le] \otf@pfx@ phiraminw6-v}{}
	\DeclareFontShape{\otf@JTn}{hgt}{m}{prp}{<-> s * [\utf@sc@le] \otf@pfx@ phirakakuw3-v}{}
	\DeclareFontShape{\otf@JTn}{hgt}{bx}{prp}{<-> s * [\utf@sc@le] \otf@pfx@ phirakakuw6-v}{}
	\DeclareFontShape{\otf@JTn}{mg}{m}{prp}{<-> s * [\utf@sc@le] \otf@pfx@ phiramaruw4-v}{}
\fi
%definition of normal utf/cid fonts
\DeclareKanjiFamily{\otf@JYn}{utfj}{}
\DeclareKanjiFamily{\otf@JTn}{utfj}{}
\DeclareKanjiFamily{\otf@JYn}{cidj}{}
\DeclareKanjiFamily{\otf@JTn}{cidj}{}
\Declare@FontShape{utfj}{m}{0123456789abcdefjklmnopqrstuvxyz-}{utfjmr\nlck@sfx@}
\Declare@FontShape{cidj}{m}{012345-}{cidjmr}
%definition of other utf/cid fonts
\if@deluxe
	\Declare@FontShape{utfj}{bx}{0123456789abcdefjklmnopqrstuvxyz-}{utfjmb\nlck@sfx@}
	\Declare@FontShape{cidj}{bx}{012345-}{cidjmb}
	\DeclareKanjiFamily{\otf@JYn}{utfjg}{}
	\DeclareKanjiFamily{\otf@JTn}{utfjg}{}
	\DeclareKanjiFamily{\otf@JYn}{cidjg}{}
	\DeclareKanjiFamily{\otf@JTn}{cidjg}{}
	\Declare@FontShape{utfjg}{m}{0123456789abcdefjklmnopqrstuvxyz-}{utfjgr\nlck@sfx@}
	\Declare@FontShape{cidjg}{m}{012345-}{cidjgr}
	\Declare@FontShape{utfjg}{bx}{0123456789abcdefjklmnopqrstuvxyz-}{utfjgb\nlck@sfx@}
	\Declare@FontShape{cidjg}{bx}{012345-}{cidjgb}
	\Declare@FontShape{utfjg}{eb}{0123456789abcdefjklmnopqrstuvxyz-}{utfjge\nlck@sfx@}
	\Declare@FontShape{cidjg}{eb}{012345-}{cidjge}
	\DeclareKanjiFamily{\otf@JYn}{utfjmg}{}
	\DeclareKanjiFamily{\otf@JTn}{utfjmg}{}
	\DeclareKanjiFamily{\otf@JYn}{cidjmg}{}
	\DeclareKanjiFamily{\otf@JTn}{cidjmg}{}
	\Declare@FontShape{utfjmg}{m}{0123456789abcdefjklmnopqrstuvxyz-}{utfjmgr\nlck@sfx@}
	\Declare@FontShape{cidjmg}{m}{012345-}{cidjmgr}
	\Declare@FontShape{utfj}{l}{0123456789abcdefjklmnopqrstuvxyz-}{utfjml\nlck@sfx@}
	\Declare@FontShape{cidj}{l}{012345-}{cidjml}
\else
	\if@bold
		\Declare@FontShape{utfj}{bx}{0123456789abcdefjklmnopqrstuvxyz-}{utfjgb\nlck@sfx@}
		\Declare@FontShape{cidj}{bx}{012345-}{cidjgb}
	\else
		\Declare@FontShape{utfj}{bx}{0123456789abcdefjklmnopqrstuvxyz-}{utfjgr\nlck@sfx@}
		\Declare@FontShape{cidj}{bx}{012345-}{cidjgr}
	\fi
\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{12176}}
	\newcommand\ajLeftScissors{\CID{12175}}
	\newcommand\ajUpScissors{\CID{12177}}
	\newcommand\ajDownScissors{\CID{12178}}
	\newcommand\ajRightWArrow{\CID{12197}}
	\newcommand\ajLeftWArrow{\CID{12196}}
	\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
