Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Implement \pmb via CSS text-shadow (#3505)
* Fix: Implement \pmb via CSS text-shadow * Update screen shots Co-authored-by: ylemkimon <y@ylem.kim>
- Loading branch information
Showing
9 changed files
with
58 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
// @flow | ||
import defineFunction, {ordargument} from "../defineFunction"; | ||
import buildCommon from "../buildCommon"; | ||
import mathMLTree from "../mathMLTree"; | ||
import * as html from "../buildHTML"; | ||
import * as mml from "../buildMathML"; | ||
import {binrelClass} from "./mclass"; | ||
|
||
import type {ParseNode} from "../parseNode"; | ||
|
||
// \pmb is a simulation of bold font. | ||
// The version of \pmb in ambsy.sty works by typesetting three copies | ||
// with small offsets. We use CSS text-shadow. | ||
// It's a hack. Not as good as a real bold font. Better than nothing. | ||
|
||
defineFunction({ | ||
type: "pmb", | ||
names: ["\\pmb"], | ||
props: { | ||
numArgs: 1, | ||
allowedInText: true, | ||
}, | ||
handler({parser}, args) { | ||
return { | ||
type: "pmb", | ||
mode: parser.mode, | ||
mclass: binrelClass(args[0]), | ||
body: ordargument(args[0]), | ||
}; | ||
}, | ||
htmlBuilder(group: ParseNode<"pmb">, options) { | ||
const elements = html.buildExpression(group.body, options, true); | ||
const node = buildCommon.makeSpan([group.mclass], elements, options); | ||
node.style.textShadow = "0.02em 0.01em 0.04px"; | ||
return node; | ||
}, | ||
mathmlBuilder(group: ParseNode<"pmb">, style) { | ||
const inner = mml.buildExpression(group.body, style); | ||
// Wrap with an <mstyle> element. | ||
const node = new mathMLTree.MathNode("mstyle", inner); | ||
node.setAttribute("style", "text-shadow: 0.02em 0.01em 0.04px"); | ||
return node; | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.