Fix ligatures vs. \tt (#1379)

* Fix ligatures not always triggering

Example: \text{\rm --} would not cause ligature but should

* Remove ligatures in \texttt mode

* Add screenshot tests

* Fix MathML ligatures

* Fix type

* Handle \text... fonts in MathML building

* Remove leftover console deubgging
This commit is contained in:
Erik Demaine
2018-06-04 20:29:25 -04:00
committed by Kevin Barabash
parent 4f9851fb0c
commit 1e645198f7
12 changed files with 232 additions and 29 deletions

View File

@@ -1,5 +1,86 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`A MathML builder \\text fonts become mathvariant 1`] = `
<math>
<semantics>
<mrow>
<mtext>
roman
</mtext>
<mrow>
<mtext mathvariant="italic">
italic
</mtext>
<mrow>
<mtext mathvariant="bold-italic">
bold
</mtext>
<mtext>
</mtext>
<mtext mathvariant="bold-italic">
italic
</mtext>
</mrow>
</mrow>
<mtext mathvariant="bold">
bold
</mtext>
<mrow>
<mtext mathvariant="sans-serif">
ss
</mtext>
<mrow>
<mtext mathvariant="sans-serif-italic">
italic
</mtext>
<mrow>
<mtext mathvariant="sans-serif-bold-italic">
bold
</mtext>
<mtext>
</mtext>
<mtext mathvariant="sans-serif-bold-italic">
italic
</mtext>
</mrow>
</mrow>
<mtext mathvariant="bold-sans-serif">
bold
</mtext>
</mrow>
<mrow>
<mtext mathvariant="monospace">
tt
</mtext>
<mrow>
<mtext mathvariant="monospace">
italic
</mtext>
<mrow>
<mtext mathvariant="monospace">
bold
</mtext>
<mtext>
</mtext>
<mtext mathvariant="monospace">
italic
</mtext>
</mrow>
</mrow>
<mtext mathvariant="monospace">
bold
</mtext>
</mrow>
</mrow>
<annotation encoding="application/x-tex">
\\text{roman\\textit{italic\\textbf{bold italic}}\\textbf{bold}\\textsf{ss\\textit{italic\\textbf{bold italic}}\\textbf{bold}}\\texttt{tt\\textit{italic\\textbf{bold italic}}\\textbf{bold}}}
</annotation>
</semantics>
</math>
`;
exports[`A MathML builder accents turn into <mover accent="true"> in MathML 1`] = `
<math>
@@ -57,6 +138,52 @@ exports[`A MathML builder accents turn into <mover accent="true"> in MathML 1`]
`;
exports[`A MathML builder ligatures render properly 1`] = `
<math>
<semantics>
<mrow>
<mtext>
Hi—-”’
</mtext>
<mo>
</mo>
<mo>
</mo>
<mtext mathvariant="monospace">
\`\`Hi----&#x27;&#x27;
</mtext>
<mrow>
<mtext>
\`\`
</mtext>
<mtext mathvariant="monospace">
Hi
</mtext>
<mtext>
---
</mtext>
<mtext mathvariant="monospace">
-
</mtext>
<mtext>
&#x27;&#x27;
</mtext>
<mtext mathvariant="monospace">
</mtext>
</mrow>
</mrow>
<annotation encoding="application/x-tex">
\\text{\`\`\`Hi----&#x27;&#x27;&#x27;}--\\texttt{\`\`\`Hi----&#x27;&#x27;&#x27;}\\text{\\tt \`\`\`Hi----&#x27;&#x27;&#x27;}
</annotation>
</semantics>
</math>
`;
exports[`A MathML builder normal spaces render normally 1`] = `
<math>