gpt4 book ai didi

html - HTML5 中的 MathML : changing math font

转载 作者:太空宇宙 更新时间:2023-11-04 15:18:35 25 4
gpt4 key购买 nike

假设我有一个 HTML5 文档,其中包含一些 MathML。我设置了页面正文的字体,但它不会更改用于 MathML 字符的字体:

<!DOCTYPE html>
<html lang="en">
<head>
<title>Example of MathML embedded in an HTML5 file</title>
<meta charset="utf-8" />
</head>
<body style="font-family: courier;">
Quadratic formula
<math><mrow>
<mi>x</mi>
<mo>=</mo>
<mfrac>
<mrow>
<mo form="prefix">−</mo>
<mi>b</mi>
<mo>&PlusMinus;</mo>
<msqrt>
<msup>
<mi>b</mi>
<mn>2</mn>
</msup>
<mo>−</mo>
<mn>4</mn>
<mo>&InvisibleTimes;</mo>
<mi>a</mi>
<mo>&InvisibleTimes;</mo>
<mi>c</mi>
</msqrt>
</mrow>
<mrow>
<mn>2</mn>
<mo>&InvisibleTimes;</mo>
<mi>a</mi>
</mrow>
</mfrac>
</mrow></math>
</body>
</html>

这将在 courier 中显示文本“Quadratic formula”,但 MathML 保留默认页面字体。如何更改用于 MathML 的字体?

最佳答案

您可能应该阅读 this document在 Mozilla 开发者网络上。我猜以下段落适用于您的情况:

Mathematical formulas make use of various symbols represented by specific Unicode characters. Mozilla can display any of these symbols provided suitable Unicode fonts are installed. Furthermore, in accordance with the W3C CSS2 recommendation on fonts, authors can specify an ordered list of particular fonts which they prefer (using the font-family property of CSS), with the assurance that Mozilla's font engine will hunt for alternate fonts whenever their specified fonts are not found on a particular user's system.

其中一位 Mozilla MathML 开发人员似乎经常写博客。您可能会对最近的两篇文章感兴趣:

  1. Installation of mathematical fonts
  2. About mathematical fonts

结果似乎是,为了保证 MathML 的良好呈现,您需要您的用户安装 MathJax , STIXAsana Math字体。

关于html - HTML5 中的 MathML : changing math font,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11833164/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com