Fix font choice in operators like \log (e.g. \boldsymbol{\log}) (#2041)

* Fix font choice in operators like \log (e.g. \boldsymbol{\log})

Fix #1971 by correctly passing arguments into the font choice for
the HTML handler for operators like \log.

* Extend BoldSymbol screenshot test

* Require options argument in mathsym to avoid this type of bug in the future

* Update screenshot
This commit is contained in:
Erik Demaine
2019-07-16 18:08:17 -04:00
committed by Ron Kok
parent 3d9a094b67
commit 08df67b7cd
6 changed files with 5 additions and 6 deletions

View File

@@ -103,13 +103,11 @@ const makeSymbol = function(
/**
* Makes a symbol in Main-Regular or AMS-Regular.
* Used for rel, bin, open, close, inner, and punct.
*
* TODO(#953): Make `options` mandatory and always pass it in.
*/
const mathsym = function(
value: string,
mode: Mode,
options?: Options,
options: Options,
classes?: string[] = [],
): SymbolNode {
// Decide what font to render the symbol in by its entry in the symbols
@@ -119,7 +117,7 @@ const mathsym = function(
// text ordinal and is therefore not present as a symbol in the symbols
// table for text, as well as a special case for boldsymbol because it
// can be used for bold + and -
if ((options && options.font && options.font === "boldsymbol") &&
if (options.font === "boldsymbol" &&
lookupSymbol(value, "Main-Bold", mode).metrics) {
return makeSymbol(value, "Main-Bold", mode, options,
classes.concat(["mathbf"]));

View File

@@ -105,7 +105,7 @@ export const htmlBuilder: HtmlBuilderSupSub<"op"> = (grp, options) => {
// operators, like \limsup
const output = [];
for (let i = 1; i < group.name.length; i++) {
output.push(buildCommon.mathsym(group.name[i], group.mode));
output.push(buildCommon.mathsym(group.name[i], group.mode, options));
}
base = buildCommon.makeSpan(["mop"], output, options);
}