diff --git a/Installer/pkgPostInstall.sh b/Installer/pkgPostInstall.sh
deleted file mode 100644
index 737f7c4a..00000000
--- a/Installer/pkgPostInstall.sh
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/bin/sh
-killall vChewing
-rm -rf ~/Library/Input\ Methods/vChewing.app
diff --git a/Installer/pkgPreInstall.sh b/Installer/pkgPreInstall.sh
new file mode 100644
index 00000000..82d041b5
--- /dev/null
+++ b/Installer/pkgPreInstall.sh
@@ -0,0 +1,9 @@
+#!/bin/sh
+killall vChewing
+rm -rf ~/Library/Input\ Methods/vChewing.app
+rm -rf ~/Library/Keyboard\ Layouts/vChewingKeyLayout.bundle
+rm -rf ~/Library/Keyboard\ Layouts/vChewing\ Dachen.keylayout
+rm -rf ~/Library/Keyboard\ Layouts/vChewing\ ETen.keylayout
+rm -rf ~/Library/Keyboard\ Layouts/vChewing\ FakeSeigyou.keylayout
+rm -rf ~/Library/Keyboard\ Layouts/vChewing\ IBM.keylayout
+rm -rf ~/Library/Keyboard\ Layouts/vChewing\ MiTAC.keylayout
diff --git a/Source/3rdParty/AWFileHash/AWFileHash.h b/Source/3rdParty/AWFileHash/AWFileHash.h
index 904aeebf..8fe9346b 100644
--- a/Source/3rdParty/AWFileHash/AWFileHash.h
+++ b/Source/3rdParty/AWFileHash/AWFileHash.h
@@ -20,12 +20,10 @@ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR TH
@interface AWFileHash : NSObject
-+ (NSString *)md5HashOfData:(NSData *)data;
+ (NSString *)sha1HashOfData:(NSData *)data;
+ (NSString *)sha512HashOfData:(NSData *)data;
+ (NSString *)crc32HashOfData:(NSData *)data;
-+ (NSString *)md5HashOfFileAtPath:(NSString *)filePath;
+ (NSString *)sha1HashOfFileAtPath:(NSString *)filePath;
+ (NSString *)sha512HashOfFileAtPath:(NSString *)filePath;
+ (NSString *)crc32HashOfFileAtPath:(NSString *)filePath;
diff --git a/Source/3rdParty/AWFileHash/AWFileHash.m b/Source/3rdParty/AWFileHash/AWFileHash.m
index ab3282ca..ed3a89f5 100644
--- a/Source/3rdParty/AWFileHash/AWFileHash.m
+++ b/Source/3rdParty/AWFileHash/AWFileHash.m
@@ -307,11 +307,7 @@ int CC_CRC32_Final(unsigned char *md, CC_CRC32_CTX *c) {
#pragma mark -
#pragma mark public class accessors
-+ (NSString *)md5HashOfData:(NSData *)data {
- FileHashComputationContext context;
- FileHashComputationContextInitialize(context, MD5);
- return [self hashOfNSData:data withComputationContext:&context];
-}
+
+ (NSString *)sha1HashOfData:(NSData *)data {
FileHashComputationContext context;
@@ -331,12 +327,6 @@ int CC_CRC32_Final(unsigned char *md, CC_CRC32_CTX *c) {
return [self hashOfNSData:data withComputationContext:&context];
}
-+ (NSString *)md5HashOfFileAtPath:(NSString *)filePath {
- FileHashComputationContext context;
- FileHashComputationContextInitialize(context, MD5);
- return [self hashOfFileAtPath:filePath withComputationContext:&context];
-}
-
+ (NSString *)sha1HashOfFileAtPath:(NSString *)filePath {
FileHashComputationContext context;
FileHashComputationContextInitialize(context, SHA1);
diff --git a/Source/Data b/Source/Data
index ed8e8f37..e7785674 160000
--- a/Source/Data
+++ b/Source/Data
@@ -1 +1 @@
-Subproject commit ed8e8f37aeff477a242f4ad345d5b2cfa85e0cf0
+Subproject commit e7785674095589d8d35a54f9ad3920d26d39a448
diff --git a/Source/Modules/AppDelegate.swift b/Source/Modules/AppDelegate.swift
index c0e51087..4f9aca18 100644
--- a/Source/Modules/AppDelegate.swift
+++ b/Source/Modules/AppDelegate.swift
@@ -299,4 +299,19 @@ class AppDelegate: NSObject, NSApplicationDelegate, ctlNonModalAlertWindowDelega
NSLog("vChewingErrorCallback: %@", strPrint)
}
}
+ @objc static func isDarkMode() -> Bool {
+ if #available(macOS 10.15, *) {
+ let appearanceDescription = NSApplication.shared.effectiveAppearance.debugDescription.lowercased()
+ if appearanceDescription.contains("dark") {
+ return true
+ }
+ } else if #available(macOS 10.14, *) {
+ if let appleInterfaceStyle = UserDefaults.standard.object(forKey: "AppleInterfaceStyle") as? String {
+ if appleInterfaceStyle.lowercased().contains("dark") {
+ return true
+ }
+ }
+ }
+ return false
+ }
}
diff --git a/Source/Modules/IMEModules/ctlInputMethod.swift b/Source/Modules/IMEModules/ctlInputMethod.swift
index 9b306bbf..ae1f6a90 100644
--- a/Source/Modules/IMEModules/ctlInputMethod.swift
+++ b/Source/Modules/IMEModules/ctlInputMethod.swift
@@ -563,7 +563,9 @@ extension ctlInputMethod {
func candidateFont(name: String?, size: CGFloat) -> NSFont {
let currentMUIFont = (keyHandler.inputMode == InputMode.imeModeCHS) ? "Sarasa Term Slab SC" : "Sarasa Term Slab TC"
- let finalReturnFont = NSFont(name: currentMUIFont, size: size) ?? NSFont.systemFont(ofSize: size)
+ var finalReturnFont = NSFont(name: currentMUIFont, size: size) ?? NSFont.systemFont(ofSize: size)
+ // 對更紗黑體的依賴到 macOS 11 Big Sur 為止。macOS 12 Monterey 開始則依賴系統內建的函數使用蘋方來處理。
+ if #available(macOS 12.0, *) {finalReturnFont = NSFont.systemFont(ofSize: size)}
if let name = name {
return NSFont(name: name, size: size) ?? finalReturnFont
}
diff --git a/Source/UI/CandidateUI/HorizontalCandidateController.swift b/Source/UI/CandidateUI/HorizontalCandidateController.swift
index a8faeb52..5a67a587 100644
--- a/Source/UI/CandidateUI/HorizontalCandidateController.swift
+++ b/Source/UI/CandidateUI/HorizontalCandidateController.swift
@@ -118,12 +118,13 @@ fileprivate class HorizontalCandidateView: NSView {
var activeCandidateIndexAttr = keyLabelAttrDict
var activeCandidateAttr = candidateAttrDict
if index == highlightedIndex {
+ let colorBlendAmount: CGFloat = IME.isDarkMode() ? 0.25 : 0
// The background color of the highlightened candidate
switch ctlInputMethod.currentKeyHandler.inputMode {
case InputMode.imeModeCHS:
- NSColor.systemRed.withAlphaComponent(0.75).setFill()
+ NSColor.systemRed.blended(withFraction: colorBlendAmount, of: NSColor.controlBackgroundColor)!.setFill()
case InputMode.imeModeCHT:
- NSColor.systemBlue.withAlphaComponent(0.75).setFill()
+ NSColor.systemBlue.blended(withFraction: colorBlendAmount, of: NSColor.controlBackgroundColor)!.setFill()
default:
NSColor.alternateSelectedControlColor.setFill()
}
@@ -132,6 +133,14 @@ fileprivate class HorizontalCandidateView: NSView {
} else {
NSColor.controlBackgroundColor.setFill()
}
+ switch ctlInputMethod.currentKeyHandler.inputMode {
+ case InputMode.imeModeCHS:
+ if #available(macOS 12.0, *) {activeCandidateAttr[.languageIdentifier] = "zh-Hans" as AnyObject}
+ case InputMode.imeModeCHT:
+ if #available(macOS 12.0, *) {activeCandidateAttr[.languageIdentifier] = "zh-Hant" as AnyObject}
+ default:
+ break
+ }
NSBezierPath.fill(rctCandidateArea)
(keyLabels[index] as NSString).draw(in: rctLabel, withAttributes: activeCandidateIndexAttr)
(displayedCandidates[index] as NSString).draw(in: rctCandidatePhrase, withAttributes: activeCandidateAttr)
diff --git a/Source/UI/CandidateUI/VerticalCandidateController.swift b/Source/UI/CandidateUI/VerticalCandidateController.swift
index 64b67eae..386aa2a7 100644
--- a/Source/UI/CandidateUI/VerticalCandidateController.swift
+++ b/Source/UI/CandidateUI/VerticalCandidateController.swift
@@ -124,12 +124,13 @@ fileprivate class VerticalCandidateView: NSView {
var activeCandidateIndexAttr = keyLabelAttrDict
var activeCandidateAttr = candidateAttrDict
if index == highlightedIndex {
+ let colorBlendAmount: CGFloat = IME.isDarkMode() ? 0.25 : 0
// The background color of the highlightened candidate
switch ctlInputMethod.currentKeyHandler.inputMode {
case InputMode.imeModeCHS:
- NSColor.systemRed.withAlphaComponent(0.75).setFill()
+ NSColor.systemRed.blended(withFraction: colorBlendAmount, of: NSColor.controlBackgroundColor)!.setFill()
case InputMode.imeModeCHT:
- NSColor.systemBlue.withAlphaComponent(0.75).setFill()
+ NSColor.systemBlue.blended(withFraction: colorBlendAmount, of: NSColor.controlBackgroundColor)!.setFill()
default:
NSColor.alternateSelectedControlColor.setFill()
}
@@ -138,6 +139,14 @@ fileprivate class VerticalCandidateView: NSView {
} else {
NSColor.controlBackgroundColor.setFill()
}
+ switch ctlInputMethod.currentKeyHandler.inputMode {
+ case InputMode.imeModeCHS:
+ if #available(macOS 12.0, *) {activeCandidateAttr[.languageIdentifier] = "zh-Hans" as AnyObject}
+ case InputMode.imeModeCHT:
+ if #available(macOS 12.0, *) {activeCandidateAttr[.languageIdentifier] = "zh-Hant" as AnyObject}
+ default:
+ break
+ }
NSBezierPath.fill(rctCandidateArea)
(keyLabels[index] as NSString).draw(in: rctLabel, withAttributes: activeCandidateIndexAttr)
(displayedCandidates[index] as NSString).draw(in: rctCandidatePhrase, withAttributes: activeCandidateAttr)
diff --git a/UserPhraseEditor/StringExtension.swift b/UserPhraseEditor/StringExtension.swift
index fc3ca498..0db07ae6 100644
--- a/UserPhraseEditor/StringExtension.swift
+++ b/UserPhraseEditor/StringExtension.swift
@@ -222,6 +222,7 @@ extension String {
varLineData.regReplace(pattern: "cai", replaceWith: "ㄘㄞ")
varLineData.regReplace(pattern: "can", replaceWith: "ㄘㄢ")
varLineData.regReplace(pattern: "cao", replaceWith: "ㄘㄠ")
+ varLineData.regReplace(pattern: "cei", replaceWith: "ㄘㄟ")
varLineData.regReplace(pattern: "cen", replaceWith: "ㄘㄣ")
varLineData.regReplace(pattern: "cha", replaceWith: "ㄔㄚ")
varLineData.regReplace(pattern: "che", replaceWith: "ㄔㄜ")
diff --git a/vChewing.pkgproj b/vChewing.pkgproj
index 8d355fef..9e79e755 100644
--- a/vChewing.pkgproj
+++ b/vChewing.pkgproj
@@ -52,6 +52,22 @@
UID
0
+
+ CHILDREN
+
+ GID
+ 0
+ PATH
+ Audio
+ PATH_TYPE
+ 0
+ PERMISSIONS
+ 493
+ TYPE
+ 1
+ UID
+ 0
+
CHILDREN
@@ -68,6 +84,22 @@
UID
0
+
+ CHILDREN
+
+ GID
+ 0
+ PATH
+ ColorPickers
+ PATH_TYPE
+ 0
+ PERMISSIONS
+ 493
+ TYPE
+ 1
+ UID
+ 0
+
CHILDREN
@@ -116,6 +148,22 @@
UID
0
+
+ CHILDREN
+
+ GID
+ 80
+ PATH
+ Fonts
+ PATH_TYPE
+ 0
+ PERMISSIONS
+ 1021
+ TYPE
+ 1
+ UID
+ 0
+
CHILDREN
@@ -524,6 +572,56 @@
UID
0
+
+ CHILDREN
+
+
+ CHILDREN
+
+
+ CHILDREN
+
+ GID
+ 0
+ PATH
+ Extensions
+ PATH_TYPE
+ 0
+ PERMISSIONS
+ 493
+ TYPE
+ 1
+ UID
+ 0
+
+
+ GID
+ 0
+ PATH
+ Library
+ PATH_TYPE
+ 0
+ PERMISSIONS
+ 493
+ TYPE
+ 1
+ UID
+ 0
+
+
+ GID
+ 0
+ PATH
+ System
+ PATH_TYPE
+ 0
+ PERMISSIONS
+ 493
+ TYPE
+ 1
+ UID
+ 0
+
CHILDREN
@@ -594,7 +692,7 @@
PREINSTALL_PATH
PATH
- Installer/pkgPostInstall.sh
+ Installer/pkgPreInstall.sh
PATH_TYPE
1
@@ -846,11 +944,11 @@
LANGUAGE
- Simplified Chinese
+ Traditional Chinese
VALUE
PATH
- LICENSE-CHS.txt
+ LICENSE-CHT.txt
PATH_TYPE
1
@@ -868,11 +966,11 @@
LANGUAGE
- Traditional Chinese
+ Simplified Chinese
VALUE
PATH
- LICENSE-CHT.txt
+ LICENSE-CHS.txt
PATH_TYPE
1
@@ -903,9 +1001,9 @@
LANGUAGE
- Traditional Chinese
+ Simplified Chinese
VALUE
- 威注音輸入法
+ 威注音输入法
LANGUAGE
@@ -915,9 +1013,9 @@
LANGUAGE
- Simplified Chinese
+ Traditional Chinese
VALUE
- 威注音输入法
+ 威注音輸入法
@@ -954,11 +1052,11 @@
LANGUAGE
- Traditional Chinese
+ Simplified Chinese
SECONDARY_VALUE
- 至少 macOS 10.11.5 方可滿足威注音對系統內的萬國碼版本支援的需要。
+ 至少 macOS 10.11.5 方可满足威注音对系统内的万国码版本支援的需要。
VALUE
- 作業系統版本太舊
+ 作业系统版本太旧
LANGUAGE
@@ -970,11 +1068,11 @@
LANGUAGE
- Simplified Chinese
+ Traditional Chinese
SECONDARY_VALUE
- 至少 macOS 10.11.5 方可满足威注音对系统内的万国码版本支援的需要。
+ 至少 macOS 10.11.5 方可滿足威注音對系統內的萬國碼版本支援的需要。
VALUE
- 作业系统版本太旧
+ 作業系統版本太舊
NAME