3

I tried to add a substitution rule to the feature file from Defining an initial variant through a feature file, but the second (non-contextual) substitution only works if the first is commented out. It seems that different kinds of substitutions cannot be mixed without adding something. So the first question is what.

Secondly, what I really want to do is substitute theta1 for theta at the beginning of words, that is the opposite of what has been done with beta: the fourth line should equal the last. Presumably this should be achievable by

ignore sub @greekletter theta';
sub theta by theta1;

But it is not, at least not without iknownotwhat.

\documentclass{article}
\usepackage{fontspec,filecontents}

\begin{filecontents*}{junicode.fea}
languagesystem DFLT dflt;
languagesystem latn dflt;

@greekletter = [
Alphatonos anoteleia Epsilontonos Etatonos Iotatonos Omicrontonos Upsilontonos
Omegatonos iotadieresistonos Alpha Beta Gamma Delta Epsilon Zeta Eta Theta Iota
Kappa Lambda Mu Nu Xi Omicron Pi Rho Sigma Tau Upsilon Phi Chi Psi Omega
Iotadieresis Upsilondieresis alphatonos epsilontonos etatonos iotatonos
upsilondieresistonos alpha beta gamma delta epsilon zeta eta theta iota kappa
lambda mu nu xi omicron pi rho sigma1 sigma tau upsilon phi chi psi omega
iotadieresis upsilondieresis omicrontonos upsilontonos omegatonos uni03D0
theta1 phi1 omega1 uni03D7 uni03D8 uni03D9 uni03DA uni03DB uni03DC uni03DD
];

feature calt {
        sub @greekletter beta' by uni03D0;
        sub theta by theta1;
} calt;
\end{filecontents*}

\setmainfont[FeatureFile={junicode.fea},Contextuals=Alternate]{junicode}

\begin{document}
\addfontfeature{Contextuals=NoAlternate}
βιβλίον\par
\addfontfeature{Contextuals=Alternate}
βιβλίον\par
\addfontfeature{Contextuals=NoAlternate}
θαυμαστὸς ἅνθρωπος.\par
\addfontfeature{Contextuals=Alternate}
θαυμαστὸς ἅνθρωπος.

\addfontfeature{Script=Greek,Style=Alternate}%
θ%
\addfontfeature{RawFeature={-salt}}%
αυμαστὸς ἅνθρωπος.
\end{document}

enter image description here

3

According to The OpenType Cookbook, section Rules, subsection "Common Gotcha", the second rule also needs the apostrophe, when the lookup contains contextual tokens anywhere.

But even with apostrophe it is not working in LuaTeX 0.80. It might be a bug. A second bug revealed the use of ranges in @greekletters. Then I get numbers 15 right before the period.

The following double replacement seems to provide a workaround for the first problem, the second bug is avoided by specifying the glyph names explicitly without using ranges.

\documentclass{article}
\usepackage{fontspec,filecontents}

\begin{filecontents*}{junicode.fea}
languagesystem DFLT dflt;
languagesystem latn dflt;

@greekletter = [
    Alpha Alphatonos Beta Chi Delta Epsilon Epsilontonos Eta Etatonos
    Gamma Iota Iotadieresis Iotatonos Kappa Lambda Mu Nu Omega
    Omegatonos Omicron Omicrontonos Phi Pi Psi Rho Sigma Tau Theta
    Upsilon Upsilondieresis Upsilontonos Xi Zeta alpha alphatonos beta
    chi delta epsilon epsilontonos eta etatonos gamma iota iotadieresis
    iotadieresistonos iotatonos kappa lambda mu nu omega omega1
    omegatonos omicron omicrontonos phi phi1 pi psi rho sigma sigma1 tau
    theta theta1 uni03D0 uni03D7 uni03D8 uni03D9 uni03DA uni03DB uni03DC
    uni03DD uni03E0 uni03E1 uni03F0 uni03F1 uni1F00 uni1F01 uni1F02
    uni1F03 uni1F04 uni1F05 uni1F06 uni1F07 uni1F08 uni1F09 uni1F0A
    uni1F0B uni1F0C uni1F0D uni1F0E uni1F0F uni1F10 uni1F11 uni1F12
    uni1F13 uni1F14 uni1F15 uni1F18 uni1F19 uni1F1A uni1F1B uni1F1C
    uni1F1D uni1F20 uni1F21 uni1F22 uni1F23 uni1F24 uni1F25 uni1F26
    uni1F27 uni1F28 uni1F29 uni1F2A uni1F2B uni1F2C uni1F2D uni1F2E
    uni1F2F uni1F30 uni1F31 uni1F32 uni1F33 uni1F34 uni1F35 uni1F36
    uni1F37 uni1F38 uni1F39 uni1F3A uni1F3B uni1F3C uni1F3D uni1F3E
    uni1F3F uni1F40 uni1F41 uni1F42 uni1F43 uni1F44 uni1F45 uni1F48
    uni1F49 uni1F4A uni1F4B uni1F4C uni1F4D uni1F50 uni1F51 uni1F52
    uni1F53 uni1F54 uni1F55 uni1F56 uni1F57 uni1F59 uni1F5B uni1F5D
    uni1F5F uni1F60 uni1F61 uni1F62 uni1F63 uni1F64 uni1F65 uni1F66
    uni1F67 uni1F68 uni1F69 uni1F6A uni1F6B uni1F6C uni1F6D uni1F6E
    uni1F6F uni1F70 uni1F71 uni1F72 uni1F73 uni1F74 uni1F75 uni1F76
    uni1F77 uni1F78 uni1F79 uni1F7A uni1F7B uni1F7C uni1F7D uni1F80
    uni1F81 uni1F82 uni1F83 uni1F84 uni1F85 uni1F86 uni1F87 uni1F88
    uni1F89 uni1F8A uni1F8B uni1F8C uni1F8D uni1F8E uni1F8F uni1F90
    uni1F91 uni1F92 uni1F93 uni1F94 uni1F95 uni1F96 uni1F97 uni1F98
    uni1F99 uni1F9A uni1F9B uni1F9C uni1F9D uni1F9E uni1F9F uni1FA0
    uni1FA1 uni1FA2 uni1FA3 uni1FA4 uni1FA5 uni1FA6 uni1FA7 uni1FA8
    uni1FA9 uni1FAA uni1FAB uni1FAC uni1FAD uni1FAE uni1FAF uni1FB0
    uni1FB1 uni1FB2 uni1FB3 uni1FB4 uni1FB6 uni1FB7 uni1FB8 uni1FB9
    uni1FBA uni1FBB uni1FBC uni1FBE uni1FC2 uni1FC3 uni1FC4 uni1FC6
    uni1FC7 uni1FC8 uni1FC9 uni1FCA uni1FCB uni1FCC uni1FD0 uni1FD1
    uni1FD2 uni1FD3 uni1FD6 uni1FD7 uni1FD8 uni1FD9 uni1FDA uni1FDB
    uni1FE0 uni1FE1 uni1FE2 uni1FE3 uni1FE4 uni1FE5 uni1FE6 uni1FE7
    uni1FE8 uni1FE9 uni1FEA uni1FEB uni1FEC uni1FF2 uni1FF3 uni1FF4
    uni1FF6 uni1FF7 uni1FF8 uni1FF9 uni1FFA uni1FFB uni1FFC upsilon
    upsilondieresis upsilondieresistonos upsilontonos xi zeta
];

feature calt {
    # The following two lines don't work in LuaTeX 0.80
    #     ignore sub @greekletter theta';
    #     sub theta' by theta1;
    # Workaround:
    lookup replace_all_theta {
        sub theta by theta1;
    } replace_all_theta;
    lookup switch_inner_theta_back {
        sub @greekletter theta1' by theta;
    } switch_inner_theta_back;

    # Rule for replacing inner beta
    lookup inner_beta {
        sub @greekletter beta' by uni03D0;
    } inner_beta;
} calt;
\end{filecontents*}

\setmainfont[FeatureFile={junicode.fea},Contextuals=Alternate]{junicode}

\begin{document}
\addfontfeature{Contextuals=Alternate}
βιβλίον\par
θαυμαστὸς ἅνθρωπος.\par
\end{document}

Result

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.