Skip to content

Commit

Permalink
💄 Change font LXGWWenKaiLite to LXGWWenKaiScreen
Browse files Browse the repository at this point in the history
  • Loading branch information
tw93 committed May 22, 2024
1 parent 5e11e40 commit 5dae0d4
Show file tree
Hide file tree
Showing 12 changed files with 85 additions and 94 deletions.
58 changes: 29 additions & 29 deletions Mac/Base.lproj/Main.storyboard

Large diffs are not rendered by default.

14 changes: 13 additions & 1 deletion Mac/Helpers/UserDefaultsManagement.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public enum UserDefaultsManagement {
typealias Font = UIFont
#endif

static var DefaultFont = "LXGW WenKai Lite"
static var DefaultFont = "LXGW WenKai Screen"

static var DefaultFontSize = 15
static var DefaultPreviewFontSize = 15
Expand Down Expand Up @@ -298,6 +298,9 @@ public enum UserDefaultsManagement {
static var fontName: String {
get {
if let result = UserDefaults.standard.object(forKey: Constants.FontName) as? String {
if result == "LXGW WenKai Lite" {
return DefaultFont
}
return result
}
return DefaultFont
Expand All @@ -310,6 +313,9 @@ public enum UserDefaultsManagement {
static var windowFontName: String {
get {
if let result = UserDefaults.standard.object(forKey: Constants.WindowFontName) as? String {
if result == "LXGW WenKai Lite" {
return DefaultFont
}
return result
}
return DefaultFont
Expand All @@ -322,6 +328,9 @@ public enum UserDefaultsManagement {
static var previewFontName: String {
get {
if let result = UserDefaults.standard.object(forKey: Constants.PreviewFontName) as? String {
if result == "LXGW WenKai Lite" {
return DefaultFont
}
return result
}
return DefaultFont
Expand All @@ -334,6 +343,9 @@ public enum UserDefaultsManagement {
static var codeFontName: String {
get {
if let result = UserDefaults.standard.object(forKey: Constants.CodeFontNameKey) as? String {
if result == "LXGW WenKai Lite" {
return DefaultFont
}
return result
}
return DefaultFont
Expand Down
6 changes: 3 additions & 3 deletions Mac/PreferencesGeneralViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@ class PreferencesGeneralViewController: NSViewController {
func refreshPreview() {
guard let vc = ViewController.shared() else { return }
if UserDefaultsManagement.preview { vc.disablePreview() }

// PPT场景下使用预览会很难看
if !vc.isMiaoYanPPT() {
if !vc.isMiaoYanPPT(needToast: false) {
vc.enablePreview()
}
}
Expand Down Expand Up @@ -156,7 +156,7 @@ class PreferencesGeneralViewController: NSViewController {
UserDefaultsManagement.presentationFontSize = Int(item.title) ?? UserDefaultsManagement.DefaultPresentationFontSize

// PPT场景下使用预览会很难看
if !vc.isMiaoYanPPT() {
if !vc.isMiaoYanPPT(needToast: false) {
vc.disablePresentation()
vc.enablePresentation()
}
Expand Down
31 changes: 17 additions & 14 deletions Mac/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,7 @@ class ViewController:
editArea.isEditable = false

editArea.layoutManager?.defaultAttachmentScaling = .scaleProportionallyDown
if UserDefaultsManagement.fontName != "LXGW WenKai Lite" {
if UserDefaultsManagement.fontName != "LXGW WenKai Screen" {
editArea.layoutManager?.typesetterBehavior = .behavior_10_2_WithCompatibility
}
search.font = UserDefaultsManagement.searchFont
Expand Down Expand Up @@ -1982,7 +1982,7 @@ class ViewController:
DispatchQueue.main.asyncAfter(deadline: .now() + 0.05) {
vc.titleLabel.editModeOn()
}

updateTable {
DispatchQueue.main.async {
if let index = self.notesTableView.getIndex(note) {
Expand All @@ -1991,7 +1991,7 @@ class ViewController:
}
}
}

Analytics.trackEvent("MiaoYan NewNote")
}

Expand Down Expand Up @@ -2073,19 +2073,22 @@ class ViewController:
filteredNoteList = resorted
Analytics.trackEvent("MiaoYan Pin")
}

func isMiaoYanPPT() -> Bool {
if let note = notesTableView.getSelectedNote() {
let content = note.content.string
if content.contains("---") {
return true
} else {
toast(message: NSLocalizedString("😶‍🌫 No delimiter --- identification, Cannot use MiaoYan PPT~", comment: ""))
return false
}
} else {

func isMiaoYanPPT(needToast: Bool = true) -> Bool {
guard let note = notesTableView.getSelectedNote() else {
return false
}

let content = note.content.string
if content.contains("---") {
return true
}

if needToast {
toast(message: NSLocalizedString("😶‍🌫 No delimiter --- identification, Cannot use MiaoYan PPT~", comment: ""))
}

return false
}

func toggleMagicPPT() {
Expand Down
12 changes: 6 additions & 6 deletions Mac/ja.lproj/Main.strings
Original file line number Diff line number Diff line change
Expand Up @@ -218,8 +218,8 @@
/* Class = "NSMenu"; title = "Export"; ObjectID = "LoU-Gc-oM3"; */
"LoU-Gc-oM3.title" = "エクスポート";

/* Class = "NSMenuItem"; title = "LXGW WenKai Lite"; ObjectID = "Lx0-fl-9t0"; */
"Lx0-fl-9t0.title" = "LXGW WenKai Lite";
/* Class = "NSMenuItem"; title = "LXGW WenKai Screen"; ObjectID = "Lx0-fl-9t0"; */
"Lx0-fl-9t0.title" = "LXGW WenKai Screen";

/* Class = "NSMenuItem"; title = "Show All"; ObjectID = "M15-Xw-GpW"; */
"M15-Xw-GpW.title" = "すべて表示する";
Expand Down Expand Up @@ -272,8 +272,8 @@
/* Class = "NSMenuItem"; title = "13"; ObjectID = "Q3T-TQ-ewQ"; */
"Q3T-TQ-ewQ.title" = "13";

/* Class = "NSMenuItem"; title = "LXGW WenKai Lite"; ObjectID = "QwH-At-JGa"; */
"QwH-At-JGa.title" = "LXGW WenKai Lite";
/* Class = "NSMenuItem"; title = "LXGW WenKai Screen"; ObjectID = "QwH-At-JGa"; */
"QwH-At-JGa.title" = "LXGW WenKai Screen";

/* Class = "NSMenuItem"; title = "SF Pro Text"; ObjectID = "RSK-NX-AjP"; */
"RSK-NX-AjP.title" = "SF Pro Text";
Expand Down Expand Up @@ -314,8 +314,8 @@
/* Class = "NSMenuItem"; title = "Picsee"; ObjectID = "Tog-9P-3TK"; */
"Tog-9P-3TK.title" = "Picsee";

/* Class = "NSMenuItem"; title = "LXGW WenKai Lite"; ObjectID = "U0d-Y0-lbU"; */
"U0d-Y0-lbU.title" = "LXGW WenKai Lite";
/* Class = "NSMenuItem"; title = "LXGW WenKai Screen"; ObjectID = "U0d-Y0-lbU"; */
"U0d-Y0-lbU.title" = "LXGW WenKai Screen";

/* Class = "NSMenuItem"; title = "JetBrains Mono"; ObjectID = "U3E-6j-h9N"; */
"U3E-6j-h9N.title" = "JetBrains Mono";
Expand Down
12 changes: 6 additions & 6 deletions Mac/zh-Hant.lproj/Main.strings
Original file line number Diff line number Diff line change
Expand Up @@ -337,8 +337,8 @@
/* Class = "NSMenuItem"; title = "Yes"; ObjectID = "lra-33-O1F"; */
"lra-33-O1F.title" = "Yes";

/* Class = "NSMenuItem"; title = "LXGW WenKai Lite"; ObjectID = "Lx0-fl-9t0"; */
"Lx0-fl-9t0.title" = "LXGW WenKai Lite";
/* Class = "NSMenuItem"; title = "LXGW WenKai Screen"; ObjectID = "Lx0-fl-9t0"; */
"Lx0-fl-9t0.title" = "LXGW WenKai Screen";

/* Class = "NSMenuItem"; title = "Show All"; ObjectID = "M15-Xw-GpW"; */
"M15-Xw-GpW.title" = "顯示全部";
Expand Down Expand Up @@ -421,8 +421,8 @@
/* Class = "NSWindow"; title = "Window"; ObjectID = "qod-hp-9wd"; */
"qod-hp-9wd.title" = "視窗";

/* Class = "NSMenuItem"; title = "LXGW WenKai Lite"; ObjectID = "QwH-At-JGa"; */
"QwH-At-JGa.title" = "LXGW WenKai Lite";
/* Class = "NSMenuItem"; title = "LXGW WenKai Screen"; ObjectID = "QwH-At-JGa"; */
"QwH-At-JGa.title" = "LXGW WenKai Screen";

/* Class = "NSMenuItem"; title = "Main Window"; ObjectID = "qZf-Xp-kDW"; */
"qZf-Xp-kDW.title" = "主視窗";
Expand Down Expand Up @@ -481,8 +481,8 @@
/* Class = "NSMenuItem"; title = "Picsee"; ObjectID = "Tog-9P-3TK"; */
"Tog-9P-3TK.title" = "Picsee";

/* Class = "NSMenuItem"; title = "LXGW WenKai Lite"; ObjectID = "U0d-Y0-lbU"; */
"U0d-Y0-lbU.title" = "LXGW WenKai Lite";
/* Class = "NSMenuItem"; title = "LXGW WenKai Screen"; ObjectID = "U0d-Y0-lbU"; */
"U0d-Y0-lbU.title" = "LXGW WenKai Screen";

/* Class = "NSMenuItem"; title = "JetBrains Mono"; ObjectID = "U3E-6j-h9N"; */
"U3E-6j-h9N.title" = "JetBrains Mono";
Expand Down
12 changes: 4 additions & 8 deletions MiaoYan.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
/* Begin PBXBuildFile section */
1CC5664BA969B438568B7C05 /* Pods_MiaoYan.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 47543B75E5BE7E1CFD287CA1 /* Pods_MiaoYan.framework */; };
2714D861285196D70026BDE4 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 2714D863285196D70026BDE4 /* InfoPlist.strings */; };
271945F02BFE0F5400390DFF /* LXGWWenKaiScreen.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 271945EF2BFE0F5400390DFF /* LXGWWenKaiScreen.ttf */; };
271FD59D2A73DB9A001EA97B /* NSTextStorage+.swift in Sources */ = {isa = PBXBuildFile; fileRef = D72189352102099B00FE3AF2 /* NSTextStorage+.swift */; };
271FD59E2A73DB9A001EA97B /* DateFormatter+.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6F13BB2820FEDE230005E120 /* DateFormatter+.swift */; };
271FD59F2A73DB9A001EA97B /* String+.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6F13BB2920FEDE230005E120 /* String+.swift */; };
Expand All @@ -17,8 +18,6 @@
272ABB5F285F305600CCD651 /* SidebarProjectView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 272ABB5E285F305500CCD651 /* SidebarProjectView.swift */; };
272CAC1E287577E70026EF50 /* ContentViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 272CAC20287577E70026EF50 /* ContentViewController.xib */; };
272CAC2628758C6A0026EF50 /* ContentViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 272CAC2528758C6A0026EF50 /* ContentViewController.swift */; };
2747D5B4284E05CE00D0127B /* LXGWWenKaiLite-Regular.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 2747D5B1284E05CD00D0127B /* LXGWWenKaiLite-Regular.ttf */; };
2747D5B5284E05CE00D0127B /* LXGWWenKaiLite-Bold.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 2747D5B2284E05CE00D0127B /* LXGWWenKaiLite-Bold.ttf */; };
275592971F3AE9B5006B8988 /* MainWindowController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 275592961F3AE9B5006B8988 /* MainWindowController.swift */; };
277A61D8244B538F000F0033 /* SidebarTableRowView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 277A61D7244B538E000F0033 /* SidebarTableRowView.swift */; };
27838E68287521C0009E8012 /* DetachedWindowController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 27838E67287521C0009E8012 /* DetachedWindowController.swift */; };
Expand Down Expand Up @@ -152,13 +151,12 @@
260AEA7AD6D39CFD60C015CF /* Pods_MiaoYanCore_macOS.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_MiaoYanCore_macOS.framework; sourceTree = BUILT_PRODUCTS_DIR; };
2714D862285196D70026BDE4 /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/InfoPlist.strings"; sourceTree = "<group>"; };
2714D864285197CA0026BDE4 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; };
271945EF2BFE0F5400390DFF /* LXGWWenKaiScreen.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; path = LXGWWenKaiScreen.ttf; sourceTree = "<group>"; };
272ABB5E285F305500CCD651 /* SidebarProjectView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SidebarProjectView.swift; sourceTree = "<group>"; };
272CAC1F287577E70026EF50 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/ContentViewController.xib; sourceTree = "<group>"; };
272CAC22287577E90026EF50 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/ContentViewController.strings; sourceTree = "<group>"; };
272CAC24287577EB0026EF50 /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/ContentViewController.strings"; sourceTree = "<group>"; };
272CAC2528758C6A0026EF50 /* ContentViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ContentViewController.swift; sourceTree = "<group>"; };
2747D5B1284E05CD00D0127B /* LXGWWenKaiLite-Regular.ttf */ = {isa = PBXFileReference; lastKnownFileType = text; path = "LXGWWenKaiLite-Regular.ttf"; sourceTree = "<group>"; };
2747D5B2284E05CE00D0127B /* LXGWWenKaiLite-Bold.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "LXGWWenKaiLite-Bold.ttf"; sourceTree = "<group>"; };
275592961F3AE9B5006B8988 /* MainWindowController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainWindowController.swift; sourceTree = "<group>"; };
276CE9EE2997D34600280459 /* ja */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ja; path = ja.lproj/ContentViewController.strings; sourceTree = "<group>"; };
276CE9EF2997D34600280459 /* ja */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ja; path = ja.lproj/Main.strings; sourceTree = "<group>"; };
Expand Down Expand Up @@ -308,8 +306,7 @@
27A1AE302844BA83006DF055 /* Fonts */ = {
isa = PBXGroup;
children = (
2747D5B2284E05CE00D0127B /* LXGWWenKaiLite-Bold.ttf */,
2747D5B1284E05CD00D0127B /* LXGWWenKaiLite-Regular.ttf */,
271945EF2BFE0F5400390DFF /* LXGWWenKaiScreen.ttf */,
);
path = Fonts;
sourceTree = "<group>";
Expand Down Expand Up @@ -622,10 +619,9 @@
FFA664572A67FD4C004A3211 /* Localizable.strings in Resources */,
D7465F28207F2CD600E46A52 /* Images.xcassets in Resources */,
272CAC1E287577E70026EF50 /* ContentViewController.xib in Resources */,
2747D5B5284E05CE00D0127B /* LXGWWenKaiLite-Bold.ttf in Resources */,
D7ED6892200F87BD00FF975A /* Initial in Resources */,
2747D5B4284E05CE00D0127B /* LXGWWenKaiLite-Regular.ttf in Resources */,
D7FBBC2520F151F80014EC5B /* Localizable.strings in Resources */,
271945F02BFE0F5400390DFF /* LXGWWenKaiScreen.ttf in Resources */,
2714D861285196D70026BDE4 /* InfoPlist.strings in Resources */,
D7166F541F32F75E001A883F /* Main.storyboard in Resources */,
);
Expand Down
6 changes: 3 additions & 3 deletions Resources/DownView.bundle/css/heti.min.css
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
*/

:root {
--text-font: 'LXGW WenKai Lite', sans-serif;
--code-text-font: 'LXGW WenKai Lite', sans-serif;
--text-font: 'LXGW WenKai Screen', sans-serif;
--code-text-font: 'LXGW WenKai Screen', sans-serif;
--markmap-height: 300px;
}

Expand Down Expand Up @@ -74,7 +74,7 @@ a,

.heti {
font-weight: 400;
-webkit-font-smoothing: subpixel-antialiased;
-webkit-font-smoothing: antialiased;
line-height: 1.74;
letter-spacing: 0.04em;
overflow-wrap: break-word;
Expand Down
14 changes: 2 additions & 12 deletions Resources/DownView.bundle/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,9 @@
<title></title>
<style>
@font-face {
font-family: 'LXGW WenKai Lite';
font-style: normal;
font-weight: 800;
font-family: 'LXGW WenKai Screen';
font-display: fallback;
src: url('DOWN_FONT_PATH/LXGWWenKaiLite-Bold.ttf') format('truetype');
}

@font-face {
font-family: 'LXGW WenKai Lite';
font-style: normal;
font-weight: 400;
font-display: fallback;
src: url('DOWN_FONT_PATH/LXGWWenKaiLite-Regular.ttf') format('truetype');
src: url('DOWN_FONT_PATH/LXGWWenKaiScreen.ttf') format('truetype');
}

DOWN_CSS
Expand Down
14 changes: 2 additions & 12 deletions Resources/DownView.bundle/ppt.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,9 @@
<title></title>
<style>
@font-face {
font-family: 'LXGW WenKai Lite';
font-style: normal;
font-weight: 800;
font-family: 'LXGW WenKai Screen';
font-display: fallback;
src: url('DOWN_FONT_PATH/LXGWWenKaiLite-Bold.ttf') format('truetype');
}

@font-face {
font-family: 'LXGW WenKai Lite';
font-style: normal;
font-weight: 400;
font-display: fallback;
src: url('DOWN_FONT_PATH/LXGWWenKaiLite-Regular.ttf') format('truetype');
src: url('DOWN_FONT_PATH/LXGWWenKaiScreen.ttf') format('truetype');
}

DOWN_CSS
Expand Down
Binary file removed Resources/Fonts/LXGWWenKaiLite-Bold.ttf
Binary file not shown.
Binary file removed Resources/Fonts/LXGWWenKaiLite-Regular.ttf
Binary file not shown.

0 comments on commit 5dae0d4

Please sign in to comment.