% greek-euenc.def: Greek LICR definitions for XeTeX and LuaTeX
% ***************************************************************
%
% :Copyright: © 2013 Günter Milde
% :Licence:   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 any later version.
% :Identification:
%  ::

\ProvidesFile{greek-euenc.def}
[2013/12/02 0.11.1 Greek LICRs for XeTeX and LuaTeX]

% Experimental support for Greek LICR macros with XeTeX and LuaTeX.
% Based on `lgrenc.def` and `lgrenc.dfu`.
%
% Changelog:
%   .. class:: borderless
%
%   ==========  ====== ========================================================
%   2013-07-16  0.1    initial version
%   2013-07-18  0.1.1  bugfix: wrong breathings psilioxia -> dasiaoxia
%   2013-07-19  0.1.2  bugfix: Disable composite defs starting with char macro,
%   ..                 fix "hiatus" handling.
%   2013-07-24  0.1.3  fix "input" path.
%   2013-10-01  0.1.4  remove clashing defs for legacy characters with oxia,
%   ..		       fix upcasing of ``\finalsigma``.
%   2013/12/01  0.11.1 fix identification.
%   ==========  ====== ========================================================
%
% Requires XeTeX or LuaTeX and a font with Greek characters. See
% `<test-euenc.tex>`_ and `<test-euenc.pdf>`_ for usage details and
% example.
%
% `xunicode.sty` defines several commands for the declaration of UTF
% characters, composites and accents. These are (sparsely) documented in the
% source. Unfortunately, they do not work seamless with the standard NFSS
% commands described in the fntguide.
%
% This file sets up LaTeX Internal Character Representaction (LICR) macros
% based on standard LaTeX commands. It should work independed of `xunicode`.
% (Currently, it only works if `fontspec` is loaded. TODO: Why?)
%
%
% Greek Diacritics
% ================
%
% Define "named macros" for simple and combined diacritics.
%
% * Named accent macros can be used instead of the ``\@tabacckludge`` by
%   to-LaTeX converters to ensure working also inside the tabbing environment.
%
% * Named macros are required for upcasing according to Greek typesetting
%   conventions and in the definition of composite commands.
%
% Greek alias names for standard accents::

\DeclareTextCommand{\acctonos}{\LastDeclaredEncoding}{\@tabacckludge'}
\DeclareTextCommand{\accvaria}{\LastDeclaredEncoding}{\@tabacckludge`}
\DeclareTextCommand{\accdialytika}{\LastDeclaredEncoding}{\@tabacckludge"}
\DeclareTextCommand{\accperispomeni}{\LastDeclaredEncoding}{\@tabacckludge~}

% Breathings:
%
% (The COMBINING GREEK KORONIS is a legacy character, discarded in favour of
% COMBINING COMMA ABOVE) ::

\DeclareTextCommand{\accpsili}{\LastDeclaredEncoding}[1]{#1\char"0313 } % ψιλή spiritus lenis (smooth breathing)
\DeclareTextCommand{\accdasia}{\LastDeclaredEncoding}[1]{#1\char"0314 } % δασεῖα spiritus asper (rough breathing)
\DeclareTextCommand{\>}{\LastDeclaredEncoding}{\accpsili}
\DeclareTextCommand{\<}{\LastDeclaredEncoding}{\accdasia}


%% TODO: how to pass the char nr. to DeclareTextCommand?
% \providecommand*{\DeclareTextAccentCombined}[3]{%
%   \DeclareTextCommand{#1}{#2}[1]{##1\char"#3 }%
% }
% \DeclareTextAccentCombined{\accypogegrammeni}{\LastDeclaredEncoding}{0837}

% Sub-iota:
%
% ``\ypogegrammeni`` is a postfix accent (ligature in LGR) ::

\DeclareTextSymbol{\ypogegrammeni}{\LastDeclaredEncoding}{0837} % COMBINING GREEK YPOGEGRAMMENI

% Combined diacritics::

% The COMBINING DIALYTIKA TONOS is discarded and not well supported by fonts:
\DeclareTextCommand{\accdialytikatonos}{\LastDeclaredEncoding}[1]{#1\char"0308 \char"0301 }
\DeclareTextCommand{\accdialytikavaria}{\LastDeclaredEncoding}[1]{#1\char"0308 \char"0300 }
\DeclareTextCommand{\accdialytikaperispomeni}{\LastDeclaredEncoding}[1]{#1\char"0342 \char"0308 }

\DeclareTextCommand{\accdasiaoxia}{\LastDeclaredEncoding}[1]{#1\char"0314 \char"0301 }
\DeclareTextCommand{\accdasiavaria}{\LastDeclaredEncoding}[1]{#1\char"0314 \char"0300 }
\DeclareTextCommand{\accdasiaperispomeni}{\LastDeclaredEncoding}[1]{#1\char"0314 \char"0342 }

\DeclareTextCommand{\accpsilioxia}{\LastDeclaredEncoding}[1]{#1\char"0301 \char"0313 }
\DeclareTextCommand{\accpsilivaria}{\LastDeclaredEncoding}[1]{#1\char"0300 \char"0313 }
\DeclareTextCommand{\accpsiliperispomeni}{\LastDeclaredEncoding}[1]{#1\char"0342 \char"0313 }


% Composite Diacritics
% ====================
%
% Use the `common Greek font encoding definitions`_::

\input{greek-fontenc.def}


% Character Definitions
% =====================
%
%
% \DeclareTextSymbol{\textcompwordmark}{\LastDeclaredEncoding}{8204}
%
%
% Greek and Coptic
% ~~~~~~~~~~~~~~~~
%
% ::

% NR    Unicode Name                                       %   babel name, % PU name
% 0370  GREEK CAPITAL LETTER HETA                          % Ͱ
% 0371  GREEK SMALL LETTER HETA                            % ͱ
% 0372  GREEK CAPITAL LETTER ARCHAIC SAMPI                 % Ͳ
% 0373  GREEK SMALL LETTER ARCHAIC SAMPI                   % ͳ
\DeclareTextCommand{\textdexiakeraia}{\LastDeclaredEncoding}{ʹ} % \anwtonos, \textnumeralsigngreek
\DeclareTextCommand{\textaristerikeraia}{\LastDeclaredEncoding}{͵} % \katwtonos, \textnumeralsignlowergreek
% 0376  GREEK CAPITAL LETTER PAMPHYLIAN DIGAMMA            % Ͷ
% 0377  GREEK SMALL LETTER PAMPHYLIAN DIGAMMA              % ͷ

% 037A  GREEK YPOGEGRAMMENI (use \textcompwordmark\ypogegrammeni) % ͺ
% 037B  GREEK SMALL REVERSED LUNATE SIGMA SYMBOL
% 037C  GREEK SMALL DOTTED LUNATE SIGMA SYMBOL
% 037D  GREEK SMALL REVERSED DOTTED LUNATE SIGMA SYMBOL
\DeclareTextCommand{\texterotimatiko}{\LastDeclaredEncoding}{;} % \textquestion

\DeclareTextCompositeCommand{\'}{\LastDeclaredEncoding}{\textcompwordmark}{΄}
\DeclareTextCompositeCommand{\accdialytikatonos}{\LastDeclaredEncoding}{\textcompwordmark}{΅}
\DeclareTextCompositeCommand{\'}{\LastDeclaredEncoding}{\textAlpha}{Ά}
\DeclareTextCommand{\textanoteleia}{\LastDeclaredEncoding}{·} % \anoteleia
\DeclareTextCompositeCommand{\'}{\LastDeclaredEncoding}{\textEpsilon}{Έ}
\DeclareTextCompositeCommand{\'}{\LastDeclaredEncoding}{\textEta}{Ή}
\DeclareTextCompositeCommand{\'}{\LastDeclaredEncoding}{\textIota}{Ί}
\DeclareTextCompositeCommand{\'}{\LastDeclaredEncoding}{\textOmicron}{Ό}
\DeclareTextCompositeCommand{\'}{\LastDeclaredEncoding}{\textUpsilon}{Ύ}
\DeclareTextCompositeCommand{\'}{\LastDeclaredEncoding}{\textOmega}{Ώ}
\DeclareTextCompositeCommand{\accdialytikatonos}{\LastDeclaredEncoding}{\textiota}{ΐ}

\DeclareTextCommand{\textAlpha}{\LastDeclaredEncoding}{Α}
\DeclareTextCommand{\textBeta}{\LastDeclaredEncoding}{Β}
\DeclareTextCommand{\textGamma}{\LastDeclaredEncoding}{Γ}
\DeclareTextCommand{\textDelta}{\LastDeclaredEncoding}{Δ}
\DeclareTextCommand{\textEpsilon}{\LastDeclaredEncoding}{Ε}
\DeclareTextCommand{\textZeta}{\LastDeclaredEncoding}{Ζ}
\DeclareTextCommand{\textEta}{\LastDeclaredEncoding}{Η}
\DeclareTextCommand{\textTheta}{\LastDeclaredEncoding}{Θ}
\DeclareTextCommand{\textIota}{\LastDeclaredEncoding}{Ι}
\DeclareTextCommand{\textKappa}{\LastDeclaredEncoding}{Κ}
\DeclareTextCommand{\textLambda}{\LastDeclaredEncoding}{Λ}
\DeclareTextCommand{\textMu}{\LastDeclaredEncoding}{Μ}
\DeclareTextCommand{\textNu}{\LastDeclaredEncoding}{Ν}
\DeclareTextCommand{\textXi}{\LastDeclaredEncoding}{Ξ}
\DeclareTextCommand{\textOmicron}{\LastDeclaredEncoding}{Ο}
\DeclareTextCommand{\textPi}{\LastDeclaredEncoding}{Π}
\DeclareTextCommand{\textRho}{\LastDeclaredEncoding}{Ρ}
\DeclareTextCommand{\textSigma}{\LastDeclaredEncoding}{Σ}
\DeclareTextCommand{\textTau}{\LastDeclaredEncoding}{Τ}
\DeclareTextCommand{\textUpsilon}{\LastDeclaredEncoding}{Υ}
\DeclareTextCommand{\textPhi}{\LastDeclaredEncoding}{Φ}
\DeclareTextCommand{\textChi}{\LastDeclaredEncoding}{Χ}
\DeclareTextCommand{\textPsi}{\LastDeclaredEncoding}{Ψ}
\DeclareTextCommand{\textOmega}{\LastDeclaredEncoding}{Ω}

\DeclareTextCompositeCommand{\"}{\LastDeclaredEncoding}{\textIota}{Ϊ}
\DeclareTextCompositeCommand{\"}{\LastDeclaredEncoding}{\textUpsilon}{Ϋ}
\DeclareTextCompositeCommand{\'}{\LastDeclaredEncoding}{\textalpha}{ά}
\DeclareTextCompositeCommand{\'}{\LastDeclaredEncoding}{\textepsilon}{έ}
\DeclareTextCompositeCommand{\'}{\LastDeclaredEncoding}{\texteta}{ή}
\DeclareTextCompositeCommand{\'}{\LastDeclaredEncoding}{\textiota}{ί}
\DeclareTextCompositeCommand{\accdialytikatonos}{\LastDeclaredEncoding}{\textupsilon}{ΰ}

\DeclareTextCommand{\textalpha}{\LastDeclaredEncoding}{α}
\DeclareTextCommand{\textbeta}{\LastDeclaredEncoding}{β}
\DeclareTextCommand{\textgamma}{\LastDeclaredEncoding}{γ}
\DeclareTextCommand{\textdelta}{\LastDeclaredEncoding}{δ}
\DeclareTextCommand{\textepsilon}{\LastDeclaredEncoding}{ε}
\DeclareTextCommand{\textzeta}{\LastDeclaredEncoding}{ζ}
\DeclareTextCommand{\texteta}{\LastDeclaredEncoding}{η}
\DeclareTextCommand{\texttheta}{\LastDeclaredEncoding}{θ}
\DeclareTextCommand{\textiota}{\LastDeclaredEncoding}{ι}
\DeclareTextCommand{\textkappa}{\LastDeclaredEncoding}{κ}
\DeclareTextCommand{\textlambda}{\LastDeclaredEncoding}{λ}
\DeclareTextCommand{\textmu}{\LastDeclaredEncoding}{μ} % \textmugreek
\DeclareTextCommand{\textnu}{\LastDeclaredEncoding}{ν}
\DeclareTextCommand{\textxi}{\LastDeclaredEncoding}{ξ}
\DeclareTextCommand{\textomicron}{\LastDeclaredEncoding}{ο}
\DeclareTextCommand{\textpi}{\LastDeclaredEncoding}{π}
\DeclareTextCommand{\textrho}{\LastDeclaredEncoding}{ρ}
\DeclareTextCommand{\textvarsigma}{\LastDeclaredEncoding}{ς} % final sigma
\DeclareTextCommand{\textfinalsigma}{\LastDeclaredEncoding}{\textvarsigma}
\DeclareTextCommand{\textsigma}{\LastDeclaredEncoding}{σ}
% Dummy definition (\textautosigma is lowercase of \textSigma):
\ProvideTextCommand{\textautosigma}{\LastDeclaredEncoding}{\textsigma}
\DeclareTextCommand{\texttau}{\LastDeclaredEncoding}{τ}
\DeclareTextCommand{\textupsilon}{\LastDeclaredEncoding}{υ}
\DeclareTextCommand{\textphi}{\LastDeclaredEncoding}{φ}
\DeclareTextCommand{\textchi}{\LastDeclaredEncoding}{χ}
\DeclareTextCommand{\textpsi}{\LastDeclaredEncoding}{ψ}
\DeclareTextCommand{\textomega}{\LastDeclaredEncoding}{ω}

\DeclareTextCompositeCommand{\"}{\LastDeclaredEncoding}{\textiota}{ϊ}
\DeclareTextCompositeCommand{\"}{\LastDeclaredEncoding}{\textupsilon}{ϋ}
\DeclareTextCompositeCommand{\'}{\LastDeclaredEncoding}{\textomicron}{ό}
\DeclareTextCompositeCommand{\'}{\LastDeclaredEncoding}{\textupsilon}{ύ}
\DeclareTextCompositeCommand{\'}{\LastDeclaredEncoding}{\textomega}{ώ}

\DeclareTextCommand{\textQoppa}{\LastDeclaredEncoding}{Ϙ}
\DeclareTextCommand{\textqoppa}{\LastDeclaredEncoding}{ϙ}
\DeclareTextCommand{\textStigma}{\LastDeclaredEncoding}{Ϛ}
\DeclareTextCommand{\textstigma}{\LastDeclaredEncoding}{ϛ}
\DeclareTextCommand{\textDigamma}{\LastDeclaredEncoding}{Ϝ}
\DeclareTextCommand{\textdigamma}{\LastDeclaredEncoding}{ϝ}
%03DE GREEK LETTER KOPPA                      % Ϟ \textKoppa
\DeclareTextCommand{\textkoppa}{\LastDeclaredEncoding}{ϟ} % \koppa, \textqoppa [sic!]
\DeclareTextCommand{\textSampi}{\LastDeclaredEncoding}{Ϡ}
\DeclareTextCommand{\textsampi}{\LastDeclaredEncoding}{ϡ}

% Greek Extended
% ~~~~~~~~~~~~~~
%
% We skip definitions for characters "... WITH OXIA", because they would
% overwrite the defintions for "... WITH TONOS" in the `Greek and Coptic`
% block.
%
% ::

\DeclareTextCompositeCommand{\accpsili}{\LastDeclaredEncoding}{\textalpha}{ἀ}
\DeclareTextCompositeCommand{\accdasia}{\LastDeclaredEncoding}{\textalpha}{ἁ}
\DeclareTextCompositeCommand{\accpsilivaria}{\LastDeclaredEncoding}{\textalpha}{ἂ}
\DeclareTextCompositeCommand{\accdasiavaria}{\LastDeclaredEncoding}{\textalpha}{ἃ}
\DeclareTextCompositeCommand{\accpsilioxia}{\LastDeclaredEncoding}{\textalpha}{ἄ}
\DeclareTextCompositeCommand{\accdasiaoxia}{\LastDeclaredEncoding}{\textalpha}{ἅ}
\DeclareTextCompositeCommand{\accpsiliperispomeni}{\LastDeclaredEncoding}{\textalpha}{ἆ}
\DeclareTextCompositeCommand{\accdasiaperispomeni}{\LastDeclaredEncoding}{\textalpha}{ἇ}
\DeclareTextCompositeCommand{\accpsili}{\LastDeclaredEncoding}{\textAlpha}{Ἀ}
\DeclareTextCompositeCommand{\accdasia}{\LastDeclaredEncoding}{\textAlpha}{Ἁ}
\DeclareTextCompositeCommand{\accpsilivaria}{\LastDeclaredEncoding}{\textAlpha}{Ἂ}
\DeclareTextCompositeCommand{\accdasiavaria}{\LastDeclaredEncoding}{\textAlpha}{Ἃ}
\DeclareTextCompositeCommand{\accpsilioxia}{\LastDeclaredEncoding}{\textAlpha}{Ἄ}
\DeclareTextCompositeCommand{\accdasiaoxia}{\LastDeclaredEncoding}{\textAlpha}{Ἅ}
\DeclareTextCompositeCommand{\accpsiliperispomeni}{\LastDeclaredEncoding}{\textAlpha}{Ἆ}
\DeclareTextCompositeCommand{\accdasiaperispomeni}{\LastDeclaredEncoding}{\textAlpha}{Ἇ}

\DeclareTextCompositeCommand{\accpsili}{\LastDeclaredEncoding}{\textepsilon}{ἐ}
\DeclareTextCompositeCommand{\accdasia}{\LastDeclaredEncoding}{\textepsilon}{ἑ}
\DeclareTextCompositeCommand{\accpsilivaria}{\LastDeclaredEncoding}{\textepsilon}{ἒ}
\DeclareTextCompositeCommand{\accdasiavaria}{\LastDeclaredEncoding}{\textepsilon}{ἓ}
\DeclareTextCompositeCommand{\accpsilioxia}{\LastDeclaredEncoding}{\textepsilon}{ἔ}
\DeclareTextCompositeCommand{\accdasiaoxia}{\LastDeclaredEncoding}{\textepsilon}{ἕ}
\DeclareTextCompositeCommand{\accpsili}{\LastDeclaredEncoding}{\textEpsilon}{Ἐ}
\DeclareTextCompositeCommand{\accdasia}{\LastDeclaredEncoding}{\textEpsilon}{Ἑ}
\DeclareTextCompositeCommand{\accpsilivaria}{\LastDeclaredEncoding}{\textEpsilon}{Ἒ}
\DeclareTextCompositeCommand{\accdasiavaria}{\LastDeclaredEncoding}{\textEpsilon}{Ἓ}
\DeclareTextCompositeCommand{\accpsilioxia}{\LastDeclaredEncoding}{\textEpsilon}{Ἔ}
\DeclareTextCompositeCommand{\accdasiaoxia}{\LastDeclaredEncoding}{\textEpsilon}{Ἕ}

\DeclareTextCompositeCommand{\accpsili}{\LastDeclaredEncoding}{\texteta}{ἠ}
\DeclareTextCompositeCommand{\accdasia}{\LastDeclaredEncoding}{\texteta}{ἡ}
\DeclareTextCompositeCommand{\accpsilivaria}{\LastDeclaredEncoding}{\texteta}{ἢ}
\DeclareTextCompositeCommand{\accdasiavaria}{\LastDeclaredEncoding}{\texteta}{ἣ}
\DeclareTextCompositeCommand{\accpsilioxia}{\LastDeclaredEncoding}{\texteta}{ἤ}
\DeclareTextCompositeCommand{\accdasiaoxia}{\LastDeclaredEncoding}{\texteta}{ἥ}
\DeclareTextCompositeCommand{\accpsiliperispomeni}{\LastDeclaredEncoding}{\texteta}{ἦ}
\DeclareTextCompositeCommand{\accdasiaperispomeni}{\LastDeclaredEncoding}{\texteta}{ἧ}
\DeclareTextCompositeCommand{\accpsili}{\LastDeclaredEncoding}{\textEta}{Ἠ}
\DeclareTextCompositeCommand{\accdasia}{\LastDeclaredEncoding}{\textEta}{Ἡ}
\DeclareTextCompositeCommand{\accpsilivaria}{\LastDeclaredEncoding}{\textEta}{Ἢ}
\DeclareTextCompositeCommand{\accdasiavaria}{\LastDeclaredEncoding}{\textEta}{Ἣ}
\DeclareTextCompositeCommand{\accpsilioxia}{\LastDeclaredEncoding}{\textEta}{Ἤ}
\DeclareTextCompositeCommand{\accdasiaoxia}{\LastDeclaredEncoding}{\textEta}{Ἥ}
\DeclareTextCompositeCommand{\accpsiliperispomeni}{\LastDeclaredEncoding}{\textEta}{Ἦ}
\DeclareTextCompositeCommand{\accdasiaperispomeni}{\LastDeclaredEncoding}{\textEta}{Ἧ}

\DeclareTextCompositeCommand{\accpsili}{\LastDeclaredEncoding}{\textiota}{ἰ}
\DeclareTextCompositeCommand{\accdasia}{\LastDeclaredEncoding}{\textiota}{ἱ}
\DeclareTextCompositeCommand{\accpsilivaria}{\LastDeclaredEncoding}{\textiota}{ἲ}
\DeclareTextCompositeCommand{\accdasiavaria}{\LastDeclaredEncoding}{\textiota}{ἳ}
\DeclareTextCompositeCommand{\accpsilioxia}{\LastDeclaredEncoding}{\textiota}{ἴ}
\DeclareTextCompositeCommand{\accdasiaoxia}{\LastDeclaredEncoding}{\textiota}{ἵ}
\DeclareTextCompositeCommand{\accpsiliperispomeni}{\LastDeclaredEncoding}{\textiota}{ἶ}
\DeclareTextCompositeCommand{\accdasiaperispomeni}{\LastDeclaredEncoding}{\textiota}{ἷ}
\DeclareTextCompositeCommand{\accpsili}{\LastDeclaredEncoding}{\textIota}{Ἰ}
\DeclareTextCompositeCommand{\accdasia}{\LastDeclaredEncoding}{\textIota}{Ἱ}
\DeclareTextCompositeCommand{\accpsilivaria}{\LastDeclaredEncoding}{\textIota}{Ἲ}
\DeclareTextCompositeCommand{\accdasiavaria}{\LastDeclaredEncoding}{\textIota}{Ἳ}
\DeclareTextCompositeCommand{\accpsilioxia}{\LastDeclaredEncoding}{\textIota}{Ἴ}
\DeclareTextCompositeCommand{\accdasiaoxia}{\LastDeclaredEncoding}{\textIota}{Ἵ}
\DeclareTextCompositeCommand{\accpsiliperispomeni}{\LastDeclaredEncoding}{\textIota}{Ἶ}
\DeclareTextCompositeCommand{\accdasiaperispomeni}{\LastDeclaredEncoding}{\textIota}{Ἷ}

\DeclareTextCompositeCommand{\accpsili}{\LastDeclaredEncoding}{\textomicron}{ὀ}
\DeclareTextCompositeCommand{\accdasia}{\LastDeclaredEncoding}{\textomicron}{ὁ}
\DeclareTextCompositeCommand{\accpsilivaria}{\LastDeclaredEncoding}{\textomicron}{ὂ}
\DeclareTextCompositeCommand{\accdasiavaria}{\LastDeclaredEncoding}{\textomicron}{ὃ}
\DeclareTextCompositeCommand{\accpsilioxia}{\LastDeclaredEncoding}{\textomicron}{ὄ}
\DeclareTextCompositeCommand{\accdasiaoxia}{\LastDeclaredEncoding}{\textomicron}{ὅ}
\DeclareTextCompositeCommand{\accpsili}{\LastDeclaredEncoding}{\textOmicron}{Ὀ}
\DeclareTextCompositeCommand{\accdasia}{\LastDeclaredEncoding}{\textOmicron}{Ὁ}
\DeclareTextCompositeCommand{\accpsilivaria}{\LastDeclaredEncoding}{\textOmicron}{Ὂ}
\DeclareTextCompositeCommand{\accdasiavaria}{\LastDeclaredEncoding}{\textOmicron}{Ὃ}
\DeclareTextCompositeCommand{\accpsilioxia}{\LastDeclaredEncoding}{\textOmicron}{Ὄ}
\DeclareTextCompositeCommand{\accdasiaoxia}{\LastDeclaredEncoding}{\textOmicron}{Ὅ}

\DeclareTextCompositeCommand{\accpsili}{\LastDeclaredEncoding}{\textupsilon}{ὐ}
\DeclareTextCompositeCommand{\accdasia}{\LastDeclaredEncoding}{\textupsilon}{ὑ}
\DeclareTextCompositeCommand{\accpsilivaria}{\LastDeclaredEncoding}{\textupsilon}{ὒ}
\DeclareTextCompositeCommand{\accdasiavaria}{\LastDeclaredEncoding}{\textupsilon}{ὓ}
\DeclareTextCompositeCommand{\accpsilioxia}{\LastDeclaredEncoding}{\textupsilon}{ὔ}
\DeclareTextCompositeCommand{\accdasiaoxia}{\LastDeclaredEncoding}{\textupsilon}{ὕ}
\DeclareTextCompositeCommand{\accpsiliperispomeni}{\LastDeclaredEncoding}{\textupsilon}{ὖ}
\DeclareTextCompositeCommand{\accdasiaperispomeni}{\LastDeclaredEncoding}{\textupsilon}{ὗ}
\DeclareTextCompositeCommand{\accdasia}{\LastDeclaredEncoding}{\textUpsilon}{Ὑ}
\DeclareTextCompositeCommand{\accdasiavaria}{\LastDeclaredEncoding}{\textUpsilon}{Ὓ}
\DeclareTextCompositeCommand{\accdasiaoxia}{\LastDeclaredEncoding}{\textUpsilon}{Ὕ}
\DeclareTextCompositeCommand{\accdasiaperispomeni}{\LastDeclaredEncoding}{\textUpsilon}{Ὗ}

\DeclareTextCompositeCommand{\accpsili}{\LastDeclaredEncoding}{\textomega}{ὠ}
\DeclareTextCompositeCommand{\accdasia}{\LastDeclaredEncoding}{\textomega}{ὡ}
\DeclareTextCompositeCommand{\accpsilivaria}{\LastDeclaredEncoding}{\textomega}{ὢ}
\DeclareTextCompositeCommand{\accdasiavaria}{\LastDeclaredEncoding}{\textomega}{ὣ}
\DeclareTextCompositeCommand{\accpsilioxia}{\LastDeclaredEncoding}{\textomega}{ὤ}
\DeclareTextCompositeCommand{\accdasiaoxia}{\LastDeclaredEncoding}{\textomega}{ὥ}
\DeclareTextCompositeCommand{\accpsiliperispomeni}{\LastDeclaredEncoding}{\textomega}{ὦ}
\DeclareTextCompositeCommand{\accdasiaperispomeni}{\LastDeclaredEncoding}{\textomega}{ὧ}
\DeclareTextCompositeCommand{\accpsili}{\LastDeclaredEncoding}{\textOmega}{Ὠ}
\DeclareTextCompositeCommand{\accdasia}{\LastDeclaredEncoding}{\textOmega}{Ὡ}
\DeclareTextCompositeCommand{\accpsilivaria}{\LastDeclaredEncoding}{\textOmega}{Ὢ}
\DeclareTextCompositeCommand{\accdasiavaria}{\LastDeclaredEncoding}{\textOmega}{Ὣ}
\DeclareTextCompositeCommand{\accpsilioxia}{\LastDeclaredEncoding}{\textOmega}{Ὤ}
\DeclareTextCompositeCommand{\accdasiaoxia}{\LastDeclaredEncoding}{\textOmega}{Ὥ}
\DeclareTextCompositeCommand{\accpsiliperispomeni}{\LastDeclaredEncoding}{\textOmega}{Ὦ}
\DeclareTextCompositeCommand{\accdasiaperispomeni}{\LastDeclaredEncoding}{\textOmega}{Ὧ}

\DeclareTextCompositeCommand{\`}{\LastDeclaredEncoding}{\textalpha}{ὰ}
\DeclareTextCompositeCommand{\`}{\LastDeclaredEncoding}{\textepsilon}{ὲ}
\DeclareTextCompositeCommand{\`}{\LastDeclaredEncoding}{\texteta}{ὴ}
\DeclareTextCompositeCommand{\`}{\LastDeclaredEncoding}{\textiota}{ὶ}
\DeclareTextCompositeCommand{\`}{\LastDeclaredEncoding}{\textomicron}{ὸ}
\DeclareTextCompositeCommand{\`}{\LastDeclaredEncoding}{\textupsilon}{ὺ}
\DeclareTextCompositeCommand{\`}{\LastDeclaredEncoding}{\textomega}{ὼ}

%% postfix ypogegrammeni cannot be second part of composite defs.
% \DeclareTextCompositeCommand{\accpsili}{\LastDeclaredEncoding}{\textalpha\ypogegrammeni}{ᾀ}
% \DeclareTextCompositeCommand{\accdasia}{\LastDeclaredEncoding}{\textalpha\ypogegrammeni}{ᾁ}
% \DeclareTextCompositeCommand{\accpsilivaria}{\LastDeclaredEncoding}{\textalpha\ypogegrammeni}{ᾂ}
% \DeclareTextCompositeCommand{\accdasiavaria}{\LastDeclaredEncoding}{\textalpha\ypogegrammeni}{ᾃ}
% \DeclareTextCompositeCommand{\accpsilioxia}{\LastDeclaredEncoding}{\textalpha\ypogegrammeni}{ᾄ}
% \DeclareTextCompositeCommand{\accdasiaoxia}{\LastDeclaredEncoding}{\textalpha\ypogegrammeni}{ᾅ}
% \DeclareTextCompositeCommand{\accpsiliperispomeni}{\LastDeclaredEncoding}{\textalpha\ypogegrammeni}{ᾆ}
% \DeclareTextCompositeCommand{\accdasiaperispomeni}{\LastDeclaredEncoding}{\textalpha\ypogegrammeni}{ᾇ}
% \DeclareTextCompositeCommand{\accpsili}{\LastDeclaredEncoding}{\textAlpha\prosgegrammeni}{ᾈ}
% \DeclareTextCompositeCommand{\accdasia}{\LastDeclaredEncoding}{\textAlpha\prosgegrammeni}{ᾉ}
% \DeclareTextCompositeCommand{\accpsilivaria}{\LastDeclaredEncoding}{\textAlpha\prosgegrammeni}{ᾊ}
% \DeclareTextCompositeCommand{\accdasiavaria}{\LastDeclaredEncoding}{\textAlpha\prosgegrammeni}{ᾋ}
% \DeclareTextCompositeCommand{\accpsilioxia}{\LastDeclaredEncoding}{\textAlpha\prosgegrammeni}{ᾌ}
% \DeclareTextCompositeCommand{\accdasiaoxia}{\LastDeclaredEncoding}{\textAlpha\prosgegrammeni}{ᾍ}
% \DeclareTextCompositeCommand{\accpsiliperispomeni}{\LastDeclaredEncoding}{\textAlpha\prosgegrammeni}{ᾎ}
% \DeclareTextCompositeCommand{\accdasiaperispomeni}{\LastDeclaredEncoding}{\textAlpha\prosgegrammeni}{ᾏ}
%
% \DeclareTextCompositeCommand{\accpsili}{\LastDeclaredEncoding}{\texteta\ypogegrammeni}{ᾐ}
% \DeclareTextCompositeCommand{\accdasia}{\LastDeclaredEncoding}{\texteta\ypogegrammeni}{ᾑ}
% \DeclareTextCompositeCommand{\accpsilivaria}{\LastDeclaredEncoding}{\texteta\ypogegrammeni}{ᾒ}
% \DeclareTextCompositeCommand{\accdasiavaria}{\LastDeclaredEncoding}{\texteta\ypogegrammeni}{ᾓ}
% \DeclareTextCompositeCommand{\accpsilioxia}{\LastDeclaredEncoding}{\texteta\ypogegrammeni}{ᾔ}
% \DeclareTextCompositeCommand{\accdasiaoxia}{\LastDeclaredEncoding}{\texteta\ypogegrammeni}{ᾕ}
% \DeclareTextCompositeCommand{\accpsiliperispomeni}{\LastDeclaredEncoding}{\texteta\ypogegrammeni}{ᾖ}
% \DeclareTextCompositeCommand{\accdasiaperispomeni}{\LastDeclaredEncoding}{\texteta\ypogegrammeni}{ᾗ}
% \DeclareTextCompositeCommand{\accpsili}{\LastDeclaredEncoding}{\textEta\prosgegrammeni}{ᾘ}
% \DeclareTextCompositeCommand{\accdasia}{\LastDeclaredEncoding}{\textEta\prosgegrammeni}{ᾙ}
% \DeclareTextCompositeCommand{\accpsilivaria}{\LastDeclaredEncoding}{\textEta\prosgegrammeni}{ᾚ}
% \DeclareTextCompositeCommand{\accdasiavaria}{\LastDeclaredEncoding}{\textEta\prosgegrammeni}{ᾛ}
% \DeclareTextCompositeCommand{\accpsilioxia}{\LastDeclaredEncoding}{\textEta\prosgegrammeni}{ᾜ}
% \DeclareTextCompositeCommand{\accdasiaoxia}{\LastDeclaredEncoding}{\textEta\prosgegrammeni}{ᾝ}
% \DeclareTextCompositeCommand{\accpsiliperispomeni}{\LastDeclaredEncoding}{\textEta\prosgegrammeni}{ᾞ}
% \DeclareTextCompositeCommand{\accdasiaperispomeni}{\LastDeclaredEncoding}{\textEta\prosgegrammeni}{ᾟ}
%
% \DeclareTextCompositeCommand{\accpsili}{\LastDeclaredEncoding}{\textomega\ypogegrammeni}{ᾠ}
% \DeclareTextCompositeCommand{\accdasia}{\LastDeclaredEncoding}{\textomega\ypogegrammeni}{ᾡ}
% \DeclareTextCompositeCommand{\accpsilivaria}{\LastDeclaredEncoding}{\textomega\ypogegrammeni}{ᾢ}
% \DeclareTextCompositeCommand{\accdasiavaria}{\LastDeclaredEncoding}{\textomega\ypogegrammeni}{ᾣ}
% \DeclareTextCompositeCommand{\accpsilioxia}{\LastDeclaredEncoding}{\textomega\ypogegrammeni}{ᾤ}
% \DeclareTextCompositeCommand{\accdasiaoxia}{\LastDeclaredEncoding}{\textomega\ypogegrammeni}{ᾥ}
% \DeclareTextCompositeCommand{\accpsiliperispomeni}{\LastDeclaredEncoding}{\textomega\ypogegrammeni}{ᾦ}
% \DeclareTextCompositeCommand{\accdasiaperispomeni}{\LastDeclaredEncoding}{\textomega\ypogegrammeni}{ᾧ}
% \DeclareTextCompositeCommand{\accpsili}{\LastDeclaredEncoding}{\textOmega\prosgegrammeni}{ᾨ}
% \DeclareTextCompositeCommand{\accdasia}{\LastDeclaredEncoding}{\textOmega\prosgegrammeni}{ᾩ}
% \DeclareTextCompositeCommand{\accpsilivaria}{\LastDeclaredEncoding}{\textOmega\prosgegrammeni}{ᾪ}
% \DeclareTextCompositeCommand{\accdasiavaria}{\LastDeclaredEncoding}{\textOmega\prosgegrammeni}{ᾫ}
% \DeclareTextCompositeCommand{\accpsilioxia}{\LastDeclaredEncoding}{\textOmega\prosgegrammeni}{ᾬ}
% \DeclareTextCompositeCommand{\accdasiaoxia}{\LastDeclaredEncoding}{\textOmega\prosgegrammeni}{ᾭ}
% \DeclareTextCompositeCommand{\accpsiliperispomeni}{\LastDeclaredEncoding}{\textOmega\prosgegrammeni}{ᾮ}
% \DeclareTextCompositeCommand{\accdasiaperispomeni}{\LastDeclaredEncoding}{\textOmega\prosgegrammeni}{ᾯ}

\DeclareTextCompositeCommand{\u}{\LastDeclaredEncoding}{\textalpha}{ᾰ}
\DeclareTextCompositeCommand{\=}{\LastDeclaredEncoding}{\textalpha}{ᾱ}
% \DeclareTextCompositeCommand{\`}{\LastDeclaredEncoding}{\textalpha\ypogegrammeni}{ᾲ}
% \DeclareTextCompositeCommand{\textalpha}{\LastDeclaredEncoding}{\ypogegrammeni}{ᾳ}
% \DeclareTextCompositeCommand{\'}{\LastDeclaredEncoding}{\textalpha\ypogegrammeni}{ᾴ}
\DeclareTextCompositeCommand{\~}{\LastDeclaredEncoding}{\textalpha}{ᾶ}
\DeclareTextCompositeCommand{\accperispomeni}{\LastDeclaredEncoding}{\textalpha}{ᾶ}
% \DeclareTextCompositeCommand{\accperispomeni}{\LastDeclaredEncoding}{\textalpha\ypogegrammeni}{ᾷ}
\DeclareTextCompositeCommand{\u}{\LastDeclaredEncoding}{\textAlpha}{Ᾰ}
\DeclareTextCompositeCommand{\=}{\LastDeclaredEncoding}{\textAlpha}{Ᾱ}
\DeclareTextCompositeCommand{\`}{\LastDeclaredEncoding}{\textAlpha}{Ὰ}
% \DeclareTextCompositeCommand{\textAlpha}{\LastDeclaredEncoding}{\prosgegrammeni}{ᾼ}
\DeclareTextCompositeCommand{\accpsili}{\LastDeclaredEncoding}{\textcompwordmark}{᾽}
\DeclareTextCommand{\prosgegrammeni}{\LastDeclaredEncoding}{ι}
\DeclareTextCompositeCommand{\accpsili}{\LastDeclaredEncoding}{\textcompwordmark}{᾿}

\DeclareTextCompositeCommand{\~}{\LastDeclaredEncoding}{\textcompwordmark}{῀}
\DeclareTextCompositeCommand{\accperispomeni}{\LastDeclaredEncoding}{\textcompwordmark}{῀}
\DeclareTextCompositeCommand{\accdialytikaperispomeni}{\LastDeclaredEncoding}{\textcompwordmark}{῁}
% \DeclareTextCompositeCommand{\`}{\LastDeclaredEncoding}{\texteta\ypogegrammeni}{ῂ}
% \DeclareTextCompositeCommand{\texteta}{\LastDeclaredEncoding}{\ypogegrammeni}{ῃ}
% \DeclareTextCompositeCommand{\'}{\LastDeclaredEncoding}{\texteta\ypogegrammeni}{ῄ}
\DeclareTextCompositeCommand{\~}{\LastDeclaredEncoding}{\texteta}{ῆ}
\DeclareTextCompositeCommand{\accperispomeni}{\LastDeclaredEncoding}{\texteta}{ῆ}
% \DeclareTextCompositeCommand{\accperispomeni}{\LastDeclaredEncoding}{\texteta\ypogegrammeni}{ῇ}
\DeclareTextCompositeCommand{\`}{\LastDeclaredEncoding}{\textEpsilon}{Ὲ}
\DeclareTextCompositeCommand{\`}{\LastDeclaredEncoding}{\textEta}{Ὴ}
% \DeclareTextCompositeCommand{\textEta}{\LastDeclaredEncoding}{\prosgegrammeni}{ῌ}
\DeclareTextCompositeCommand{\accpsilivaria}{\LastDeclaredEncoding}{\textcompwordmark}{῍}
\DeclareTextCompositeCommand{\accpsilioxia}{\LastDeclaredEncoding}{\textcompwordmark}{῎}
\DeclareTextCompositeCommand{\accpsiliperispomeni}{\LastDeclaredEncoding}{\textcompwordmark}{῏}

\DeclareTextCompositeCommand{\u}{\LastDeclaredEncoding}{\textiota}{ῐ}
\DeclareTextCompositeCommand{\=}{\LastDeclaredEncoding}{\textiota}{ῑ}
\DeclareTextCompositeCommand{\accdialytikavaria}{\LastDeclaredEncoding}{\textiota}{ῒ}
\DeclareTextCompositeCommand{\accdialytikaoxia}{\LastDeclaredEncoding}{\textiota}{ΐ}
\DeclareTextCompositeCommand{\~}{\LastDeclaredEncoding}{\textiota}{ῖ}
\DeclareTextCompositeCommand{\accperispomeni}{\LastDeclaredEncoding}{\textiota}{ῖ}
\DeclareTextCompositeCommand{\accdialytikaperispomeni}{\LastDeclaredEncoding}{\textiota}{ῗ}
\DeclareTextCompositeCommand{\u}{\LastDeclaredEncoding}{\textIota}{Ῐ}
\DeclareTextCompositeCommand{\=}{\LastDeclaredEncoding}{\textIota}{Ῑ}
\DeclareTextCompositeCommand{\`}{\LastDeclaredEncoding}{\textIota}{Ὶ}
\DeclareTextCompositeCommand{\accdasiavaria}{\LastDeclaredEncoding}{\textcompwordmark}{῝}
\DeclareTextCompositeCommand{\accdasiaoxia}{\LastDeclaredEncoding}{\textcompwordmark}{῞}
\DeclareTextCompositeCommand{\accdasiaperispomeni}{\LastDeclaredEncoding}{\textcompwordmark}{῟}

\DeclareTextCompositeCommand{\u}{\LastDeclaredEncoding}{\textupsilon}{ῠ}
\DeclareTextCompositeCommand{\=}{\LastDeclaredEncoding}{\textupsilon}{ῡ}
\DeclareTextCompositeCommand{\accdialytikavaria}{\LastDeclaredEncoding}{\textupsilon}{ῢ}
\DeclareTextCompositeCommand{\accdialytikaoxia}{\LastDeclaredEncoding}{\textupsilon}{ΰ}
\DeclareTextCompositeCommand{\accpsili}{\LastDeclaredEncoding}{\textrho}{ῤ}
\DeclareTextCompositeCommand{\accdasia}{\LastDeclaredEncoding}{\textrho}{ῥ}
\DeclareTextCompositeCommand{\~}{\LastDeclaredEncoding}{\textupsilon}{ῦ}
\DeclareTextCompositeCommand{\accperispomeni}{\LastDeclaredEncoding}{\textupsilon}{ῦ}
\DeclareTextCompositeCommand{\accdialytikaperispomeni}{\LastDeclaredEncoding}{\textupsilon}{ῧ}
\DeclareTextCompositeCommand{\u}{\LastDeclaredEncoding}{\textUpsilon}{Ῠ}
\DeclareTextCompositeCommand{\=}{\LastDeclaredEncoding}{\textUpsilon}{Ῡ}
\DeclareTextCompositeCommand{\`}{\LastDeclaredEncoding}{\textUpsilon}{Ὺ}
\DeclareTextCompositeCommand{\accdasia}{\LastDeclaredEncoding}{\textRho}{Ῥ}
\DeclareTextCompositeCommand{\accdialytikavaria}{\LastDeclaredEncoding}{\textcompwordmark}{῭}
\DeclareTextCompositeCommand{\accdialytikaoxia}{\LastDeclaredEncoding}{\textcompwordmark}{΅}

% \DeclareTextCompositeCommand{\`}{\LastDeclaredEncoding}{\textomega\ypogegrammeni}{ῲ}
% \DeclareTextCompositeCommand{\textomega}{\LastDeclaredEncoding}{\ypogegrammeni}{ῳ}
% \DeclareTextCompositeCommand{\'}{\LastDeclaredEncoding}{\textomega\ypogegrammeni}{ῴ}
\DeclareTextCompositeCommand{\~}{\LastDeclaredEncoding}{\textomega}{ῶ}
\DeclareTextCompositeCommand{\accperispomeni}{\LastDeclaredEncoding}{\textomega}{ῶ}
% \DeclareTextCompositeCommand{\accperispomeni}{\LastDeclaredEncoding}{\textomega\ypogegrammeni}{ῷ}
\DeclareTextCompositeCommand{\`}{\LastDeclaredEncoding}{\textOmicron}{Ὸ}
\DeclareTextCompositeCommand{\`}{\LastDeclaredEncoding}{\textOmega}{Ὼ}
% \DeclareTextCompositeCommand{\textOmega}{\LastDeclaredEncoding}{\prosgegrammeni}{ῼ}
\DeclareTextCompositeCommand{\accoxia}{\LastDeclaredEncoding}{\textcompwordmark}{´}
\DeclareTextCompositeCommand{\accdasia}{\LastDeclaredEncoding}{\textcompwordmark}{῾}

% Letterlike Symbols
% ~~~~~~~~~~~~~~~~~~
% ::

\DeclareTextCommand{\textohm}{\LastDeclaredEncoding}{Ω} % OHM SIGN

% Ancient Greek Numbers
% ~~~~~~~~~~~~~~~~~~~~~
% TODO: map other chars to corresponding Greek letters.
% See also the grnumalt_ package.
%
% Definition with literal Unicode characters, because the code-point has 5
% hexadecimal digits:
%
% ::

\DeclareTextCommand{\textpentedeka}{\LastDeclaredEncoding}{𐅄}    % GREEK ACROPHONIC ATTIC FIFTY
\DeclareTextCommand{\textpentehekaton}{\LastDeclaredEncoding}{𐅅} % GREEK ACROPHONIC ATTIC FIVE HUNDRED
\DeclareTextCommand{\textpenteqilioi}{\LastDeclaredEncoding}{𐅆}  % GREEK ACROPHONIC ATTIC FIVE THOUSAND
\DeclareTextCommand{\textpentemuria}{\LastDeclaredEncoding}{𐅇}   % GREEK ACROPHONIC ATTIC FIFTY THOUSAND


% UPPERCASE
% ~~~~~~~~~
%
% The `common Greek font encoding definitions`_ in ``greek-fontenc.def`` extend
% the `uclclist` with Greek LICR macros. Here, we add EU1 specific "hiatus"
% handling.
%
% Mark hiatus
% """""""""""
%
% Tonos and dasia mark a hiatus if placed on the
% first vowel of a diphthong (ΑΙ, ΑΥ, ΕΙ). A dialytika must be placed on the
% second vowel if they are dropped (άυλος → ΑΫΛΟΣ, μάινα → ΜΑΪΝΑ, κέικ → ΚΕΪΚ,
% ἀυπνία → ΑΫΠΝΙΑ).
%
% Look ahead and place a diaeresis on Ι or Υ
% (copied from lgrenc.def and changed Latin transcription to Unicode literals)::


\DeclareTextCommand{\LGR@A@hiatus}{\LastDeclaredEncoding}{%
  \LGR@ifnextchar{Ι}{\textAlpha\"}{%
    \LGR@ifnextchar{Υ}{\textAlpha\"}{%
      \LGR@ifnextchar{\textIota}{\textAlpha\"}{%
        \LGR@ifnextchar{\textUpsilon}{\textAlpha\"}{\textAlpha}%
      }%
    }%
  }%
}
\DeclareTextCommand{\LGR@E@hiatus}{\LastDeclaredEncoding}{%
  \LGR@ifnextchar{Ι}{\textEpsilon\"}{%
    \LGR@ifnextchar{Υ}{\textEpsilon\"}{%
      \LGR@ifnextchar{\textIota}{\textEpsilon\"}{%
        \LGR@ifnextchar{\textUpsilon}{\textEpsilon\"}{\textEpsilon}%
      }%
    }%
  }%
}

% .. References
%
% .. _LaTeX Project Public License: http://www.latex-project.org/lppl.txt
% .. _inputenc: http://www.ctan.org/pkg/inputenc
% .. _greek-fontenc: http://www.ctan.org/pkg/greek-fontenc
% .. _grnumalt: http://www.ctan.org/pkg/grnumalt
%
% .. _common Greek font encoding definitions: greek-fontenc.def.html
