Skip to content

Use font-size in ex to match surrounding fonts rather than measuring ex-heights directly. #1438

@dpvc

Description

@dpvc

Something like

<style>
.mjx-chtml {font-size: 2.26ex ! important}
.mjx-chtml .mjx-chtml {font-size: inherit ! important}
</style>

works for CommonHTML output, and something similar could be used for HTML-CSS and PreviewHTML as well. This would avoid having to measure em and ex heights (though a corresponding adjustment would need to be made for text with mtextInheritFont set). This should also resolve some problems with mobile devices that change the font size after the page is loaded (and after MathJax has already measured the size), causing the math to be scaled incorrectly for the new font size.

Note that for HTML-CSS, each of the different web fonts would require a different scaling factor (since their em-to-ex ratios differ, and this font-size is the em-size divided by the ex-height).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions