From 8c32dc0addbf099caea219dcf1deb1e21dfbcb07 Mon Sep 17 00:00:00 2001 From: LEO Yoon-Tsaw Date: Mon, 8 May 2023 17:20:29 -0400 Subject: [PATCH] Add SourceHan for iOS and watch app --- Chinese Time.xcodeproj/project.pbxproj | 16 +++++++-- Shared/SourceHanSansKR-Heavy.otf | Bin 0 -> 6616 bytes Watch/Chinese-Time-Watch-Info.plist | 10 ++++++ Watch/ContentView.swift | 46 ++++++++++++------------- Watch/WatchFace.swift | 4 +-- iOS/Base.lproj/Main.storyboard | 3 +- iOS/Info.plist | 4 +++ iOS/Layout.swift | 2 +- iOS/ViewController.swift | 2 ++ iOS/layout.txt | 2 +- macOS/Info.plist | 2 ++ macOS/layout.txt | 4 +-- 12 files changed, 63 insertions(+), 32 deletions(-) create mode 100644 Shared/SourceHanSansKR-Heavy.otf create mode 100644 Watch/Chinese-Time-Watch-Info.plist diff --git a/Chinese Time.xcodeproj/project.pbxproj b/Chinese Time.xcodeproj/project.pbxproj index 8db3772..2703b64 100644 --- a/Chinese Time.xcodeproj/project.pbxproj +++ b/Chinese Time.xcodeproj/project.pbxproj @@ -7,6 +7,9 @@ objects = { /* Begin PBXBuildFile section */ + B301073D2A0999A900D0A50C /* SourceHanSansKR-Heavy.otf in Resources */ = {isa = PBXBuildFile; fileRef = B301073C2A0999A900D0A50C /* SourceHanSansKR-Heavy.otf */; }; + B301073E2A0999A900D0A50C /* SourceHanSansKR-Heavy.otf in Resources */ = {isa = PBXBuildFile; fileRef = B301073C2A0999A900D0A50C /* SourceHanSansKR-Heavy.otf */; }; + B30107402A09A0A500D0A50C /* SourceHanSansKR-Heavy.otf in Resources */ = {isa = PBXBuildFile; fileRef = B301073C2A0999A900D0A50C /* SourceHanSansKR-Heavy.otf */; }; B329909B296A1F7F00D246E9 /* layout.txt in Resources */ = {isa = PBXBuildFile; fileRef = B329909A296A1F7F00D246E9 /* layout.txt */; }; B33CC9BC29FB583B00426C92 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = B33CC9BE29FB583B00426C92 /* Main.storyboard */; }; B34DA20929FDC0B200562449 /* Utilities.swift in Sources */ = {isa = PBXBuildFile; fileRef = B34DA20829FDC0B200562449 /* Utilities.swift */; }; @@ -87,6 +90,8 @@ /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ + B301073C2A0999A900D0A50C /* SourceHanSansKR-Heavy.otf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "SourceHanSansKR-Heavy.otf"; sourceTree = ""; }; + B301073F2A099A0700D0A50C /* Chinese-Time-Watch-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "Chinese-Time-Watch-Info.plist"; sourceTree = ""; }; B329909A296A1F7F00D246E9 /* layout.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = layout.txt; sourceTree = ""; }; B34DA20829FDC0B200562449 /* Utilities.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = Utilities.swift; path = Shared/Utilities.swift; sourceTree = SOURCE_ROOT; }; B34DA20B29FDFE3800562449 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; @@ -199,6 +204,7 @@ B3515CFB29F614C900E6BCDC /* Shared */ = { isa = PBXGroup; children = ( + B301073C2A0999A900D0A50C /* SourceHanSansKR-Heavy.otf */, B3BFA2562A05E0590018F99E /* WatchConnectivity.swift */, D245D60826FA886200A89044 /* Model.swift */, D2CFF74C270FF940000CECDA /* PlanetModel.swift */, @@ -218,6 +224,7 @@ B39086002A0314DD00943F2B /* ChineseTimeApp.swift */, B36D2F782A047A2000005162 /* WatchFace.swift */, B39086022A0314DD00943F2B /* ContentView.swift */, + B301073F2A099A0700D0A50C /* Chinese-Time-Watch-Info.plist */, B39086192A03522800943F2B /* layout.txt */, B39086042A0314DD00943F2B /* Assets.xcassets */, B3BFA25F2A06BBA60018F99E /* Localizable.strings */, @@ -389,6 +396,7 @@ B3515CEF29F6149500E6BCDC /* LaunchScreen.storyboard in Resources */, B33CC9BC29FB583B00426C92 /* Main.storyboard in Resources */, B3515CF629F6149500E6BCDC /* Assets.xcassets in Resources */, + B301073D2A0999A900D0A50C /* SourceHanSansKR-Heavy.otf in Resources */, B3AF0B8E29FB658600C78081 /* InfoPlist.strings in Resources */, ); runOnlyForDeploymentPostprocessing = 0; @@ -401,6 +409,7 @@ B39086082A0314DD00943F2B /* Preview Assets.xcassets in Resources */, B390861A2A03522800943F2B /* layout.txt in Resources */, B3BFA25E2A06BBA60018F99E /* ChineseTime Watch App-InfoPlist.strings in Resources */, + B301073E2A0999A900D0A50C /* SourceHanSansKR-Heavy.otf in Resources */, B39086052A0314DD00943F2B /* Assets.xcassets in Resources */, ); runOnlyForDeploymentPostprocessing = 0; @@ -413,6 +422,7 @@ B329909B296A1F7F00D246E9 /* layout.txt in Resources */, B3AF0B9429FB658600C78081 /* InfoPlist.strings in Resources */, D2633073270CF85F0053B9F6 /* Main.storyboard in Resources */, + B30107402A09A0A500D0A50C /* SourceHanSansKR-Heavy.otf in Resources */, D2E4E0ED26F7C73F002F3716 /* Assets.xcassets in Resources */, ); runOnlyForDeploymentPostprocessing = 0; @@ -666,6 +676,7 @@ DEVELOPMENT_TEAM = 28HU5A7B46; ENABLE_PREVIEWS = YES; GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_FILE = "Watch/Chinese-Time-Watch-Info.plist"; INFOPLIST_KEY_NSLocationAlwaysAndWhenInUseUsageDescription = "提供定位可計算當前日出入、月出入時刻,不提供不影響使用其它功能。"; INFOPLIST_KEY_NSLocationUsageDescription = "提供定位可計算當前日出入、月出入時刻,不提供不影響使用其它功能。"; INFOPLIST_KEY_NSLocationWhenInUseUsageDescription = "提供定位可計算當前日出入、月出入時刻,不提供不影響使用其它功能。"; @@ -700,6 +711,7 @@ DEVELOPMENT_TEAM = 28HU5A7B46; ENABLE_PREVIEWS = YES; GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_FILE = "Watch/Chinese-Time-Watch-Info.plist"; INFOPLIST_KEY_NSLocationAlwaysAndWhenInUseUsageDescription = "提供定位可計算當前日出入、月出入時刻,不提供不影響使用其它功能。"; INFOPLIST_KEY_NSLocationUsageDescription = "提供定位可計算當前日出入、月出入時刻,不提供不影響使用其它功能。"; INFOPLIST_KEY_NSLocationWhenInUseUsageDescription = "提供定位可計算當前日出入、月出入時刻,不提供不影響使用其它功能。"; @@ -727,7 +739,7 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; - APP_BUILD = 67; + APP_BUILD = 68; APP_VERSION = 3.7; CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_ANALYZER_NONNULL = YES; @@ -795,7 +807,7 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; - APP_BUILD = 67; + APP_BUILD = 68; APP_VERSION = 3.7; CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_ANALYZER_NONNULL = YES; diff --git a/Shared/SourceHanSansKR-Heavy.otf b/Shared/SourceHanSansKR-Heavy.otf new file mode 100644 index 0000000000000000000000000000000000000000..56196bceb4e5aa001db1f00ea5a1bc25a10c832a GIT binary patch literal 6616 zcmbt3d0bRS(mf3G-h+Wr8J^65FeA5|DqbOYqi8T7f{HiSaLNF~AVLyAMNv@k041V; zAeS6+7&YoD-WX$IqH#5sCL0rX&Bi3g)Ej${uSVT(v%B9v`}^Mf`gK)xb#-@Db=9K? zkBSN>GEzjuBxdI9+3FMD51U8``Hc|ymXP`3k-=-`balE}U`WqYuv`u10)L zc%=W>CO$fV5Z;8xEDB!`BF;jHD3kHU#iz$+9(WqJfDpT_goq-NHL(e*b7NZwu`R;! z3CT#14sg>DHzMwuoUUKXj1hYvegg3s>9K1wiF!VQpgapJ@fgH25uZT_%2MM_h`AXNiA2LAGjeqC znmMuB$XIQ5=mOt4n%FgYrjZcAK^ReH+Y1Sc~=B^K1?)XPf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TlWFf1oX%W$RF@u>iDGn!}iPVb*I@DY=UbVAnMA*8(P72!oUxB;#Ee?2DcTB3fPh$wjWyePt91rr~Wj$S-3 z$Ai(g*%#wJ@p-z{WI~colZOAnh}9;&c&CsFX|dW^GGTSBUW=ChR~aTjC`X)$4WpZ= z8a-nz-eXTvN3t+dEhYB&Qz2xFErYy)SR_U-C5b>URg#6+ROsuW80{1$Swo5Fx93)- Uxb^(u;3SM&FXWq+dG(0?2R<>APyhe` literal 0 HcmV?d00001 diff --git a/Watch/Chinese-Time-Watch-Info.plist b/Watch/Chinese-Time-Watch-Info.plist new file mode 100644 index 0000000..3259ace --- /dev/null +++ b/Watch/Chinese-Time-Watch-Info.plist @@ -0,0 +1,10 @@ + + + + + UIAppFonts + + SourceHanSansKR-Heavy.otf + + + diff --git a/Watch/ContentView.swift b/Watch/ContentView.swift index cea633d..4f29e68 100644 --- a/Watch/ContentView.swift +++ b/Watch/ContentView.swift @@ -225,34 +225,34 @@ private func calSubhourGradient(watchLayout: WatchLayout, chineseCalendar: Chine return fourthRingColor } -private func allRingMarks(watchLayout: WatchLayout, chineseCalendar: ChineseCalendar, shortEdge: CGFloat) -> ([Marks], [Marks], [Marks], [Marks]) { +private func allRingMarks(watchLayout: WatchLayout, chineseCalendar: ChineseCalendar, radius: CGFloat) -> ([Marks], [Marks], [Marks], [Marks]) { let eventInMonth = chineseCalendar.eventInMonth - let firstRingMarks = [Marks(outer: true, locations: chineseCalendar.planetPosition, colors: watchLayout.planetIndicator, radius: Marks.markSize * shortEdge)] + let firstRingMarks = [Marks(outer: true, locations: chineseCalendar.planetPosition, colors: watchLayout.planetIndicator, radius: radius)] let secondRingMarks = [ - Marks(outer: true, locations: eventInMonth.eclipse, colors: [watchLayout.eclipseIndicator], radius: Marks.markSize * shortEdge), - Marks(outer: true, locations: eventInMonth.fullMoon, colors: [watchLayout.fullmoonIndicator], radius: Marks.markSize * shortEdge), - Marks(outer: true, locations: eventInMonth.oddSolarTerm, colors: [watchLayout.oddStermIndicator], radius: Marks.markSize * shortEdge), - Marks(outer: true, locations: eventInMonth.evenSolarTerm, colors: [watchLayout.evenStermIndicator], radius: Marks.markSize * shortEdge) + Marks(outer: true, locations: eventInMonth.eclipse, colors: [watchLayout.eclipseIndicator], radius: radius), + Marks(outer: true, locations: eventInMonth.fullMoon, colors: [watchLayout.fullmoonIndicator], radius: radius), + Marks(outer: true, locations: eventInMonth.oddSolarTerm, colors: [watchLayout.oddStermIndicator], radius: radius), + Marks(outer: true, locations: eventInMonth.evenSolarTerm, colors: [watchLayout.evenStermIndicator], radius: radius) ] let eventInDay = chineseCalendar.eventInDay let sunMoonPositions = chineseCalendar.sunMoonPositions let thirdRingMarks = [ - Marks(outer: true, locations: eventInDay.eclipse, colors: [watchLayout.eclipseIndicator], radius: Marks.markSize * shortEdge), - Marks(outer: true, locations: eventInDay.fullMoon, colors: [watchLayout.fullmoonIndicator], radius: Marks.markSize * shortEdge), - Marks(outer: true, locations: eventInDay.oddSolarTerm, colors: [watchLayout.oddStermIndicator], radius: Marks.markSize * shortEdge), - Marks(outer: true, locations: eventInDay.evenSolarTerm, colors: [watchLayout.evenStermIndicator], radius: Marks.markSize * shortEdge), - Marks(outer: false, locations: sunMoonPositions.solar, colors: watchLayout.sunPositionIndicator, radius: Marks.markSize * shortEdge), - Marks(outer: false, locations: sunMoonPositions.lunar, colors: watchLayout.moonPositionIndicator, radius: Marks.markSize * shortEdge) + Marks(outer: true, locations: eventInDay.eclipse, colors: [watchLayout.eclipseIndicator], radius: radius), + Marks(outer: true, locations: eventInDay.fullMoon, colors: [watchLayout.fullmoonIndicator], radius: radius), + Marks(outer: true, locations: eventInDay.oddSolarTerm, colors: [watchLayout.oddStermIndicator], radius: radius), + Marks(outer: true, locations: eventInDay.evenSolarTerm, colors: [watchLayout.evenStermIndicator], radius: radius), + Marks(outer: false, locations: sunMoonPositions.solar, colors: watchLayout.sunPositionIndicator, radius: radius), + Marks(outer: false, locations: sunMoonPositions.lunar, colors: watchLayout.moonPositionIndicator, radius: radius) ] let eventInHour = chineseCalendar.eventInHour let sunMoonSubhourPositions = chineseCalendar.sunMoonSubhourPositions let fourthRingMarks = [ - Marks(outer: true, locations: eventInHour.eclipse, colors: [watchLayout.eclipseIndicator], radius: Marks.markSize * shortEdge), - Marks(outer: true, locations: eventInHour.fullMoon, colors: [watchLayout.fullmoonIndicator], radius: Marks.markSize * shortEdge), - Marks(outer: true, locations: eventInHour.oddSolarTerm, colors: [watchLayout.oddStermIndicator], radius: Marks.markSize * shortEdge), - Marks(outer: true, locations: eventInHour.evenSolarTerm, colors: [watchLayout.evenStermIndicator], radius: Marks.markSize * shortEdge), - Marks(outer: false, locations: sunMoonSubhourPositions.solar, colors: watchLayout.sunPositionIndicator, radius: Marks.markSize * shortEdge), - Marks(outer: false, locations: sunMoonSubhourPositions.lunar, colors: watchLayout.moonPositionIndicator, radius: Marks.markSize * shortEdge) + Marks(outer: true, locations: eventInHour.eclipse, colors: [watchLayout.eclipseIndicator], radius: radius), + Marks(outer: true, locations: eventInHour.fullMoon, colors: [watchLayout.fullmoonIndicator], radius: radius), + Marks(outer: true, locations: eventInHour.oddSolarTerm, colors: [watchLayout.oddStermIndicator], radius: radius), + Marks(outer: true, locations: eventInHour.evenSolarTerm, colors: [watchLayout.evenStermIndicator], radius: radius), + Marks(outer: false, locations: sunMoonSubhourPositions.solar, colors: watchLayout.sunPositionIndicator, radius: radius), + Marks(outer: false, locations: sunMoonSubhourPositions.lunar, colors: watchLayout.moonPositionIndicator, radius: radius) ] return (first: firstRingMarks, second: secondRingMarks, third: thirdRingMarks, fourth: fourthRingMarks) } @@ -301,7 +301,7 @@ struct Watch: View { let _ = chineseCalendar.update(time: displayTime ?? Date(), timezone: timezone, location: location) let _ = chineseCalendar.updateDate() - let (firstRingMarks, secondRingMarks, thirdRingMarks, fourthRingMarks) = allRingMarks(watchLayout: watchLayout, chineseCalendar: chineseCalendar, shortEdge: shortEdge) + let (firstRingMarks, secondRingMarks, thirdRingMarks, fourthRingMarks) = allRingMarks(watchLayout: watchLayout, chineseCalendar: chineseCalendar, radius: Marks.markSize * shortEdge) let shadowDirection = chineseCalendar.currentHourInDay @@ -312,7 +312,7 @@ struct Watch: View { Ring(width: Ring.paddedWidth, viewSize: size, compact: compact, cornerSize: watchLayout.cornerRadiusRatio, ticks: chineseCalendar.dayTicks, startingAngle: phase.secondRing, angle: chineseCalendar.currentDayInMonth, textFont: watchLayout.textFont, textColor: watchLayout.fontColorDark, alpha: watchLayout.shadeAlpha, majorTickAlpha: watchLayout.majorTickAlpha, minorTickAlpha: watchLayout.minorTickAlpha, majorTickColor: watchLayout.majorTickColorDark, minorTickColor: watchLayout.minorTickColorDark, gradientColor: watchLayout.secondRing, outerRing: secondRingOuter, marks: secondRingMarks, shadowDirection: shadowDirection) Ring(width: Ring.paddedWidth, viewSize: size, compact: compact, cornerSize: watchLayout.cornerRadiusRatio, ticks: chineseCalendar.hourTicks, startingAngle: phase.thirdRing, angle: chineseCalendar.currentHourInDay, textFont: watchLayout.textFont, textColor: watchLayout.fontColorDark, alpha: watchLayout.shadeAlpha, majorTickAlpha: watchLayout.majorTickAlpha, minorTickAlpha: watchLayout.minorTickAlpha, majorTickColor: watchLayout.majorTickColorDark, minorTickColor: watchLayout.minorTickColorDark, gradientColor: watchLayout.thirdRing, outerRing: thirdRingOuter, marks: thirdRingMarks, shadowDirection: shadowDirection) Ring(width: Ring.paddedWidth, viewSize: size, compact: compact, cornerSize: watchLayout.cornerRadiusRatio, ticks: chineseCalendar.subhourTicks, startingAngle: phase.fourthRing, angle: chineseCalendar.subhourInHour, textFont: watchLayout.textFont, textColor: watchLayout.fontColorDark, alpha: watchLayout.shadeAlpha, majorTickAlpha: watchLayout.majorTickAlpha, minorTickAlpha: watchLayout.minorTickAlpha, majorTickColor: watchLayout.majorTickColorDark, minorTickColor: watchLayout.minorTickColorDark, gradientColor: fourthRingColor, outerRing: fourthRingOuter, marks: fourthRingMarks, shadowDirection: shadowDirection) - Core(viewSize: size, compact: compact, dateString: chineseCalendar.dateString, timeString: chineseCalendar.timeString, font: watchLayout.centerFont, maxLength: 5, textColor: watchLayout.centerFontColor, outerBound: innerBound, backColor: watchLayout.innerColorDark, centerOffset: watchLayout.centerTextOffset, shadowDirection: shadowDirection) + Core(viewSize: size, compact: compact, dateString: chineseCalendar.dateString, timeString: chineseCalendar.timeString, font: watchLayout.centerFont, maxLength: 5, textColor: watchLayout.centerFontColor, outerBound: innerBound, backColor: watchLayout.innerColorDark, centerOffset: 0.1, shadowDirection: shadowDirection) } .onAppear() { size = proxy.size @@ -369,7 +369,7 @@ struct DualWatch: View { let _ = chineseCalendar.update(time: displayTime ?? Date(), timezone: timezone, location: location) let _ = chineseCalendar.updateDate() - let (firstRingMarks, secondRingMarks, thirdRingMarks, fourthRingMarks) = allRingMarks(watchLayout: watchLayout, chineseCalendar: chineseCalendar, shortEdge: shortEdge) + let (firstRingMarks, secondRingMarks, thirdRingMarks, fourthRingMarks) = allRingMarks(watchLayout: watchLayout, chineseCalendar: chineseCalendar, radius: Marks.markSize * shortEdge * 1.5) let shadowDirection = chineseCalendar.currentHourInDay @@ -380,7 +380,7 @@ struct DualWatch: View { Ring(width: Ring.paddedWidth * 1.3, viewSize: size, compact: compact, cornerSize: watchLayout.cornerRadiusRatio, ticks: chineseCalendar.monthTicks, startingAngle: phase.firstRing, angle: chineseCalendar.currentDayInYear, textFont: watchLayout.textFont, textColor: watchLayout.fontColorDark, alpha: watchLayout.shadeAlpha, majorTickAlpha: watchLayout.majorTickAlpha, minorTickAlpha: watchLayout.minorTickAlpha, majorTickColor: watchLayout.majorTickColorDark, minorTickColor: watchLayout.minorTickColorDark, gradientColor: watchLayout.firstRing, outerRing: firstRingOuter, marks: firstRingMarks, shadowDirection: shadowDirection) Ring(width: Ring.paddedWidth * 1.3, viewSize: size, compact: compact, cornerSize: watchLayout.cornerRadiusRatio, ticks: chineseCalendar.dayTicks, startingAngle: phase.secondRing, angle: chineseCalendar.currentDayInMonth, textFont: watchLayout.textFont, textColor: watchLayout.fontColorDark, alpha: watchLayout.shadeAlpha, majorTickAlpha: watchLayout.majorTickAlpha, minorTickAlpha: watchLayout.minorTickAlpha, majorTickColor: watchLayout.majorTickColorDark, minorTickColor: watchLayout.minorTickColorDark, gradientColor: watchLayout.secondRing, outerRing: secondRingOuter, marks: secondRingMarks, shadowDirection: shadowDirection) - Core(viewSize: size, compact: compact, dateString: chineseCalendar.monthString, timeString: chineseCalendar.dayString, font: watchLayout.centerFont, maxLength: 3, textColor: watchLayout.centerFontColor, outerBound: innerBound, backColor: watchLayout.innerColorDark, centerOffset: watchLayout.centerTextOffset, shadowDirection: shadowDirection) + Core(viewSize: size, compact: compact, dateString: chineseCalendar.monthString, timeString: chineseCalendar.dayString, font: watchLayout.centerFont, maxLength: 3, textColor: watchLayout.centerFontColor, outerBound: innerBound, backColor: watchLayout.innerColorDark, centerOffset: 0.05, shadowDirection: shadowDirection) } .onAppear() { size = proxy.size @@ -392,7 +392,7 @@ struct DualWatch: View { Ring(width: Ring.paddedWidth * 1.3, viewSize: size, compact: compact, cornerSize: watchLayout.cornerRadiusRatio, ticks: chineseCalendar.hourTicks, startingAngle: phase.thirdRing, angle: chineseCalendar.currentHourInDay, textFont: watchLayout.textFont, textColor: watchLayout.fontColorDark, alpha: watchLayout.shadeAlpha, majorTickAlpha: watchLayout.majorTickAlpha, minorTickAlpha: watchLayout.minorTickAlpha, majorTickColor: watchLayout.majorTickColorDark, minorTickColor: watchLayout.minorTickColorDark, gradientColor: watchLayout.thirdRing, outerRing: firstRingOuter, marks: thirdRingMarks, shadowDirection: shadowDirection) Ring(width: Ring.paddedWidth * 1.3, viewSize: size, compact: compact, cornerSize: watchLayout.cornerRadiusRatio, ticks: chineseCalendar.subhourTicks, startingAngle: phase.fourthRing, angle: chineseCalendar.subhourInHour, textFont: watchLayout.textFont, textColor: watchLayout.fontColorDark, alpha: watchLayout.shadeAlpha, majorTickAlpha: watchLayout.majorTickAlpha, minorTickAlpha: watchLayout.minorTickAlpha, majorTickColor: watchLayout.majorTickColorDark, minorTickColor: watchLayout.minorTickColorDark, gradientColor: fourthRingColor, outerRing: secondRingOuter, marks: fourthRingMarks, shadowDirection: shadowDirection) - Core(viewSize: size, compact: compact, dateString: chineseCalendar.hourString, timeString: chineseCalendar.quarterString, font: watchLayout.centerFont, maxLength: 3, textColor: watchLayout.centerFontColor, outerBound: innerBound, backColor: watchLayout.innerColorDark, centerOffset: watchLayout.centerTextOffset, shadowDirection: shadowDirection) + Core(viewSize: size, compact: compact, dateString: chineseCalendar.hourString, timeString: chineseCalendar.quarterString, font: watchLayout.centerFont, maxLength: 3, textColor: watchLayout.centerFontColor, outerBound: innerBound, backColor: watchLayout.innerColorDark, centerOffset: 0.05, shadowDirection: shadowDirection) } .onAppear() { size = proxy.size diff --git a/Watch/WatchFace.swift b/Watch/WatchFace.swift index 709a698..f2d837c 100644 --- a/Watch/WatchFace.swift +++ b/Watch/WatchFace.swift @@ -17,7 +17,7 @@ class WatchLayout: MetaWatchLayout, ObservableObject { override init() { textFont = UIFont.systemFont(ofSize: UIFont.preferredFont(forTextStyle: .body).pointSize, weight: .regular) - centerFont = UIFont.systemFont(ofSize: UIFont.preferredFont(forTextStyle: .headline).pointSize, weight: .black) + centerFont = UIFont(name: "SourceHanSansKR-Heavy", size: UIFont.preferredFont(forTextStyle: .headline).pointSize)! super.init() } @@ -266,7 +266,7 @@ struct Core: View { for i in 0.. + @@ -279,7 +280,7 @@ diff --git a/iOS/Info.plist b/iOS/Info.plist index dd3c9af..b3b7927 100644 --- a/iOS/Info.plist +++ b/iOS/Info.plist @@ -2,6 +2,10 @@ + UIAppFonts + + SourceHanSansKR-Heavy.otf + UIApplicationSceneManifest UIApplicationSupportsMultipleScenes diff --git a/iOS/Layout.swift b/iOS/Layout.swift index 9bfb86b..3d4c9c6 100644 --- a/iOS/Layout.swift +++ b/iOS/Layout.swift @@ -13,7 +13,7 @@ class WatchLayout: MetaWatchLayout { override init() { textFont = UIFont.systemFont(ofSize: UIFont.systemFontSize, weight: .regular) - centerFont = UIFont.systemFont(ofSize: UIFont.systemFontSize, weight: .black) + centerFont = UIFont(name: "SourceHanSansKR-Heavy", size: UIFont.systemFontSize)! super.init() } } diff --git a/iOS/ViewController.swift b/iOS/ViewController.swift index 55fb129..d1b2ccf 100644 --- a/iOS/ViewController.swift +++ b/iOS/ViewController.swift @@ -101,6 +101,7 @@ class ViewController: UIViewController, UIGestureRecognizerDelegate { } class WelcomeViewController: UIViewController { + @IBOutlet weak var appName: UILabel! @IBOutlet weak var height: NSLayoutConstraint! @IBOutlet weak var watchFaceTop: NSLayoutConstraint! @IBOutlet weak var contentTop: NSLayoutConstraint! @@ -115,6 +116,7 @@ class WelcomeViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() + appName.font = UIFont.systemFont(ofSize: UIFont.preferredFont(forTextStyle: .largeTitle).pointSize, weight: .black) button.configuration?.cornerStyle = .large contentTop.constant = max(0.25 * self.view.bounds.height - 100, 20) watchFaceTop.constant = max(0.12 * self.view.bounds.height - 40, 10) diff --git a/iOS/layout.txt b/iOS/layout.txt index 8bc9b6c..b9ffa5c 100644 --- a/iOS/layout.txt +++ b/iOS/layout.txt @@ -27,7 +27,7 @@ evenStermIndicator: 0xFFFFFFFF sunPositionIndicator: 0xFF000000, 0xFFAAADFF, 0xFF0A36B1, 0xFF6EBCD3 moonPositionIndicator: 0xFFE6B8AF, 0xFFE56572, 0xFF9E1E67 shadeAlpha: 0.25 -centerTextOffset: -0.05 +centerTextOffset: 1.1 verticalTextOffset: -0.5 horizontalTextOffset: 0.0 watchWidth: 396.0 diff --git a/macOS/Info.plist b/macOS/Info.plist index 69a9db8..e9c1ec5 100644 --- a/macOS/Info.plist +++ b/macOS/Info.plist @@ -2,6 +2,8 @@ + ATSApplicationFontsPath + . CFBundleDevelopmentRegion $(DEVELOPMENT_LANGUAGE) CFBundleExecutable diff --git a/macOS/layout.txt b/macOS/layout.txt index 5b1cc1e..42589d5 100644 --- a/macOS/layout.txt +++ b/macOS/layout.txt @@ -28,8 +28,8 @@ sunPositionIndicator: 0xFF000000, 0xFFAAADFF, 0xFF0A36B1, 0xFF6EBCD3 moonPositionIndicator: 0xFFE6B8AF, 0xFFE56572, 0xFF9E1E67 shadeAlpha: 0.25 textFont: PingFangTC-Regular -centerFont: PingFangTC-Semibold -centerTextOffset: 1.1 +centerFont: SourceHanSansKR-Heavy +centerTextOffset: 1.15 verticalTextOffset: 0.95 horizontalTextOffset: 0.0 watchWidth: 396.0