일본어 폰트 NotoSansJP로 변경
This commit is contained in:
@@ -251,6 +251,10 @@
|
||||
<string>Pretendard-Medium.otf</string>
|
||||
<string>Pretendard-Light.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>
|
||||
<key>UIBackgroundModes</key>
|
||||
<array>
|
||||
|
||||
BIN
SodaLive/Resources/Font/NotoSansJP-Bold.ttf
Executable file
BIN
SodaLive/Resources/Font/NotoSansJP-Bold.ttf
Executable file
Binary file not shown.
BIN
SodaLive/Resources/Font/NotoSansJP-Light.ttf
Executable file
BIN
SodaLive/Resources/Font/NotoSansJP-Light.ttf
Executable file
Binary file not shown.
BIN
SodaLive/Resources/Font/NotoSansJP-Medium.ttf
Executable file
BIN
SodaLive/Resources/Font/NotoSansJP-Medium.ttf
Executable file
Binary file not shown.
BIN
SodaLive/Resources/Font/NotoSansJP-Regular.ttf
Executable file
BIN
SodaLive/Resources/Font/NotoSansJP-Regular.ttf
Executable file
Binary file not shown.
@@ -251,6 +251,10 @@
|
||||
<string>Pretendard-Medium.otf</string>
|
||||
<string>Pretendard-Light.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>
|
||||
<key>UIBackgroundModes</key>
|
||||
<array>
|
||||
|
||||
@@ -16,7 +16,7 @@ private func resolvedLanguageCode(currentLocale: Locale) -> String? {
|
||||
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 {
|
||||
case .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 {
|
||||
@Environment(\.locale) private var locale
|
||||
let size: CGFloat
|
||||
let weight: SwiftUI.Font.Weight
|
||||
|
||||
func body(content: Content) -> some View {
|
||||
if resolvedLanguageCode(currentLocale: locale) == "ko" {
|
||||
content.font(.custom(appFontName(for: weight), size: size))
|
||||
} else {
|
||||
switch resolvedLanguageCode(currentLocale: locale) {
|
||||
case "ko":
|
||||
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))
|
||||
}
|
||||
}
|
||||
@@ -52,8 +70,13 @@ extension View {
|
||||
extension Text {
|
||||
func appFont(size: CGFloat, weight: SwiftUI.Font.Weight = .regular) -> Text {
|
||||
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))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user