From 3cba0ca87f121f363eb26fc7cc1d9b53e2e38f0f Mon Sep 17 00:00:00 2001 From: ShikiSuen Date: Thu, 27 Oct 2022 16:18:34 +0800 Subject: [PATCH] Tekkon // Update romaji buffer display when necessary. (#204) --- .../Sources/Tekkon/Tekkon_SyllableComposer.swift | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Packages/vChewing_Tekkon/Sources/Tekkon/Tekkon_SyllableComposer.swift b/Packages/vChewing_Tekkon/Sources/Tekkon/Tekkon_SyllableComposer.swift index 4c1abc11..860dac24 100644 --- a/Packages/vChewing_Tekkon/Sources/Tekkon/Tekkon_SyllableComposer.swift +++ b/Packages/vChewing_Tekkon/Sources/Tekkon/Tekkon_SyllableComposer.swift @@ -30,7 +30,7 @@ extension Tekkon { /// 聲調。 public var intonation: Phonabet = "" - /// 為拉丁字母專用的組音區。 + /// 拼音組音區。 public var romajiBuffer: String = "" /// 注音排列種類。預設情況下是大千排列(Windows / macOS 預設注音排列)。 @@ -158,6 +158,11 @@ extension Tekkon { return false } + /// 按需更新拼音組音區的內容顯示。 + mutating func updateRomajiBuffer() { + romajiBuffer = Tekkon.cnvPhonaToHanyuPinyin(target: consonant.value + semivowel.value + vowel.value) + } + /// 接受傳入的按鍵訊號時的處理,處理對象為 String。 /// 另有同名函式可處理 UniChar 訊號。 /// @@ -232,6 +237,7 @@ extension Tekkon { case .intonation: intonation = thePhone default: break } + updateRomajiBuffer() } /// 處理一連串的按鍵輸入。