(chise-tex-decode-region): Decode \`, \', \^, \~, \=, \., \" and \d.
[chise/omega.git] / chise.sty
index 3efac53..6339b10 100644 (file)
--- a/chise.sty
+++ b/chise.sty
 \ProvidesPackage{chise}[2003/11/26 v.0.2 (Omega/CHISE Team)]
 % based on mulambda and omega-japanese
 %\RequirePackage{omega}
-\RequirePackage[UT1]{fontenc}
+\RequirePackage[OT1]{fontenc}
 
 %% options %%
 
 %% You must change the path of inCHISE,
-%% if inCHISE is not located in the default directory.
+%%   if inCHISE is not located in the default directory.
+%% Replace all "/usr/local/share/texmf/omega/ocp/local/chise/"
+%%   to the appropriate path.
 
 \DeclareOption{utf8mcs}{
-  \externalocp\OCPuniGB=/usr/local/lib/chise/omega/Utf8mcsToUniGB {}
-  \ocplist\uniGB=
-    \addbeforeocplist 1 \OCPuniGB
-    \nullocplist
-  \externalocp\OCPuniCNS=/usr/local/lib/chise/omega/Utf8mcsToUniCNS {}
-  \ocplist\uniCNS=
-    \addbeforeocplist 1 \OCPuniCNS
-    \nullocplist
-  \externalocp\OCPuniJIS=/usr/local/lib/chise/omega/Utf8mcsToUniJIS {}
-  \ocplist\uniJIS=
-    \addbeforeocplist 1 \OCPuniJIS
-    \nullocplist
-  \externalocp\OCPuniKS=/usr/local/lib/chise/omega/Utf8mcsToUniKS {}
-  \ocplist\uniKS=
-    \addbeforeocplist 1 \OCPuniKS
-    \nullocplist
-  \externalocp\OCPuniMulti=/usr/local/lib/chise/omega/Utf8mcsToUniMulti {}
-  \ocplist\uniMulti=
-    \addbeforeocplist 1 \OCPuniMulti
-    \nullocplist
+  \CHISEsetupOCP{Utf8mcs}
 }
 \DeclareOption{utf8gb}{
-  \externalocp\OCPuniGB=/usr/local/lib/chise/omega/Utf8gbToUniGB {}
-  \ocplist\uniGB=
-    \addbeforeocplist 1 \OCPuniGB
-    \nullocplist
-  \externalocp\OCPuniCNS=/usr/local/lib/chise/omega/Utf8gbToUniCNS {}
-  \ocplist\uniCNS=
-    \addbeforeocplist 1 \OCPuniCNS
-    \nullocplist
-  \externalocp\OCPuniJIS=/usr/local/lib/chise/omega/Utf8gbToUniJIS {}
-  \ocplist\uniJIS=
-    \addbeforeocplist 1 \OCPuniJIS
-    \nullocplist
-  \externalocp\OCPuniKS=/usr/local/lib/chise/omega/Utf8gbToUniKS {}
-  \ocplist\uniKS=
-    \addbeforeocplist 1 \OCPuniKS
-    \nullocplist
-  \externalocp\OCPuniMulti=/usr/local/lib/chise/omega/Utf8mcsToUniMulti {}
-  \ocplist\uniMulti=
-    \addbeforeocplist 1 \OCPuniMulti
-    \nullocplist
+  \CHISEsetupOCP{Utf8gb}
 }
 \DeclareOption{utf8cns}{
-  \externalocp\OCPuniGB=/usr/local/lib/chise/omega/Utf8cnsToUniGB {}
-  \ocplist\uniGB=
-    \addbeforeocplist 1 \OCPuniGB
-    \nullocplist
-  \externalocp\OCPuniCNS=/usr/local/lib/chise/omega/Utf8cnsToUniCNS {}
-  \ocplist\uniCNS=
-    \addbeforeocplist 1 \OCPuniCNS
-    \nullocplist
-  \externalocp\OCPuniJIS=/usr/local/lib/chise/omega/Utf8cnsToUniJIS {}
-  \ocplist\uniJIS=
-    \addbeforeocplist 1 \OCPuniJIS
-    \nullocplist
-  \externalocp\OCPuniKS=/usr/local/lib/chise/omega/Utf8cnsToUniKS {}
-  \ocplist\uniKS=
-    \addbeforeocplist 1 \OCPuniKS
-    \nullocplist
-  \externalocp\OCPuniMulti=/usr/local/lib/chise/omega/Utf8mcsToUniMulti {}
-  \ocplist\uniMulti=
-    \addbeforeocplist 1 \OCPuniMulti
-    \nullocplist
+  \CHISEsetupOCP{Utf8cns}
 }
 \DeclareOption{utf8jis}{
-  \externalocp\OCPuniGB=/usr/local/lib/chise/omega/Utf8jisToUniGB {}
-  \ocplist\uniGB=
-    \addbeforeocplist 1 \OCPuniGB
-    \nullocplist
-  \externalocp\OCPuniCNS=/usr/local/lib/chise/omega/Utf8jisToUniCNS {}
-  \ocplist\uniCNS=
-    \addbeforeocplist 1 \OCPuniCNS
-    \nullocplist
-  \externalocp\OCPuniJIS=/usr/local/lib/chise/omega/Utf8jisToUniJIS {}
-  \ocplist\uniJIS=
-    \addbeforeocplist 1 \OCPuniJIS
-    \nullocplist
-  \externalocp\OCPuniKS=/usr/local/lib/chise/omega/Utf8jisToUniKS {}
-  \ocplist\uniKS=
-    \addbeforeocplist 1 \OCPuniKS
-    \nullocplist
-  \externalocp\OCPuniMulti=/usr/local/lib/chise/omega/Utf8mcsToUniMulti {}
-  \ocplist\uniMulti=
-    \addbeforeocplist 1 \OCPuniMulti
-    \nullocplist
+  \CHISEsetupOCP{Utf8jis}
 }
 \DeclareOption{utf8ks}{
-  \externalocp\OCPuniGB=/usr/local/lib/chise/omega/Utf8ksToUniGB {}
-  \ocplist\uniGB=
-    \addbeforeocplist 1 \OCPuniGB
-    \nullocplist
-  \externalocp\OCPuniCNS=/usr/local/lib/chise/omega/Utf8ksToUniCNS {}
-  \ocplist\uniCNS=
-    \addbeforeocplist 1 \OCPuniCNS
-    \nullocplist
-  \externalocp\OCPuniJIS=/usr/local/lib/chise/omega/Utf8ksToUniJIS {}
-  \ocplist\uniJIS=
-    \addbeforeocplist 1 \OCPuniJIS
-    \nullocplist
-  \externalocp\OCPuniKS=/usr/local/lib/chise/omega/Utf8ksToUniKS {}
-  \ocplist\uniKS=
-    \addbeforeocplist 1 \OCPuniKS
-    \nullocplist
-  \externalocp\OCPuniMulti=/usr/local/lib/chise/omega/Utf8mcsToUniMulti {}
-  \ocplist\uniMulti=
-    \addbeforeocplist 1 \OCPuniMulti
-    \nullocplist
+  \CHISEsetupOCP{Utf8ks}
+}
+\DeclareOption{utf8big5}{
+  \CHISEsetupOCP{Utf8big5}
 }
 
 \DeclareOption{gbfont}{
 
 \DeclareOption{kage}{
   % to use KAGE server
-  \externalocp\OCPmkfont=/usr/local/lib/chise/omega/makefonts.pl {}
+  \externalocp\OCPmkfont=/usr/local/share/texmf/omega/ocp/local/chise/makefonts.pl {}
   \ocplist\mkfontOCP=
   \addbeforeocplist 1 \OCPmkfont
   \nullocplist
 
 \ocp\OCPutf=inutf8fix
 \ocplist\inutf
+\addbeforeocplist 1 \OCPutf
+\nullocplist
+
+\ocp\OCPTeX=omtex
+\ocp\OCPGrUniToFont=uni2greekfix
+\ocp\OCPCyrUniToFont=uni2latfix
+\ocp\OCPLatinUniToFont=uni2latfix
+\ocplist\GreekOCP
+  \addbeforeocplist 1 \OCPutf
+  \addbeforeocplist 1 \OCPTeX
+  \addbeforeocplist 1 \OCPGrUniToFont
+  \nullocplist
+\ocplist\CyrillicOCP
+  \addbeforeocplist 1 \OCPutf
+  \addbeforeocplist 1 \OCPTeX
+  \addbeforeocplist 1 \OCPCyrUniToFont
+  \nullocplist
+\ocplist\LatinOCP
   \addbeforeocplist 1 \OCPutf
+  \addbeforeocplist 1 \OCPTeX
+  \addbeforeocplist 1 \OCPLatinUniToFont
   \nullocplist
+
 \AtBeginDocument{
-  \pushocplist\inutf
+  \LatinScript
 }
 
+\def\rmdefault{omlgc}
+\def\ttdefault{uctt}
+
 % Settings for CJK
+
+\def\CHISEsetupOCP#1{
+  \externalocp\OCPuniGBrmSP=/usr/local/share/texmf/omega/ocp/local/chise/#1ToUniGB {}
+  \ocplist\uniGBrmSP=
+    \addbeforeocplist 1 \OCPuniGBrmSP
+    \nullocplist
+  \externalocp\OCPuniCNSrmSP=/usr/local/share/texmf/omega/ocp/local/chise/#1ToUniCNS {}
+  \ocplist\uniCNSrmSP=
+    \addbeforeocplist 1 \OCPuniCNSrmSP
+    \nullocplist
+  \externalocp\OCPuniJISrmSP=/usr/local/share/texmf/omega/ocp/local/chise/#1ToUniJIS {}
+  \ocplist\uniJISrmSP=
+    \addbeforeocplist 1 \OCPuniJISrmSP
+    \nullocplist
+  \externalocp\OCPuniKSrmSP=/usr/local/share/texmf/omega/ocp/local/chise/#1ToUniKS {}
+  \ocplist\uniKSrmSP=
+    \addbeforeocplist 1 \OCPuniKSrmSP
+    \nullocplist
+  \externalocp\OCPuniMultirmSP=/usr/local/share/texmf/omega/ocp/local/chise/#1ToUniMulti {}
+  \ocplist\uniMultirmSP=
+    \addbeforeocplist 1 \OCPuniMultirmSP
+    \nullocplist
+  \externalocp\OCPuniGBwithSP=/usr/local/share/texmf/omega/ocp/local/chise/#1ToUniGBSp {}
+  \ocplist\uniGBwithSP=
+    \addbeforeocplist 1 \OCPuniGBwithSP
+    \nullocplist
+  \externalocp\OCPuniCNSwithSP=/usr/local/share/texmf/omega/ocp/local/chise/#1ToUniCNSSp {}
+  \ocplist\uniCNSwithSP=
+    \addbeforeocplist 1 \OCPuniCNSwithSP
+    \nullocplist
+  \externalocp\OCPuniJISwithSP=/usr/local/share/texmf/omega/ocp/local/chise/#1ToUniJISSp {}
+  \ocplist\uniJISwithSP=
+    \addbeforeocplist 1 \OCPuniJISwithSP
+    \nullocplist
+  \externalocp\OCPuniKSwithSP=/usr/local/share/texmf/omega/ocp/local/chise/#1ToUniKSSp {}
+  \ocplist\uniKSwithSP=
+    \addbeforeocplist 1 \OCPuniKSwithSP
+    \nullocplist
+  \externalocp\OCPuniMultiwithSP=/usr/local/share/texmf/omega/ocp/local/chise/#1ToUniMultiSp {}
+  \ocplist\uniMultiwithSP=
+    \addbeforeocplist 1 \OCPuniMultiwithSP
+    \nullocplist
+  \let\uniGB=\uniGBrmSP
+  \let\uniCNS=\uniCNSrmSP
+  \let\uniJIS=\uniJISrmSP
+  \let\uniKS=\uniKSrmSP
+  \let\uniMulti=\uniMultirmSP
+}
+
 \def\selectjisfont{\fontencoding{OT1}\fontfamily{omjis}\selectfont}
 \def\selectgbsfont{\fontencoding{OT1}\fontfamily{omgbs}\selectfont}
 \def\selectcnsfont{\fontencoding{OT1}\fontfamily{omcns}\selectfont}
 \def\selectksxfont{\fontencoding{OT1}\fontfamily{omksx}\selectfont}
+\def\selectlgcfont{\fontencoding{OT1}\fontfamily{omlgc}\selectfont}
 
-\newenvironment{JISfont}{\pushocplist\uniJIS\selectjisfont}{}
-\newenvironment{GBfont}{\pushocplist\uniGB\selectgbsfont}{}
-\newenvironment{KSfont}{\pushocplist\uniKS\selectksxfont}{}
-\newenvironment{CNSfont}{\pushocplist\uniCNS\selectcnsfont}{}
+\newenvironment{JISfont}{\pushocplist\uniJIS}{}
+\newenvironment{GBfont}{\pushocplist\uniGB}{}
+\newenvironment{KSfont}{\pushocplist\uniKS}{}
+\newenvironment{CNSfont}{\pushocplist\uniCNS}{}
 \newenvironment{Multifont}{\pushocplist\uniMulti}{}
-\newenvironment{ASCII}{\pushocplist\NilOCP\fontencoding{T1}\fontfamily{\rmdefault}\selectfont}{}
+\newenvironment{NonCJK}{\pushocplist\inutf\selectlgcfont}{}
+\newenvironment{ASCII}{\clearocplists\fontencoding{T1}\selectnormalfont}{}
+
+\newenvironment{GreekScript}{\pushocplist\GreekOCP\selectlgcfont%
+\language=3\lefthyphenmin=2\righthyphenmin=2}{%
+}
+\newenvironment{CyrillicScript}{\pushocplist\CyrillicOCP\selectlgcfont}{}
+\newenvironment{LatinScript}{\pushocplist\LatinOCP\selectlgcfont}{}
 
 \newcommand{\jisfont}[1]{\begingroup%
-  \pushocplist\uniJIS\selectjisfont #1\endgroup}
+  \pushocplist\uniJIS #1\endgroup}
 \newcommand{\gbfont}[1]{\begingroup%
-  \pushocplist\uniGB\selectgbsfont #1\endgroup}
+  \pushocplist\uniGB #1\endgroup}
 \newcommand{\ksfont}[1]{\begingroup%
-  \pushocplist\uniKS\selectksxfont #1\endgroup}
+  \pushocplist\uniKS #1\endgroup}
 \newcommand{\cnsfont}[1]{\begingroup%
-  \pushocplist\uniCNS\selectcnsfont #1\endgroup}
+  \pushocplist\uniCNS #1\endgroup}
 \newcommand{\multifont}[1]{\begingroup%
   \pushocplist\uniMulti #1\endgroup}
 \newcommand{\noncjk}[1]{\begingroup%
-  \normalfont\pushocplist\inutf #1\endgroup}
+  \pushocplist\inutf\selectlgcfont #1\endgroup}
+%  \normalfont\pushocplist\inutf #1\endgroup}
 \newcommand{\ascii}[1]{\begingroup%
-  \pushocplist\NilOCP\fontencoding{T1}\fontfamily{\rmdefault}\selectfont #1\endgroup}
+  \clearocplists\selectlgcfont #1\endgroup}
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 % Entity Reference
 % ----------------
 
 % line break definition ends.
 
+%%%% redundant font definition to avoid bug of omega.
+
+\DeclareFontFamily{OT1}{omlgc}{}
+
+\DeclareFontShape{OT1}{omlgc}{m}{n}{
+   <->omlgc
+}{}
+\DeclareFontShape{OT1}{omlgc}{m}{sc}{
+   <-> ssub * omlgc/m/n
+}{}
+\DeclareFontShape{OT1}{omlgc}{m}{it}{
+   <->omlgci
+}{}
+\DeclareFontShape{OT1}{omlgc}{m}{sl}{
+   <-> ssub * omlgc/m/it
+}{}
+\DeclareFontShape{OT1}{omlgc}{m}{itsc}{
+   <-> ssub * omlgc/m/it
+}{}
+\DeclareFontShape{OT1}{omlgc}{m}{slsc}{
+   <-> ssub * omlgc/m/it
+}{}
+\DeclareFontShape{OT1}{omlgc}{bx}{n}{
+   <->omlgcb
+}{}
+\DeclareFontShape{OT1}{omlgc}{bx}{sc}{
+   <-> ssub * omlgc/bx/n
+}{}
+\DeclareFontShape{OT1}{omlgc}{bx}{it}{
+   <->omlgcbi
+}{}
+\DeclareFontShape{OT1}{omlgc}{bx}{itsc}{
+   <-> ssub * omlgc/bx/it
+}{}
+\DeclareFontShape{OT1}{omlgc}{bx}{sl}{
+   <-> ssub * omlgc/bx/it
+}{}
+\DeclareFontShape{OT1}{omlgc}{bx}{slsc}{
+   <-> ssub * omlgc/bx/it
+}{}
+
+% The declaration below should be in ot1enc.def.
+\DeclareTextSymbol{\textbullet}{OT1}{"2022}
+
 \ProcessOptions
 \endinput