Skip to content

Instantly share code, notes, and snippets.

@Koze
Created May 8, 2020 16:39
Show Gist options
  • Save Koze/e32b833b2150313f4637414b2b76da0d to your computer and use it in GitHub Desktop.
Save Koze/e32b833b2150313f4637414b2b76da0d to your computer and use it in GitHub Desktop.
Japanese font without Japanese character causes the clip at the bottom. A quick workaround.
import SwiftUI
struct SmapleView: View {
let font = Font.custom("HiraginoSans-W3", size: 50)
let uiFont = UIFont(name: "HiraginoSans-W3", size: 50)!
let borderColor = Color(.systemBlue)
var body: some View {
HStack(spacing: 10) {
Text("Copy")
.font(font)
.border(borderColor)
Text("Copy")
.font(font)
.baselineOffset(-uiFont.descender)
.border(borderColor)
}
}
}
struct SmapleView_Previews: PreviewProvider {
static var previews: some View {
SmapleView()
}
}
@Koze
Copy link
Author

Koze commented May 8, 2020

Screenshot 2020-05-09 1 41 47

@Koze
Copy link
Author

Koze commented May 8, 2020

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment