Skip to content

[BUG] Problem with localized texts #70

Closed

Description

@yeahsilver

Hello! firstly, thank you for sharing this useful library.

I’m using this library to render LaTeX formulas in SwiftUI, and it’s working great overall. However, I’ve encountered an issue when rendering localized text (korean for me) text alongside formulas.

For example, when rendering something like Text("키를 입력하세요") (which means “Please enter height”) followed by a rendered LaTeX SVG image, the Korean text gets partially overlapped or clipped by the formula image.

After investigating, I suspect this might be due to how SVGGeometry handles the viewBox or vertical-align styles. It seems to work fine with Latin fonts, but Korean fonts typically have a larger x-height or vertical spacing, which results in the formula being rendered too low and interfering with the text.

Is there a recommended way to adjust for this — for example, by modifying the baseline offset when rendering SVGs next to languages like Korean that require more vertical space?

Thank you in advance!

Image

Activity

  1. Andrew-Jang commented on Oct 21, 2025

    @Andrew-Jang

    Same problem

  2. colinc86 commented on Apr 3, 2026

    @colinc86
    Owner

    I've added two ways of addressing this with the v2.0.0 update:

    1. If you include the prescriptive text in the LaTeX view like LaTeX("키를 입력하세요: $BMI=$") then you can use the .script(.cjk) modifier to properly adjust height in respect to baseline.
    2. If you want to continue using a separate leading Text view, then you can use the .script(.custom(0.77)) to specify what multiple is applied to xHeight when drawing the view to match the text in adjacent view.

    I hope this helps!! If there's anything that might work better please let me know.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions