TDKCandidates // Unify the selection key font size.

This commit is contained in:
ShikiSuen 2022-10-01 17:49:11 +08:00
parent 502a8f12fb
commit 9beb643c01
2 changed files with 4 additions and 4 deletions

View File

@ -20,7 +20,7 @@ extension CandidateCellData {
VStack(spacing: 0) {
HStack(spacing: 4) {
if UserDefaults.standard.bool(forKey: UserDef.kHandleDefaultCandidateFontsByLangIdentifier.rawValue) {
Text(AttributedString(attributedStringHeader)).frame(width: CandidateCellData.unifiedSize * 2 / 3)
Text(AttributedString(attributedStringHeader))
Text(AttributedString(attributedString))
} else {
Text(key).font(.system(size: fontSizeKey).monospaced())

View File

@ -31,7 +31,7 @@ public class CandidateCellData: Hashable {
public var subIndex: Int = 0
public var fontSizeCandidate: Double { CandidateCellData.unifiedSize }
public var fontSizeKey: Double { ceil(CandidateCellData.unifiedSize * 0.8) }
public var fontSizeKey: Double { max(ceil(CandidateCellData.unifiedSize * 0.6), 11) }
public var fontColorKey: NSColor {
isSelected ? .selectedMenuItemTextColor.withAlphaComponent(0.8) : .secondaryLabelColor
}
@ -62,9 +62,9 @@ public class CandidateCellData: Hashable {
paraStyle.alignment = .natural
let theFontForCandidateKey: NSFont = {
if #available(macOS 10.15, *) {
return NSFont.monospacedSystemFont(ofSize: size * 0.7, weight: .regular)
return NSFont.monospacedSystemFont(ofSize: fontSizeKey, weight: .regular)
}
return NSFont.monospacedDigitSystemFont(ofSize: size * 0.7, weight: .regular)
return NSFont.monospacedDigitSystemFont(ofSize: fontSizeKey, weight: .regular)
}()
var attrKey: [NSAttributedString.Key: AnyObject] = [
.font: theFontForCandidateKey,