summaryrefslogtreecommitdiff
path: root/language/aramaic/serto/syriac.sty
blob: 271fa781dfedf18ced679f48ee8e6fe5aeb86a5b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% syriac.sty
%% DO NOT LOAD DIRECTLY. USED BY serto.sty and assyr.sty
%% For the use of serto fonts within LaTeX
%% Last modified 8th November 2003
%% Johannes Heinecke, Lannion

% Taken from exaccent.sty (Tipa package)
% usage \loweraccent[distance]{accent}{letter}
\newcommand\lowersyriac{\@ifnextchar[{\lower@syriac a\empty}%
  {\lower@syriac a\empty[\z@]}}
\newcommand\uppersyriac{\@ifnextchar[{\upper@syriac a\empty}%
  {\upper@syriac a\empty[\z@]}}

\def\upper@syriac#1#2[#3]#4#5{{\leavevmode
  \setbox\z@\hbox{#5}\setbox\@ne\hbox{#2%
    \if a#1\char#4\else#4\fi}%
  \ifx\empty#5\empty\box\@ne\else
  \@getaccshift \let\c@lcshift\@pshift
  \dimen\z@\ht\@ne
  \ifdim\ht\@ne>1ex \advance\dimen\z@ -1ex \else
  \ifdim\ht\@ne=\z@ \dimen\z@\dp\@ne \fi\fi
  \vbox{\hsize\wd\z@\offinterlineskip
    %\hb@xt@\z@{\@accshift{#3}\hb@xt@\wd\z@{%
    \hb@xt@\z@{\@accshift{.5ex}\hb@xt@\wd\z@{%
     \hss\vbox to \dimen\z@{\hbox{\box\@ne}\vss}\hss}\hss}
    %\kern#3
    \kern.5ex
    \hbox{#5}}\fi}}

\def\lower@syriac#1#2[#3]#4#5{{\leavevmode
  \setbox\z@\hbox{#5}\setbox\@ne\hbox{#2%
    \if a#1\char#4\else#4\fi}%
  \ifx\empty#5\empty\box\@ne\else
  \@getaccshift \let\c@lcshift\s@bshift
  \dimen\z@\ht\@ne
  \ifdim\ht\@ne>1ex \advance\dimen\z@ -1.1ex \else
  \ifdim\ht\@ne=\z@ \dimen\z@\dp\@ne \fi\fi
  \vtop{\hsize\wd\z@\offinterlineskip
    \hbox{#5}
    \kern#3
    %\kern.5ex
    \hbox{\@accshift{#3}\hb@xt@\wd\z@{%
    %\hbox{\@accshift{.5ex}\hb@xt@\wd\z@{%
      \hss\vbox to \dimen\z@{\hbox{\box\@ne}\vss}\hss}}}\fi}}

\newcommand\@getaccshift{\def\@accshift##1{}%
  \ifx\f@shape\@slshapename\let\@accshift\@accshiftsl\fi
  \ifx\f@shape\@itshapename\let\@accshift\@accshiftsl\fi}

\newcommand\@accshiftsl[1]{\c@lcshift{#1}\kern-.16667\dimen\@ne}

\newcommand\@pshift[1]{%
  \dimen\@ne-\ht\z@          % get height of the box to be accented
  \advance\dimen\@ne -#1%    % add margin between the letter and accent
  \ifdim\ht\@ne>1ex
    \advance\dimen\@ne 1ex\else
  \ifdim\ht\@ne=\z@
    \advance\dimen\@ne -\dp\@ne\fi\fi}
    
\newcommand\s@bshift[1]{%
  \dimen\@ne\dp\z@                % get depth of the box to be accented
  \ifdim\ht\@ne>\z@
    \advance\dimen\@ne \ht\@ne\fi % add ht of the accent
  \ifdim\ht\@ne>1ex
    \advance\dimen\@ne #1\fi}     % add margin between the letter and accent