TDKCandidates // Unify the selection key font size.
This commit is contained in:
parent
502a8f12fb
commit
9beb643c01
|
@ -20,7 +20,7 @@ extension CandidateCellData {
|
||||||
VStack(spacing: 0) {
|
VStack(spacing: 0) {
|
||||||
HStack(spacing: 4) {
|
HStack(spacing: 4) {
|
||||||
if UserDefaults.standard.bool(forKey: UserDef.kHandleDefaultCandidateFontsByLangIdentifier.rawValue) {
|
if UserDefaults.standard.bool(forKey: UserDef.kHandleDefaultCandidateFontsByLangIdentifier.rawValue) {
|
||||||
Text(AttributedString(attributedStringHeader)).frame(width: CandidateCellData.unifiedSize * 2 / 3)
|
Text(AttributedString(attributedStringHeader))
|
||||||
Text(AttributedString(attributedString))
|
Text(AttributedString(attributedString))
|
||||||
} else {
|
} else {
|
||||||
Text(key).font(.system(size: fontSizeKey).monospaced())
|
Text(key).font(.system(size: fontSizeKey).monospaced())
|
||||||
|
|
|
@ -31,7 +31,7 @@ public class CandidateCellData: Hashable {
|
||||||
public var subIndex: Int = 0
|
public var subIndex: Int = 0
|
||||||
|
|
||||||
public var fontSizeCandidate: Double { CandidateCellData.unifiedSize }
|
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 {
|
public var fontColorKey: NSColor {
|
||||||
isSelected ? .selectedMenuItemTextColor.withAlphaComponent(0.8) : .secondaryLabelColor
|
isSelected ? .selectedMenuItemTextColor.withAlphaComponent(0.8) : .secondaryLabelColor
|
||||||
}
|
}
|
||||||
|
@ -62,9 +62,9 @@ public class CandidateCellData: Hashable {
|
||||||
paraStyle.alignment = .natural
|
paraStyle.alignment = .natural
|
||||||
let theFontForCandidateKey: NSFont = {
|
let theFontForCandidateKey: NSFont = {
|
||||||
if #available(macOS 10.15, *) {
|
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] = [
|
var attrKey: [NSAttributedString.Key: AnyObject] = [
|
||||||
.font: theFontForCandidateKey,
|
.font: theFontForCandidateKey,
|
||||||
|
|
Loading…
Reference in New Issue