Stacking text commands (#1009)

* Adding support for SansSerif-Bold

* Updating to include SansSerif Italic.

* WIP

* Working text stacking

* More robust screenshot.

* Don't want to break users :)

* Updating per PR comments.

* Fixing Unicode and updating snapshots.

* Adding suggested tests.

* Opting to use old method for unit testing.

* Adding TODO
This commit is contained in:
Ryan Randall
2017-12-13 09:10:23 -05:00
committed by Kevin Barabash
parent cf23517499
commit 50765a0ccd
15 changed files with 533 additions and 48 deletions

View File

@@ -1585,7 +1585,7 @@ describe("An HTML font tree-builder", function() {
it("should render \\text{R} with the correct font", function() {
const markup = katex.renderToString("\\text{R}");
expect(markup).toContain("<span class=\"mord mathrm\">R</span>");
expect(markup).toContain("<span class=\"mord\">R</span>");
});
it("should render \\textit{R} with the correct font", function() {
@@ -1600,24 +1600,41 @@ describe("An HTML font tree-builder", function() {
it("should render \\text{R\\textit{S}T} with the correct fonts", function() {
const markup = katex.renderToString("\\text{R\\textit{S}T}");
expect(markup).toContain("<span class=\"mord mathrm\">R</span>");
expect(markup).toContain("<span class=\"mord\">R</span>");
expect(markup).toContain("<span class=\"mord textit\">S</span>");
expect(markup).toContain("<span class=\"mord mathrm\">T</span>");
expect(markup).toContain("<span class=\"mord\">T</span>");
});
it("should render \\textbf{R} with the correct font", function() {
const markup = katex.renderToString("\\textbf{R}");
expect(markup).toContain("<span class=\"mord mathbf\">R</span>");
expect(markup).toContain("<span class=\"mord textbf\">R</span>");
});
it("should render \\textsf{R} with the correct font", function() {
const markup = katex.renderToString("\\textsf{R}");
expect(markup).toContain("<span class=\"mord mathsf\">R</span>");
expect(markup).toContain("<span class=\"mord textsf\">R</span>");
});
it("should render \\textsf{\\textit{R}G\\textbf{B}} with the correct font", function() {
const markup = katex.renderToString("\\textsf{\\textit{R}G\\textbf{B}}");
expect(markup).toContain("<span class=\"mord textsf textit\">R</span>");
expect(markup).toContain("<span class=\"mord textsf\">G</span>");
expect(markup).toContain("<span class=\"mord textsf textbf\">B</span>");
});
it("should render \\textsf{\\textbf{$\\mathrm{A}$}} with the correct font", function() {
const markup = katex.renderToString("\\textsf{\\textbf{$\\mathrm{A}$}}");
expect(markup).toContain("<span class=\"mord mathrm\">A</span>");
});
it("should render \\textsf{\\textbf{$\\mathrm{\\textsf{A}}$}} with the correct font", function() {
const markup = katex.renderToString("\\textsf{\\textbf{$\\mathrm{\\textsf{A}}$}}");
expect(markup).toContain("<span class=\"mord textsf textbf\">A</span>");
});
it("should render \\texttt{R} with the correct font", function() {
const markup = katex.renderToString("\\texttt{R}");
expect(markup).toContain("<span class=\"mord mathtt\">R</span>");
expect(markup).toContain("<span class=\"mord texttt\">R</span>");
});
it("should render a combination of font and color changes", function() {