Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Text does not fit in view #37

Open
AtaberkKilinctekin opened this issue Dec 25, 2024 · 0 comments
Open

Text does not fit in view #37

AtaberkKilinctekin opened this issue Dec 25, 2024 · 0 comments

Comments

@AtaberkKilinctekin
Copy link

`struct MathView: UIViewRepresentable {
var equation: String
var font: MathFont = .firaFont
var textAlignment: MTTextAlignment = .left
var fontSize: CGFloat = 20
var labelMode: MTMathUILabelMode = .display
var insets: MTEdgeInsets = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 20)

func makeUIView(context: Context) -> MTMathUILabel {
	let view = MTMathUILabel()
	return view
}

func updateUIView(_ view: MTMathUILabel, context: Context) {
	view.latex = equation
	view.font = MTFontManager().font(withName: font.rawValue, size: fontSize)
	view.textAlignment = textAlignment
	view.labelMode = labelMode
	view.textColor = MTColor.primaryGreen
	view.contentInsets = insets
}

}`

Here is my code and the view looks like in the picture

Screenshot 2024-12-25 at 16 20 32

The question text is:

"18.\ \text{Harry wants to paint the side of his house. The total perimeter is 32 metres. What is the length of X?}\\\n\n19.\ \text{What is the area of the side of his house?}\\\n\n20.\ \text{Harry uses 3 litres of red paint, 4 litres of blue paint and 5 litres of white paint}\\\\\n\text{to paint the side of his house. What percentage of the paint was red?}"

Parent view has a frame. The code is complex so that I cannot provide all code here.

How can I solve this problem?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant