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

Equation font size is wrong / canvas size dependent #1438

Closed
keenancrane opened this issue May 31, 2023 · 1 comment · Fixed by #1445
Closed

Equation font size is wrong / canvas size dependent #1438

keenancrane opened this issue May 31, 2023 · 1 comment · Fixed by #1445

Comments

@keenancrane
Copy link
Collaborator

image

Equation shapes (rendered via MathJax) do not yield the size requested in the fontSize field—the rendered size depends on the canvas size in the Style program. In contrast, Text shapes always get rendered at the proper size, independent of canvas dimensions.

Here's a complete example showing the issue (the Domain schema and Substance program are empty):

canvas {
    width = 10
    height = 8
}

global {
    shape plainText = Text {
        string: "A"
        fillColor: #0a0
        fontSize: "3px"
        fontFamily: "MathJax_Math"
    }
    shape plainTextLabel = Text {
        string: "Text"
        center: plainText.center - (0,1.75)
        fontSize: "1px"
        fillColor: plainText.fillColor
        fontFamily: "monospace"
    }

    shape mathText = Equation {
        string: "A"
        fillColor: #00a
        fontSize: "3px"
    }
    shape mathTextLabel = Text {
        string: "Equation"
        center: mathText.center - (0,3)
        fontSize: "1px"
        fillColor: mathText.fillColor
        fontFamily: "monospace"
    }

    ensure disjoint( mathText, plainText )
}
@wodeni
Copy link
Member

wodeni commented May 31, 2023

To repro this, I also need to download the MathJax_Math font and install it locally:
https://imathas.valenciacollege.edu/mathjax/fonts/HTML-CSS/TeX/otf/

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

Successfully merging a pull request may close this issue.

2 participants