\boldsymbol not italic for textords such as Greek (#2290)

* \boldsymbol not italic for textords such as Greek

Fix #2225: `\boldsymbol{\Omega}` will now produce a bold upright Omega
instead of a bold italic Omega.  This only affects `textord` symbols within
`\boldsymbol`, mimicking the no-font case in `makeOrd` which distinguishes
`textord` from `mathord` in a similar way.

* Update screenshots

Co-authored-by: Ron Kok <ronkok@comcast.net>
This commit is contained in:
Erik Demaine
2020-07-09 12:22:33 -04:00
committed by GitHub
parent f96fba6f7f
commit 7523e9714a
3 changed files with 5 additions and 3 deletions

View File

@@ -130,7 +130,7 @@ const mathsym = function(
/** /**
* Determines which of the two font names (Main-Italic and Math-Italic) and * Determines which of the two font names (Main-Italic and Math-Italic) and
* corresponding style tags (maindefault or mathit) to use for default math font, * corresponding style tags (mathdefault or mathit) to use for default math font,
* depending on the symbol. * depending on the symbol.
*/ */
const mathdefault = function( const mathdefault = function(
@@ -196,8 +196,10 @@ const boldsymbol = function(
mode: Mode, mode: Mode,
options: Options, options: Options,
classes: string[], classes: string[],
type: "mathord" | "textord",
): {| fontName: string, fontClass: string |} { ): {| fontName: string, fontClass: string |} {
if (lookupSymbol(value, "Math-BoldItalic", mode).metrics) { if (type !== "textord" &&
lookupSymbol(value, "Math-BoldItalic", mode).metrics) {
return { return {
fontName: "Math-BoldItalic", fontName: "Math-BoldItalic",
fontClass: "boldsymbol", fontClass: "boldsymbol",
@@ -238,7 +240,7 @@ const makeOrd = function<NODETYPE: "spacing" | "mathord" | "textord">(
let fontClasses; let fontClasses;
if (fontOrFamily === "boldsymbol" || fontOrFamily === "mathnormal") { if (fontOrFamily === "boldsymbol" || fontOrFamily === "mathnormal") {
const fontData = fontOrFamily === "boldsymbol" const fontData = fontOrFamily === "boldsymbol"
? boldsymbol(text, mode, options, classes) ? boldsymbol(text, mode, options, classes, type)
: mathnormal(text, mode, options, classes); : mathnormal(text, mode, options, classes);
fontName = fontData.fontName; fontName = fontData.fontName;
fontClasses = [fontData.fontClass]; fontClasses = [fontData.fontClass];

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 19 KiB