일본어 폰트 NotoSansJP로 변경

This commit is contained in:
Yu Sung
2026-01-26 11:37:40 +09:00
parent 091f90dee6
commit d0a17739a1
7 changed files with 36 additions and 5 deletions

View File

@@ -251,6 +251,10 @@
<string>Pretendard-Medium.otf</string> <string>Pretendard-Medium.otf</string>
<string>Pretendard-Light.otf</string> <string>Pretendard-Light.otf</string>
<string>Pretendard-Regular.otf</string> <string>Pretendard-Regular.otf</string>
<string>NotoSansJP-Bold.ttf</string>
<string>NotoSansJP-Medium.ttf</string>
<string>NotoSansJP-Light.ttf</string>
<string>NotoSansJP-Regular.ttf</string>
</array> </array>
<key>UIBackgroundModes</key> <key>UIBackgroundModes</key>
<array> <array>

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -251,6 +251,10 @@
<string>Pretendard-Medium.otf</string> <string>Pretendard-Medium.otf</string>
<string>Pretendard-Light.otf</string> <string>Pretendard-Light.otf</string>
<string>Pretendard-Regular.otf</string> <string>Pretendard-Regular.otf</string>
<string>NotoSansJP-Bold.ttf</string>
<string>NotoSansJP-Medium.ttf</string>
<string>NotoSansJP-Light.ttf</string>
<string>NotoSansJP-Regular.ttf</string>
</array> </array>
<key>UIBackgroundModes</key> <key>UIBackgroundModes</key>
<array> <array>

View File

@@ -16,7 +16,7 @@ private func resolvedLanguageCode(currentLocale: Locale) -> String? {
return currentLocale.language.languageCode?.identifier return currentLocale.language.languageCode?.identifier
} }
private func appFontName(for weight: SwiftUI.Font.Weight) -> String { private func koreanFontName(for weight: SwiftUI.Font.Weight) -> String {
switch weight { switch weight {
case .bold: case .bold:
return "Pretendard-Bold" return "Pretendard-Bold"
@@ -29,15 +29,33 @@ private func appFontName(for weight: SwiftUI.Font.Weight) -> String {
} }
} }
private func japaneseFontName(for weight: SwiftUI.Font.Weight) -> String {
switch weight {
case .bold:
return "NotoSansJP-Bold"
case .medium:
return "NotoSansJP-Medium"
case .light:
return "NotoSansJP-Light"
default:
return "NotoSansJP-Regular"
}
}
struct KoreanFontModifier: ViewModifier { struct KoreanFontModifier: ViewModifier {
@Environment(\.locale) private var locale @Environment(\.locale) private var locale
let size: CGFloat let size: CGFloat
let weight: SwiftUI.Font.Weight let weight: SwiftUI.Font.Weight
func body(content: Content) -> some View { func body(content: Content) -> some View {
if resolvedLanguageCode(currentLocale: locale) == "ko" { switch resolvedLanguageCode(currentLocale: locale) {
content.font(.custom(appFontName(for: weight), size: size)) case "ko":
} else { content.font(.custom(koreanFontName(for: weight), size: size))
case "ja":
content.font(.custom(japaneseFontName(for: weight), size: size))
default:
content.font(.system(size: size, weight: weight)) content.font(.system(size: size, weight: weight))
} }
} }
@@ -52,8 +70,13 @@ extension View {
extension Text { extension Text {
func appFont(size: CGFloat, weight: SwiftUI.Font.Weight = .regular) -> Text { func appFont(size: CGFloat, weight: SwiftUI.Font.Weight = .regular) -> Text {
if resolvedLanguageCode(currentLocale: .autoupdatingCurrent) == "ko" { if resolvedLanguageCode(currentLocale: .autoupdatingCurrent) == "ko" {
return self.font(.custom(appFontName(for: weight), size: size)) return self.font(.custom(koreanFontName(for: weight), size: size))
} }
if resolvedLanguageCode(currentLocale: .autoupdatingCurrent) == "ja" {
return self.font(.custom(japaneseFontName(for: weight), size: size))
}
return self.font(.system(size: size, weight: weight)) return self.font(.system(size: size, weight: weight))
} }
} }