From d866cca9cb86bff758f2d180ed4042af3666c59b Mon Sep 17 00:00:00 2001 From: Yuki Joou Date: Sun, 12 Nov 2023 01:14:44 +0100 Subject: [PATCH] Added enough features to do basic broad RP transcritptions --- src/ipa-sil.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/ipa-sil.cpp b/src/ipa-sil.cpp index 3f1badd..b1c2752 100644 --- a/src/ipa-sil.cpp +++ b/src/ipa-sil.cpp @@ -14,6 +14,9 @@ std::optional getIPAForSIL(std::string baseCharacter, { // TODO: Use a proper data structure, like a hash map // Even better: load that data off of a file! + + // TODO: Add more characters! This is only enough for narrow RP + // transcriptions... if (baseCharacter == "s") { if (silModifier == FcitxKey_equal) return "ʃ"; } @@ -42,6 +45,16 @@ std::optional getIPAForSIL(std::string baseCharacter, if (silModifier == FcitxKey_equal) return "ə"; } + if (baseCharacter == "a") { + if (silModifier == FcitxKey_less) return "æ"; + if (silModifier == FcitxKey_equal) return "ɑ"; + } + + if (baseCharacter == "o") { + if (silModifier == FcitxKey_less) return "ɔ"; + if (silModifier == FcitxKey_equal) return "ɒ"; + } + return {}; } @@ -53,6 +66,14 @@ bool isSILModifier(fcitx::KeySym key) void SILState::handleAlphaKey(fcitx::Key key) { + // TODO: Don't make this a special case, have a better system for handling + // this! + if (key.check(FcitxKey_colon)) { + m_buffer.type("ː"); + m_lastKey.reset(); + return; + } + if (!isSILModifier(key.sym()) || !m_lastKey.has_value()) { m_lastKey = key.toString(); m_buffer.type(key.sym());