metanorma / mn2pdf

Metanorma XML to PDF
3 stars 2 forks source link

jEuclid: subscripted text bold issue #244

Open Intelligent2013 opened 7 months ago

Intelligent2013 commented 7 months ago

Source issue: https://github.com/metanorma/stepmod2mn/issues/150#issuecomment-2041053030 Mathml:

<math xmlns="http://www.w3.org/1998/Math/MathML">
  <mstyle displaystyle="true">
    <mstyle mathvariant="bold">
      <mi>s</mi>
    </mstyle>
    <mrow>
      <mo lspace="0.2em">(</mo>
      <mi>u</mi>
      <mo>,</mo>
      <mi>v</mi>
      <mo>)</mo>
    </mrow>
    <mo>=</mo>
    <msup>
      <mrow>
        <mo>(</mo>
        <mn>1</mn>
        <mo>−</mo>
        <mi>u</mi>
        <mo>−</mo>
        <mi>v</mi>
        <mo>)</mo>
      </mrow>
      <mn>3</mn>
    </msup>
    <msub>
      <mstyle mathvariant="bold">
        <mi>P</mi>
      </mstyle>
      <mstyle mathvariant="bold">
        <mi>1</mi>
      </mstyle>
    </msub>

    <mo>+</mo>
    <msup>
      <mi>u</mi>
      <mn>3</mn>
    </msup>
    <msub>
      <mstyle mathvariant="bold">
        <mi>P</mi>
      </mstyle>
      <mstyle mathvariant="bold">
        <mn>2</mn>
      </mstyle>
    </msub>
    <mo>+</mo>
    <msup>
      <mi>v</mi>
      <mn>3</mn>
    </msup>
    <msub>
      <mstyle mathvariant="bold">
        <mi>P</mi>
      </mstyle>
      <mstyle mathvariant="bold">
        <mn>3</mn>
      </mstyle>
    </msub>
    <mo>+</mo>
    <mn>3</mn>
    <msup>
      <mrow>
        <mo>(</mo>
        <mn>1</mn>
        <mo>−</mo>
        <mi>u</mi>
        <mo>−</mo>
        <mi>v</mi>
        <mo>)</mo>
      </mrow>
      <mn>2</mn>
    </msup>
    <mi>u</mi>
    <msub>
      <mstyle mathvariant="bold">
        <mi>P</mi>
      </mstyle>
      <mstyle mathvariant="bold">
        <mn>4</mn>
      </mstyle>
    </msub>
    <mo>+</mo>
    <mn>3</mn>
    <mrow>
      <mo lspace="0.4em">(</mo>
      <mn>1</mn>
      <mo>−</mo>
      <mi>u</mi>
      <mo>−</mo>
      <mi>v</mi>
      <mo>)</mo>
    </mrow>
    <msup>
      <mi>u</mi>
      <mn>2</mn>
    </msup>
    <msub>
      <mstyle mathvariant="bold">
        <mi>P</mi>
      </mstyle>
      <mstyle mathvariant="bold">
        <mn>5</mn>
      </mstyle>
    </msub>
    <mo>+</mo>
    <mn>3</mn>
    <msup>
      <mi>u</mi>
      <mn>2</mn>
    </msup>
    <mi>v</mi>
    <msub>
      <mstyle mathvariant="bold">
        <mi>P</mi>
      </mstyle>
      <mstyle mathvariant="bold">
        <mn>6</mn>
      </mstyle>
    </msub>
    <mo>+</mo>
    <mn>3</mn>
    <mi>u</mi>
    <msup>
      <mi>v</mi>
      <mn>2</mn>
    </msup>
    <msub>
      <mstyle mathvariant="bold">
        <mi>P</mi>
      </mstyle>
      <mstyle mathvariant="bold">
        <mn>7</mn>
      </mstyle>
    </msub>
    <mo>+</mo>
    <mn>3</mn>
    <mrow>
      <mo lspace="0.4em">(</mo>
      <mn>1</mn>
      <mo>−</mo>
      <mi>u</mi>
      <mo>−</mo>
      <mi>v</mi>
      <mo>)</mo>
    </mrow>
    <msup>
      <mi>v</mi>
      <mn>2</mn>
    </msup>
    <msub>
      <mstyle mathvariant="bold">
        <mi>P</mi>
      </mstyle>
      <mstyle mathvariant="bold">
        <mn>8</mn>
      </mstyle>
    </msub>
    <mo>+</mo>
    <mn>3</mn>
    <msup>
      <mrow>
        <mo>(</mo>
        <mn>1</mn>
        <mo>−</mo>
        <mi>u</mi>
        <mo>−</mo>
        <mi>v</mi>
        <mo>)</mo>
      </mrow>
      <mn>2</mn>
    </msup>
    <mi>v</mi>
    <msub>
      <mstyle mathvariant="bold">
        <mi>P</mi>
      </mstyle>
      <mstyle mathvariant="bold">
        <mn>9</mn>
      </mstyle>
    </msub>
    <mo>+</mo>
    <mn>6</mn>
    <mi>u</mi>
    <mi>v</mi>
    <mrow>
      <mo lspace="0.2em">(</mo>
      <mn>1</mn>
      <mo>−</mo>
      <mi>u</mi>
      <mo>−</mo>
      <mi>v</mi>
      <mo>)</mo>
    </mrow>
    <msub>
      <mstyle mathvariant="bold">
        <mi>P</mi>
      </mstyle>
      <mstyle mathvariant="bold">
        <mn>10</mn>
      </mstyle>
    </msub>
  </mstyle>
</math>

PDF rendering image

Subscript 1, 2,,, in normal font weight, but should be in bold: image (original HTML rendering)

Intelligent2013 commented 2 weeks ago

For some reason, if font size less 9.0pt, then Cambria Math font renders in non-bold mode. Currently, the main text font size is 11pt, subscript font size is (11 * 0.71) = 7.81pt. (just for info, for 9pt subscripted text, the main font size should be 12.7pt) The same thing for the font STIX Two Math.

If change to Cambria font, then bold subscript renders ok.

Intelligent2013 commented 2 weeks ago

I've studied jEuclid, Batik and Java sources and didn't find the threshold or condition for turning off the 'bold' font weight...