일본어 폰트 NotoSansJP로 변경
This commit is contained in:
@@ -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>
|
||||||
|
|||||||
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-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>
|
||||||
|
|||||||
@@ -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))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user