SwiftUI:minimumScaleFactor不处理特殊字符,如&#x;或ý;

SwiftUI:minimumScaleFactor不处理特殊字符,如&#x;或ý;,swift,swiftui,Swift,Swiftui,我将字体设置为200,将minimumScaleFactor设置为0.01。当使用英文字符时,一切都能完美缩放。但当我尝试使用ýúáí或包含这些字符的某个句子时,缩放不正确。更奇怪的是,有时缩放在纵向模式下看起来很好,而在横向模式下看起来不好,在其他情况下反之亦然 我正在使用自定义字体,但没有找到使用.largeFont或其他方法的方法。除了我想要达到的目标,还有其他的方法吗 import SwiftUI struct TextScale: View { var body: some

我将字体设置为200,将minimumScaleFactor设置为0.01。当使用英文字符时,一切都能完美缩放。但当我尝试使用ýúáí或包含这些字符的某个句子时,缩放不正确。更奇怪的是,有时缩放在纵向模式下看起来很好,而在横向模式下看起来不好,在其他情况下反之亦然

我正在使用自定义字体,但没有找到使用.largeFont或其他方法的方法。除了我想要达到的目标,还有其他的方法吗

import SwiftUI

struct TextScale: View {
    var body: some View {
        GeometryReader { geo in
            VStack(spacing: 0) {
                Text("ýúáí!")
                    .font(.custom("Verdana-Bold", size: 200))
                    .lineLimit(1)
                    .minimumScaleFactor(0.01)
                    .foregroundColor(Color.white)
                    .frame(width: geo.size.width, height: geo.size.height/5, alignment: .center)
                .background(Color.green)

                Image(systemName: "camera")
                    .resizable()
                    .scaledToFit()
                    .frame(width: geo.size.width, height: 3*geo.size.height/5)
                    .background(Color.blue)

                HStack {
                    Image(systemName: "camera")
                        .resizable()
                        .scaledToFit()
                }
                .frame(width: geo.size.width, height: geo.size.height/5)
                //.padding(.bottom)
                .background(Color.orange)
            }

            .background(Color.gray)
        }
    }
}
struct TextScale_Previews: PreviewProvider {
    static var previews: some View {
        TextScale()
    }
}

改变你的布局策略。。。试一试

struct ContentView: View {
    var body: some View {
        GeometryReader { geo in
            VStack(spacing: 0) {
                Text("yáž!")
                    .font(.custom("Verdana-Bold", size: geo.size.height/9))
                    .lineLimit(1)
                    .foregroundColor(Color.white)
                    .frame(maxWidth: .infinity, maxHeight: .infinity)
                .background(Color.green)

                Image(systemName: "camera")
                    .resizable()
                    .scaledToFit()
                    .frame(width: geo.size.width, height: 3*geo.size.height/5)
                    .background(Color.blue)

                HStack {
                    Image(systemName: "camera")
                        .resizable()
                        .scaledToFit()
                }
                .frame(width: geo.size.width, height: geo.size.height/5)
                //.padding(.bottom)
                .background(Color.orange)
            }//.edgesIgnoringSafeArea(.all)

            .background(Color.gray)
        }
    }
}

改变你的布局策略。。。试一试

struct ContentView: View {
    var body: some View {
        GeometryReader { geo in
            VStack(spacing: 0) {
                Text("yáž!")
                    .font(.custom("Verdana-Bold", size: geo.size.height/9))
                    .lineLimit(1)
                    .foregroundColor(Color.white)
                    .frame(maxWidth: .infinity, maxHeight: .infinity)
                .background(Color.green)

                Image(systemName: "camera")
                    .resizable()
                    .scaledToFit()
                    .frame(width: geo.size.width, height: 3*geo.size.height/5)
                    .background(Color.blue)

                HStack {
                    Image(systemName: "camera")
                        .resizable()
                        .scaledToFit()
                }
                .frame(width: geo.size.width, height: geo.size.height/5)
                //.padding(.bottom)
                .background(Color.orange)
            }//.edgesIgnoringSafeArea(.all)

            .background(Color.gray)
        }
    }
}

你曾写道:“除了我正在努力实现的目标之外,还有其他途径吗?”。问题是:你想达到什么目的?通过使用minimumScaleFactor或使用其他工具使文本符合框架。你写道:“我想达到的目的是否存在替代方法?”。问题是:你想达到什么目的?通过使用minimumScaleFactor或其他方法使文本适合框架