From ccb5468dc798dab2fd097fdb7bf1eed4d73b1412 Mon Sep 17 00:00:00 2001 From: ShikiSuen Date: Mon, 22 Aug 2022 07:56:51 +0800 Subject: [PATCH] ctlIME // Make candidateFont() static. --- .../ControllerModules/ctlInputMethod_HandleDisplay.swift | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Source/Modules/ControllerModules/ctlInputMethod_HandleDisplay.swift b/Source/Modules/ControllerModules/ctlInputMethod_HandleDisplay.swift index 7ab40ee9..eb9b734a 100644 --- a/Source/Modules/ControllerModules/ctlInputMethod_HandleDisplay.swift +++ b/Source/Modules/ControllerModules/ctlInputMethod_HandleDisplay.swift @@ -91,7 +91,7 @@ extension ctlInputMethod { ctlInputMethod.ctlCandidateCurrent.keyLabelFont = labelFont( name: mgrPrefs.candidateKeyLabelFontName, size: keyLabelSize ) - ctlInputMethod.ctlCandidateCurrent.candidateFont = candidateFont( + ctlInputMethod.ctlCandidateCurrent.candidateFont = ctlInputMethod.candidateFont( name: mgrPrefs.candidateTextFontName, size: textSize ) @@ -168,7 +168,7 @@ extension ctlInputMethod { /// 5) Do NOT enable either KangXi conversion mode nor JIS conversion mode. They are disabled by default. /// 6) Expecting the glyph differences of the candidate "骨" between PingFang SC and PingFang TC when rendering /// the candidate window in different "vChewing-CHS" and "vChewing-CHT" input modes. - func candidateFont(name: String?, size: CGFloat) -> NSFont { + static func candidateFont(name: String? = nil, size: CGFloat) -> NSFont { let finalReturnFont: NSFont = { switch IME.currentInputMode { @@ -183,7 +183,7 @@ extension ctlInputMethod { } }() ?? NSFont.systemFont(ofSize: size) - if let name = name { + if let name = name, !name.isEmpty { return NSFont(name: name, size: size) ?? finalReturnFont } return finalReturnFont