\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{coptic}[2010/01/09 v.0.2 Claudio Beccari]
%Thanks to Elie Roux, any reference to non ASCII characters is eliminated

\edef\LatinEnc{\f@encoding}

\newcommand*\setcopto{\usefont{LCOP}{coptic}{m}{\f@shape}%
 \@ifundefined{l@coptic}{%
 \PackageWarning{coptic}{Coptic hyphenation undefined;\MessageBreak 
 Using no hyphenation \MessageBreak}%
 \let\l@coptic\l@nohyphenation}{}
 \language=\l@coptic \lefthyphenmin\@ne \righthyphenmin\@ne
 \catcode`\#=12 
 \catcode`\$=12
 \lccode`\#=`\# % exi
 \lccode`\$=`\# % exi
 \lccode`>=`> % `m
 \lccode`?=`? % `n
 \lccode`8=`8 % thida
 \lccode`(=`8 % thida 
 \lccode`)=`) % epsi
 \lccode`*=`) % epsi
 \lccode`+=`+ % phi
 \lccode`,=`+ % phi
 \lccode`/=`/ % hori
 \lccode`0=`/ % hori
 \lccode`1=`1 % ligature1
 \lccode`2=`2 % ligature2
 \lccode`3=`3 % ti
 \lccode`4=`3 % ti
 \lccode`9=`9 % i-trema
 \lccode`v=`v % ue-trema
 \lccode`;=`; % giangia
 \lccode`<=`; % giangia
 \nobreak\hskip\z@skip
 }


\IfFileExists{lcopcoptic.fd}{%
   \input{lcopcoptic.fd}%
   \DeclareTextFontCommand{\textcoptic}{\setcopto}%
   \newenvironment{coptic}{\setcopto\ignorespaces}{\ignorespaces}%
}{%
   \PackageWarning{coptic}{Missing font definition file `lcopcoptic.fd'\MessageBreak
   \string\textcoptic\space redefined to do nothing\MessageBreak
   Environment `coptic' redefined to do nothing\MessageBreak}
   \DeclareTextFontCommand{\textcoptic}{}%
   \newenvironment{coptic}{\relax}{\ignorespaces}%
}
\let\textcopto\textcoptic \let\textcopte\textcoptic
\let\copto\coptic \let\copte\coptic
\let\endcopto\endcoptic \let\endcopte\endcoptic

\providecommand\textlatin[1]{{\fontencoding{\LatinEnc}\fontfamily{cmr}\selectfont#1}}
\RequirePackage{textcomp}
%
\DeclareTextSymbol{\H}{LCOP}{48}
\DeclareTextSymbol{\h}{LCOP}{47}
\DeclareTextCommand{\=}{LCOP}[1]{\Overline{#1}}
\DeclareTextCommand{\Ov}{LCOP}[1]{\={#1}}
\DeclareTextAccent{\"}{LCOP}{21}
\DeclareTextAccent{\'}{LCOP}{96}
\DeclareTextComposite{\'}{LCOP}{m}{62}
\DeclareTextComposite{\'}{LCOP}{n}{63}
\DeclareTextComposite{\"}{LCOP}{i}{57}
\DeclareTextComposite{\"}{LCOP}{u}{118}
\DeclareTextCommand{\^^b0}{LCOP}{\discretionary{:}{}{:}\nobreak\hskip\z@skip}% : = \char58
\let\0\^^b0 % alias name for keyboards missing the "degree" key
\DeclareTextCommand{\+}{LCOP}{\nobreak\hskip\z@\char61\nobreak\hskip\z@}% "=" in Latin
\DeclareTextSymbol{\trepun}{LCOP}{33} % left pointing dot triangle
\DeclareTextSymbol{\trepund}{LCOP}{34}% right pointing dot triangle
\let\threedots\trepun
\newcommand*\sic[1]{\shortstack{\hbox to\z@{\hss\usefont{T1}{cmr}{bx}{it}\tiny sic\kern.2em\hss}\\{#1}}}

   
\newcommand*{\pont}[1]%
   {{\leavevmode\def\arraystretch{0}\tabular[t]{@{}c@{}}\textcoptic{\rule[-.85ex]{0pt}{.85ex}#1}\\\smash{\puntonero2}\endtabular}}



\renewcommand*\overbrace[1]{\mathop{\vbox{\m@th\ialign{##\crcr\noalign{\kern.3\p@}%
      \downbracefill\crcr\noalign{\kern1\p@\nointerlineskip}%
      $\hfil\displaystyle{\,#1\,}\hfil$\crcr}}}\limits}

\newcommand*\puntonero[1]{{\unitlength\p@\picture(0,1)\put(0,.5){\circle*{#1}}\endpicture}}

{%
   \catcode`p=12\catcode`t=12\gdef\numero#1pt{#1}%
}

\newcommand*\Overline[1]{\nobreak\hskip\z@\vbox{%
      \edef\slant@{\expandafter\numero\the\fontdimen1\font}%
      \@tempdima=1.2ex
      \ialign{##\crcr
      \noalign{\kern.3\p@}%
      \kern\slant@\@tempdima% font slant is accounted for
      \kern.5\p@\puntonero1\leaders\hrule\@height1\p@\hfill\puntonero1\kern-\slant@\@tempdima
            \kern1.25\p@\kern.045em\cr
      \noalign{\kern\p@\nointerlineskip}%
      \hfil#1\vrule \@height\@tempdima \@width\z@ \@depth\z@\hfil\cr}}\ifsp@ce}

\newcommand*\Bar[1]{%
      \nobreak\hskip\z@
      \vbox{%
      \edef\slant@{\expandafter\numero\the\fontdimen1\font}%
      \@tempdima=1.4ex
      \ialign{##\crcr
      \noalign{\kern.3\p@}%
      \kern\slant@\@tempdima% font slant is accounted for
      \leaders\hrule\@height.5\p@\hfill\kern-\slant@\@tempdima\kern.055em\cr
      \noalign{\kern\p@\nointerlineskip}%
      \hfil#1\vrule \@height\@tempdima \@width\z@ \@depth\z@\hfil\cr}%
            }%
      }

\newcommand*\ifsp@ce{\futurelet\sp@zi@\sp@zio}
\newcommand*\sp@zio{\ifx\sp@zi@\@sptoken\space\else
            \ifx m\sp@zi@\discretionary{-}{}{}\fi\nobreak\hskip\z@\fi}


\newcommand*{\dubbio}[1]{{\ensuremath{\overbrace{\mbox{#1}}^{\scriptscriptstyle?}}}}
\let\dubious\dubbio

\newcommand*{\barretta}[1]{\leavevmode{\def\arraystretch{.18}%
      \tabular[t]{@{}c@{}}#1\\\rule{\p@}{.5ex}\endtabular}}

\newcommand*{\asterisco}{{\usefont{TS1}{cmr}{bx}{n}\Large\textasteriskcentered}}
\let\Asterisk\asterisco

\newcommand*{\Crux}{{\usefont{LCOP}{coptic}{m}{n}\char53}} % "5" 

\DeclareRobustCommand{\horiakh}{\textcoptic{2}}  %{LCOP}{50} % "2" 

\newcommand*{\crocetta}{{\usefont{LCOP}{coptic}{m}{n}\char86}}
\let\crucicula\crocetta

\DeclareTextCommand{\iesus}{LCOP}{\Ov{\hbox{ic}}}

\DeclareTextCommand{\xcr}{LCOP}{\Ov{\hbox{xcr}}}

\DeclareTextCommand{\djois}{LCOP}{\Ov{\hbox{djc}}}

\DeclareTextCommand{\xc}{LCOP}{\Ov{\hbox{xc}}}

\endinput
