From 1e306e9916b65b07ec18037be93c597feb4fe478 Mon Sep 17 00:00:00 2001 From: ShikiSuen Date: Mon, 22 Aug 2022 08:14:38 +0800 Subject: [PATCH] IMKCandidates // Extend candidateFont(). --- .../UIModules/CandidateUI/ctlCandidateIMK.swift | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/Source/Modules/UIModules/CandidateUI/ctlCandidateIMK.swift b/Source/Modules/UIModules/CandidateUI/ctlCandidateIMK.swift index 253060d9..4334b328 100644 --- a/Source/Modules/UIModules/CandidateUI/ctlCandidateIMK.swift +++ b/Source/Modules/UIModules/CandidateUI/ctlCandidateIMK.swift @@ -57,7 +57,24 @@ public class ctlCandidateIMK: IMKCandidates, ctlCandidateProtocol { var attributes = attributes() // FB11300759: Set "NSAttributedString.Key.font" doesn't work. attributes?[NSAttributedString.Key.font] = candidateFont + if mgrPrefs.handleDefaultCandidateFontsByLangIdentifier { + switch IME.currentInputMode { + case InputMode.imeModeCHS: + if #available(macOS 12.0, *) { + attributes?[NSAttributedString.Key.languageIdentifier] = "zh-Hans" as AnyObject + } + case InputMode.imeModeCHT: + if #available(macOS 12.0, *) { + attributes?[NSAttributedString.Key.languageIdentifier] = + (mgrPrefs.shiftJISShinjitaiOutputEnabled || mgrPrefs.chineseConversionEnabled) + ? "ja" as AnyObject : "zh-Hant" as AnyObject + } + default: + break + } + } setAttributes(attributes) + update() } }