%%
%% This is file `hieroglf.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% hieroglf.dtx  (with options: `usc')
%% ------------------------------------------------------------------
%%   Author: Peter Wilson (Herries Press) herries dot press at earthlink dot net
%%   Copyright 2000--2015 Peter R. Wilson
%% 
%%   This work may be distributed and/or modified under the
%%   conditions of the Latex Project Public License, either
%%   version 1.3 of this license or (at your option) any
%%   later version.
%%   The latest version of the license is in
%%     http://www.latex-project.org/lppl.txt
%%   and version 1.3 or later is part of all distributions of
%%   LaTeX version 2003/06/01 or later.
%% 
%%   This work has the LPPL maintenance status "author-maintained".
%% 
%%   This work consists of the files listed in the README file.
%% ------------------------------------------------------------------
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{hieroglf}[2015/06/02 v1.4 package for poor mans hieroglyphs]
\RequirePackage{oands}

\providecommand{\Tienc}{T1}
\ifx\Tienc\encodingdefault
  \newcommand{\pmhgfamily}{\usefont{T1}{pmhg}{m}{n}}
\else
  \newcommand{\pmhgfamily}{\usefont{OT1}{pmhg}{m}{n}}
\fi

\DeclareTextFontCommand{\textpmhg}{\pmhgfamily}

\chardef\HAi='007      % A1
\chardef\HAii=`I       % A2
\chardef\HAxxviii=`Y   % A28
\chardef\HCxi=`7       % C11
\chardef\HDi=`Q        % D1
\chardef\HDii=`q       % D2
\chardef\HDiv=`e       % D4
\chardef\HDxxi=`r      % D21
\chardef\HDxxxvi=`A    % D36
\chardef\HDxlvi=`d     % D46
\chardef\HDxlvii=`P    % D47
\chardef\HDl=`5        % D50
\chardef\HDliv=`L      % D54
\chardef\HDlviii=`b    % D58
\chardef\HExxiii=`l    % E23
\chardef\HFi=`X        % F1
\chardef\HFxx='010     % F20
\chardef\HFxxxi='001   % F36
\chardef\HFxxxiv=`G    % F34
\chardef\HFxl=`Z       % F40
\chardef\HGi=`a        % G1
\chardef\HGxvii=`m     % G17
\chardef\HGxxvi='002   % G26
\chardef\HGxxvis='003  % G26*
\chardef\HGxxvii='004  % G27
\chardef\HGxxviii='005 % G28
\chardef\HGxxxvi=`R    % G36
\chardef\HGxliii=`w    % G43
\chardef\HHviii=`O    % H8
\chardef\HIviii=`6     % I8
\chardef\HIix=`f       % I9
\chardef\HIx=`D        % I10
\chardef\HKi=`F        % K1
\chardef\HMiii=`N      % M3
\chardef\HMviii=`E     % M8
\chardef\HMxii=`4      % M12
\chardef\HMxvii=`i     % M17
\chardef\HNxxix=`K     % N29
\chardef\HNxxxv=`n     % N35
\chardef\HNxxxvii=`z   % N37
\chardef\HOi=`j        % O1
\chardef\HOiv=`h       % O4
\chardef\HOxxxiv=`S    % O34
\chardef\HQiii=`p      % Q3
\chardef\HRvii=`B      % R7
\chardef\HSxii=`v      % S12
\chardef\HSxxix=`s     % S29
\chardef\HSxxxix=`?    % S39
\chardef\HSxli=`c      % S41
\chardef\HTiii=`u      % T3
\chardef\HTxiv=`/      % T14
\chardef\HUxxxvi=`J    % U36
\chardef\HVi=`3        % V1
\chardef\HViv=`o       % V4
\chardef\HVxiii=`T     % V13
\chardef\HVxx=`2       % V20
\chardef\HVxxiv=`U     % V24
\chardef\HVxxviii=`H   % V28
\chardef\HVxxxi=`k     % V31
\chardef\HWxi=`g       % W11
\chardef\HXi=`t        % X1
\chardef\HYiV=`V       % Y1v
\chardef\HYiv='011     % Y4
\chardef\HZi=`|        % Z1
\chardef\HZii='012     % Z2
\chardef\HZiv='013     % Z4
\chardef\HZvi='006     % Z6
\chardef\HZvii=`W      % Z7
\chardef\HZxi=`+       % Z11
\chardef\HAai=`C       % Aa1
\chardef\HAaxii=`M     % Aa12
\chardef\HPWi=`x       % PW1
\chardef\HPWii=`y      % PW2

\chardef\HA=`A
\chardef\HB=`B
\chardef\HC=`C
\chardef\HD=`D
\chardef\HE=`E
\chardef\HF=`F
\chardef\HG=`G
\chardef\HH=`H
\chardef\HI=`I
\chardef\HJ=`J
\chardef\HK=`K
\chardef\HL=`L
\chardef\HM=`M
\chardef\HN=`N
\chardef\HO=`O
\chardef\HP=`P
\chardef\HQ=`Q
\chardef\HR=`R
\chardef\HS=`S
\chardef\HT=`T
\chardef\HU=`U
\chardef\HV=`V
\chardef\HW=`W
\chardef\HX=`X
\chardef\HY=`Y
\chardef\HZ=`Z
\chardef\Ha=`a
\chardef\Hb=`b
\chardef\Hc=`c
\chardef\Hd=`d
\chardef\He=`e
\chardef\Hf=`f
\chardef\Hg=`g
\chardef\Hh=`h
\chardef\Hi=`i
\chardef\Hj=`j
\chardef\Hk=`k
\chardef\Hl=`l
\chardef\Hm=`m
\chardef\Hn=`n
\chardef\Hp=`p
\chardef\Ho=`o
\chardef\Hp=`p
\chardef\Hq=`q
\chardef\Hr=`r
\chardef\Hs=`s
\chardef\Ht=`t
\chardef\Hu=`u
\chardef\Hv=`v
\chardef\Hw=`w
\chardef\Hx=`x
\chardef\Hy=`y
\chardef\Hz=`z
\chardef\Hplus=`+
\chardef\Hquery=`?
\chardef\Hvbar=`|
\chardef\Hslash=`/
\chardef\Hms='001
\chardef\Hibp='002
\chardef\Hibw='003
\chardef\Hibs='004
\chardef\Hibl='005
\chardef\Hsv='006
\chardef\Hman='007
\chardef\Htongue='010
\chardef\Hscribe='011
\chardef\Hplural='012
\chardef\Hdual='013
\chardef\Hone=`|
\chardef\Hten=`2
\chardef\Hhundred=`3
\chardef\Hthousand=`4
\chardef\HXthousand=`5
\chardef\HCthousand=`6
\chardef\Hmillion=`7

\DeclareTextCommand{\uunder}{OT1}[1]%
  {{\o@lign{\relax#1\crcr\hidewidth\sh@ft{29}%
    \vbox to.2ex{\hbox{\char21}\vss}\hidewidth}}}
\DeclareTextCommand{\uunder}{T1}[1]%
  {{\o@lign{\relax#1\crcr\hidewidth\sh@ft{29}%
    \vbox to.2ex{\hbox{\char8}\vss}\hidewidth}}}

\DeclareTextCommand{\cedover}{OT1}[1]%
  {#1\ifdim\fontdimen\@ne\font>\z@%
     \kern-.18em
   \else
     \kern-.4em
   \fi
   \raisebox{1.75ex}{\char24}}
\DeclareTextCommand{\cedover}{T1}[1]%
  {#1\ifdim\fontdimen\@ne\font>\z@%
     \kern-.18em
   \else
     \kern-.4em
   \fi
   \raisebox{1.75ex}{\char11}}

\newcommand{\Hic}{\cedover{\i}\ensuremath{\!}}
\newcommand{\Hrp}{\,\textoands{`}}
\newcommand{\Hag}{\textoands{z}}

\newcommand{\translitpmhgfont}{\itshape}

\newcommand{\translitpmhg}[1]{{%
  \c@rttranslit\translitpmhgfont #1}}

\newcommand{\c@rttranslit}{%
\def\HA{\Hrp}%
\def\HB{b}%
\def\HC{\uunder{h}}%
\def\HD{\b{d}}%
\def\HE{\v{s}\Hag}%
\def\HF{}%
\def\HG{\Hic b}%
\def\HH{\d{h}}%
\def\HI{}%
\def\HJ{\d{h}m}%
\def\HK{\d{k}}%
\def\HL{\Hic w}%
\def\HM{m}%
\def\HN{\uunder{h}t}%
\def\HO{\Hag st}%
\def\HP{}%
\def\HQ{tp}%
\def\HR{wr}%
\def\HS{s}%
\def\HT{\b{t}}%
\def\HU{w\b{d}}%
\def\HV{}%
\def\HW{w}%
\def\HX{\b{h}}%
\def\HY{}%
\def\HZ{\textoands{z}w}%
\def\Ha{\Hag}%
\def\Hb{b}%
\def\Hc{\b{d}\Hrp m}%
\def\Hd{d}%
\def\He{\Hic r}%
\def\Hf{f}%
\def\Hg{g}%
\def\Hh{h}%
\def\Hi{\Hic}%
\def\Hj{pr}%
\def\Hk{k}%
\def\Hl{l}%
\def\Hm{m}%
\def\Hn{n}%
\def\Ho{w\Hag}%
\def\Hp{p}%
\def\Hq{\d{h}r}%
\def\Hr{r}%
\def\Hs{s}%
\def\Ht{t}%
\def\Hu{\d{h}\b{d}}%
\def\Hv{nbw}%
\def\Hw{w}%
\def\Hx{}%
\def\Hy{y}%
\def\Hz{\v{s}}%
\def\Hplus{\Hic my}%
\def\Hquery{awt}%
\def\Hslash{\d{k}m\Hag}%
\def\Hvbar{w\Hrp}%
\def\Hms{ms}%
\def\Hibp{\b{d}\d{h}wty}%
\def\Hibw{b\Hag}%
\def\Hibs{}%
\def\Hibl{gm}%
\def\Hsv{}%
\def\Hman{}%
\def\Htongue{ns}%
\def\Hscribe{s\b{h}}%
\def\Hplural{}%
\def\Hdual{}%
\def\Hone{w\Hrp}%
\def\Hten{m\b{d}w}%
\def\Hhundred{\v{s}t}%
\def\Hthousand{\uunder{h}\Hag}%
\def\HXthousand{\b{d}b\Hag}%
\def\HCthousand{\d{h}fnw}%
\def\Hmillion{\d{h}\d{h}}%
}

%%%%%%%%%%%%%%%% file EgypUtil.sty from the hieroglyph package %%%%%%%


\def\echange#1#2#3{%
\def\echangeaux##1##2{\ifx##2\end\def\next{##1}%
\else\ifx##2#1\relax\def\next{\echangeaux{##1#2}}\else\def\next{\echangeaux{##1##2}}\fi\fi%
\next}%
\echangeaux#3\relax\end}

%%%%%%%%%%%%%%%% end of file EgypUtil.sty %%%%%%%%%%%%%%%%%%%%%%%%%%%%

\def\c@rttg#1\relax{%
\hskip 0.1pt\textpmhg{#1}\hskip 0.1pt}

\newlength{\c@rthm}
\newcommand{\setc@rthm}{%
  \settoheight{\c@rthm}{\textpmhg{\HY\HH}}%
  \addtolength{\c@rthm}{1.2pt}%
}

\newcommand{\c@rtline}[1]{\echange{-}{\relax\c@rtqA}{\c@rttg{#1}}}

\def\c@rtoN#1\relax{\hbox{\c@rtline{#1}}}
\def\c@rton#1\relax{\vskip 0.1mm plus 1fil\hbox to \dimen0{\hskip 0em
  plus 0.25fil\c@rtline{#1}\hskip 0em plus 0.25fil}}

\def\c@rtqA#1\relax{\hfil{\setbox0=\vbox{%
\echange{:}{\relax\c@rtoN}{\relax:#1\relax}%
}\hbox{\box0}}}

\def\c@rtq#1\relax{{\setbox0=\vbox{\offinterlineskip%
\echange{:}{\relax\c@rtoN}{\relax:#1\relax}}\dimen0=\wd0%
\ifdim\ht0>\c@rthm%
  \c@rtqS#1\relax%
\else%
  \setbox0=\vbox to \c@rthm{\offinterlineskip%
  \echange{:}{\relax\vfil\c@rton}{\relax\c@rton#1\relax}}%
  \hbox{\box0}%
\fi%
}}

\def\c@rtvq#1\relax{%
  {\setbox0=\vbox{\offinterlineskip%
   \echange{:}{\relax\c@rtoN}{\relax:#1\relax}}\dimen0=\wd0%
   \setbox0=\vbox{%
     \lineskiplimit=100pt\lineskip=0.25ex%       vertical spacing
     \echange{:}{\relax\vfil\c@rton}{\relax\c@rton#1\relax}}%
   \hbox{\box0}%
}}

\def\c@rtqS#1\relax{{\c@rtsmaller\setbox0=\vbox{\offinterlineskip%
  \echange{:}{\relax\c@rtoN}{\relax:#1\relax}}\dimen0=\wd0%
  \ifdim\ht0>\c@rthm%
    \ifx\@currsize\tiny%
      \c@rtTS#1\relax%
    \else%
      \c@rtqS#1\relax%
    \fi%
  \else%
    \c@rtTS#1\relax%
  \fi%
}}

\def\c@rtTS#1\relax{%
  \setbox0=\vbox to \c@rthm{\offinterlineskip%
  \echange{:}{\relax\vfil\c@rton}{\relax\c@rton#1\relax}}%
  \hbox{\box0}%
}

\def\pmglyph#1{{%
  \setc@rthm%
  \dimen0=\c@rthm%
  \advance\dimen0 by 2mm%
  \setbox0=\hbox{%
  \echange{-}{\relax\c@rtq}{\relax-#1}}%
  \sloppy\unhbox0%
}}

\def\pmvglyph#1{{%
  \setc@rthm%
  \dimen0=\c@rthm%
  \advance\dimen0 by 2mm%
  \setbox0=\hbox{%
  \echange{-}{\relax\c@rtvq}{\relax-#1}}%
  \sloppy\unhbox0%
}}

\DeclareRobustCommand\c@rtrelsize[1]{%
\ifmmode \@nomath\c@rtrelsize\else
  \@tempcnta
    \ifx\@currsize\normalsize 4\else
      \ifx\@currsize\small 3\else
        \ifx\@currsize\footnotesize 2\else
          \ifx\@currsize\large 5\else
            \ifx\@currsize\Large 6\else
              \ifx\@currsize\LARGE 7\else
                \ifx\@currsize\scriptsize 1\else
                  \ifx\@currsize\tiny 0\else
                    \ifx\@currsize\huge 8\else
                      \ifx\@currsize\Huge 9\else
                        4 % unknown state, start at normalsize
\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
\advance\@tempcnta#1\relax
\ifnum\@tempcnta<\z@ \@tempcnta\z@ \fi
\ifcase\@tempcnta
  \tiny \or \scriptsize \or \footnotesize \or \small \or \normalsize \or
  \large \or \Large \or \LARGE \or \huge \else \Huge
\fi\fi}

\DeclareRobustCommand\c@rtsmaller{\c@rtrelsize{-1}}

\newbox\c@rtbox
\@ifundefined{@tempdimc}{\newdimen\@tempdimc}{}
\newdimen\c@rtht
\newcommand{\cartouchecorner}{\@ifstar{\sc@rtcorner}{\c@rtcorner}}
\newcommand{\sc@rtcorner}[1]{%
  \@tempdima=#1\relax
  \edef\thec@rtcorner{\number\@tempdima sp}}
\newcommand{\c@rtcorner}[1]{%
  \edef\thec@rtcorner{#1\noexpand\@tempdimb}}
\cartouchecorner{.75}

\def\c@rtoval(#1,#2){%
  \begingroup
    \c@rt@oval{#1\unitlength}{#2\unitlength}%
    \@put{-.5\wd\@tempboxa}{-.5\ht\@tempboxa}{\ht\@tempboxa=\z@\box\@tempboxa}%
  \endgroup}

\newcommand{\c@rt@oval}[2]{%
  \boxmaxdepth \maxdimen
  \@ovttrue \@ovbtrue \@ovltrue \@ovrtrue
  \@ovxx#1\relax
  \advance\@ovxx-\@wholewidth
  \@ovyy#2\relax
  \advance\@ovyy-\@wholewidth
  \@tempdimb \ifdim \@ovyy >\@ovxx \@ovxx\else \@ovyy \fi
  \advance\@tempdimb-2\p@
  \ifdim\@tempdimb>\thec@rtcorner\relax
    \@tempdimb=\thec@rtcorner
  \fi
  \@getcirc\@tempdimb
  \@ovro\ht\@tempboxa \@ovri\dp\@tempboxa
  \@ovdx\@ovxx \advance\@ovdx-\@tempdima \divide\@ovdx \tw@
  \@ovdy\@ovyy \advance\@ovdy-\@tempdima \divide\@ovdy \tw@
  \@circlefnt
  \setbox\@tempboxa\hbox{%
    \@ovvert32\kern -\@tempdima
    \kern \@ovxx \@ovvert01\kern -\@tempdima \kern -\@ovxx
    \@ovhorz \kern -\@ovxx
    \raise \@ovyy \@ovhorz}%
  \advance\@ovdx\@ovro
  \advance\@ovdy\@ovro
  \advance\@ovxx\@wholewidth
  \wd\@tempboxa=\@ovxx
  \dp\@tempboxa=\z@}

\newcommand{\cartouche}{\c@rtouche\thinlines}
\newcommand{\Cartouche}{\c@rtouche\thicklines}

\newcommand{\vertouche}{\c@rtouchev\thinlines}
\newcommand{\Vertouche}{\c@rtouchev\thicklines}

\newcommand{\c@rtouche}[2]{
  \begingroup
    #1\relax
    \c@rtsetoval{#2}
    \leavevmode\hbox{%
      \lower\@tempdima\box\@tempboxa
      \kern\@tempdimc\box\c@rtbox\kern\@tempdimc}%
    \rule[-\@tempdima]{\@wholewidth}{\c@rtht}% % thick/thin line at end
  \endgroup}

\newcommand{\c@rtsetoval}[1]{%
  \setbox\c@rtbox\hbox{{#1}}%
  \@tempdimc\fboxsep \advance\@tempdimc\@wholewidth
  \@tempdima\ht\c@rtbox \advance\@tempdima\dp\c@rtbox
  \advance\@tempdima2\@tempdimc
  \@tempdimb\wd\c@rtbox \advance\@tempdimb2\@tempdimc
  \c@rt@oval\@tempdimb\@tempdima%
  \@tempdima\dp\c@rtbox \advance\@tempdima\@tempdimc
  \c@rtht\ht\c@rtbox \advance\c@rtht\@tempdima \advance\c@rtht\@tempdimc
  \wd\@tempboxa=\z@
}

\newcommand{\c@rtouchev}[2]{
  \begingroup
    #1\relax
    \c@rtsetoval{#2}
    \leavevmode\hbox{%
      \lower\@tempdima\box\@tempboxa
      \kern\@tempdimc\box\c@rtbox\kern\@tempdimc}%
      \advance\@tempdimb-\@tempdimc
      \kern-2\@tempdimb\rule[-\@tempdima]{2\@tempdimb}{\@wholewidth}%
  \endgroup}

\endinput
%%
%% End of file `hieroglf.sty'.
