Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TextField font style missing when it holding Japanese character

Tags:

swift

swiftui

Passing the String to a view

// Case 1: English alphabet is no problem
test(deck: "ABCDE")

// Case 2: Font style is missing
test(deck: "アイウエオ")

// Case 3: Font style is missing
test(deck: "ABCアイウエオDE")

Result: case1 enter image description here

Result: case2 enter image description here

Result: case3 enter image description here

Destination view: Store the string value in a text field

struct test: View {
    @State var deck : String = ""

    var body: some View {
        VStack {
            
            TextField("deck name", text: $deck)
                .font(.largeTitle)
                .foregroundColor(Color.black)
                .multilineTextAlignment(.center)
                .lineLimit(1)
        }

        
    }
}

As you can see, the font style not working properly when the text field holding Japanese Characters.

Thank you very much!

like image 353
karl Avatar asked Nov 24 '19 12:11

karl


1 Answers

It is bugged with the latest version of xCode and iOS. The problem only occurs when using a TextField. If you use a normal Text it works fine.

If I found a way to fix this I'll let you know. Till then you can't use a TextField with this set of characters.

like image 51
Tobias Hesselink Avatar answered Nov 03 '22 01:11

Tobias Hesselink