%% This maps consonants entered via a US keyboard into Hebrew
%% equivalents. It also takes care of some special characters
%% (punctuation, etc) and the fine-tuning (finagling) material.
%% In this file, shins with dots are mapped to naked shin glyphs.
input:
1;
output:
1;
aliases:
U = 95 % underscore
;
C = 94 % circumflex
;
COMMA = 44
;
SEMI = 59 % semicolon
;
OKALPH = (`b'|`c'|`d'|`i'|`m'|`n'|`p'|`s'|`t')
; % only these needed to specify units (bp, cm, pt, etc)
ARG = (43|45|46|48-57|{OKALPH}
) % digits, -, +, OK letters are valid
;
expressions:
%% In this first section, we present patterns/sequences that must be
%% exempted from further processing. In all cases, the user is
%% responsible for ensuring that these inclusions are properly
%% formed.
%%
%% First let's do the accent fine-tuning. Fine Tuning consists of a
%% pair of dimens, which are used as coordinates to adjust the
%% placement of an accent or cantillation mark. Tunings can consist
%% of a PAIR of coordinates. In case a letter has both an accent and
%% a trope, the first pair applies to the vowel+trope unit, while the
%% second applies to the displacement of the second diacrit from the
%% first.
%%
{U} {ARG}<1,9>{COMMA}{ARG}<1,9>{SEMI}{ARG}<1,9>{COMMA}{ARG}<1,9> {U}
=> "{\clearocplists\lowertuning[" \(* + 1 - 1) "]}"
;
{C} {ARG}<1,9>{COMMA}{ARG}<1,9>{SEMI}{ARG}<1,9>{COMMA}{ARG}<1,9> {C}
=> "{\clearocplists\uppertuning[" \(* + 1 - 1) "]}"
;
{U} {ARG}<1,9>{COMMA}{ARG}<1,9> {U}
=> "{\clearocplists\lowertune[" \(* + 1 - 1) "]}"
;
{C} {ARG}<1,9>{COMMA}{ARG}<1,9> {C}
=> "{\clearocplists\uppertune[" \(* + 1 - 1) "]}"
;
%% An adjustment is a single number, with or without a decimal, which
%% represents the fraction of the width of the glyph by which the
%% accent is displaced. It is much less powerful than a tuning, but
%% is sometimes useful.
%%
{U} {ARG}<1,9> {U} =>
"{\clearocplists\loweradj{" \(* + 1 - 1) "}}"
;
{C} {ARG}<1,9> {C} =>
"{\clearocplists\upperadj{" \(* + 1 - 1) "}}"
;
%% ODDMENTS, PUNCTUATION, etc.:
`-'`-'`-' => 143 % em-dash
;
`-'`-' => 127 % en-dash
;
%% CONSONANTS: 3+ char inputs...
`s' `h' `^' => 121 % shin plus upperdot
;
`^' `s' `h' => 121 % upperdot plus sin
;
%% CONSONANTS: 2 char inputs
`^' `s' => 121 % alternative upperdot plus sin
;
`c' `h' => 103 % chet
;
`s' `h' => 121 % shin
;
`t' `s' => 118 % tsadi
;
`k' `h' => 107 % chaf
;
`t' `h' => 122 % saf
;
`.' `t' => 104 % tet
;
`.' `s' => 113 % samekh
;
`?' `!' => 188 % interrobang
;
`!' `?' => 188 % interrobang; alt encoding
;
`*'`*' => 139 % new shekel symbol
;
%% CONSONANTS: single-char inputs:
%% (The case of alef is handled by m2aleph.otp!)
%%
`v' => 97 % vet
;
`b' => 97 % bet
;
`g' =>98 % gimel
;
`d' => 99 % dalet
;
`h' => 100 % he
;
`w' => 101 % vav
;
`z' => 102 % zayin
;
`y' => 105 % yod
;
`k' => 107 % kaf
;
`m' => 110 % mem
;
`n' => 112 % nun
;
96 => 114 % left single quote maps to ayin.
;
`f' => 116 % fe
;
`p' => 116 % pe
;
`q' => 119 % qof
;
`r' => 120 % resh
;
`s' => 122 % alternative coding for sav
;
`t' => 122 % tav
;
%%PUNCTUATION, SPECIAL SYMS, and other single-char inputs...
32 => 32 % space
;
`-' => 78 % rafe
;
`=' => 45 % hyphen
;
%% Some other chars map to themselves...
209-225=> \* % trope
;
227-239=> \* % more trope
;
65-77 => % vowels
;
182-187=> % meteg vowels
;
80 => \1 % paseq
;
85 => 101 % holam
;
149 => 101 % shuruk
;
78 => \1 % rafe
;
45 => \1 % hyphen
;
(108|156|140|172) => \1 % (bent) lamed, dagesh
;
33-59 => \1
;
61 => \1
;
63 => \1
;
91-95 => \1
;
254 => \1
;
(128-135) => \1 % Yiddish consonants
;
101 => \1 % the already-mapped vav
;
%% Everything else is invalid...
. => \1 208 % generic box is a sign of invalidity...
;