当mathML转化为svg之后,如何保证当前公式可以和文本内容在一水平线上

作者: admin 分类: 应用技巧 发布时间: 2021-05-15 18:33  阅读: 163 views

背景

最近做公式的转换,碰到了一种情况,就是如何保证公式与文字格式良好的保持在同一水平线上。

公式格式:mathML公式 -> svg格式
以下是原图及效果

image

image

核心:获取base-line属性值

公式源码

String MathML = "<math> <semantics>  <mrow>   <mrow><mo>|</mo> <mrow>    <mover accent='true'>     <mi>a</mi>     <mo stretchy='true'>→</mo>    </mover>    <mo>−</mo><mover accent='true'>     <mi>b</mi>     <mo stretchy='true'>→</mo>    </mover>    </mrow> <mo>|</mo></mrow><mo>=</mo><msqrt>    <mrow>     <msup>      <mrow>       <mrow><mo>(</mo>        <mrow>         <mover accent='true'>          <mi>a</mi>          <mo stretchy='true'>→</mo>         </mover>         <mo>−</mo><mover accent='true'>          <mi>b</mi>          <mo stretchy='true'>→</mo>         </mover>         </mrow>       <mo>)</mo></mrow></mrow>      <mn>2</mn>     </msup>     </mrow>   </msqrt>   <mo>=</mo><msqrt>    <mrow>     <msup>      <mrow>       <mrow><mo>|</mo> <mrow>        <mover accent='true'>         <mi>a</mi>         <mo stretchy='true'>→</mo>        </mover>        </mrow> <mo>|</mo></mrow></mrow>      <mn>2</mn>     </msup>     <mo>−</mo><mn>2</mn><mover accent='true'>      <mi>a</mi>      <mo stretchy='true'>→</mo>     </mover>     <mo>⋅</mo><mover accent='true'>      <mi>b</mi>      <mo stretchy='true'>→</mo>     </mover>     <mo>+</mo><msup>      <mrow>       <mrow><mo>|</mo> <mrow>        <mover accent='true'>         <mi>b</mi>         <mo stretchy='true'>→</mo>        </mover>        </mrow> <mo>|</mo></mrow></mrow>      <mn>2</mn>     </msup>     </mrow>   </msqrt>   <mo>=</mo><msqrt>    <mrow>     <msup>      <mn>2</mn>      <mn>2</mn>     </msup>     <mo>−</mo><mn>2</mn><mo>×</mo><mn>2</mn><mo>+</mo><msup>      <mn>2</mn>      <mn>2</mn>     </msup>     </mrow>   </msqrt>   <mo>=</mo><mn>2</mn></mrow>   </semantics></math>";

公式转Svg源码

mathML转svg有多种方式,生成的源码会不一样,对解析高度有很大影响。

String result = "<svg xmlns=\"http://www.w3.org/2000/svg\" color-interpolation=\"auto\" color-rendering=\"auto\" fill=\"black\" fill-opacity=\"1\" font-family=\"'Dialog'\" font-size=\"12px\" font-style=\"normal\" font-weight=\"normal\" height=\"29\" image-rendering=\"auto\" shape-rendering=\"auto\" stroke=\"black\" stroke-dasharray=\"none\" stroke-dashoffset=\"0\" stroke-linecap=\"square\" stroke-linejoin=\"miter\" stroke-miterlimit=\"10\" stroke-opacity=\"1\" width=\"406\" text-rendering=\"auto\" stroke-width=\"1\"><!--Converted from MathML using JEuclid--><defs id=\"genericDefs\"/><g><g color-interpolation=\"linearRGB\" color-rendering=\"optimizeQuality\" fill=\"rgb(124,137,167)\" image-rendering=\"optimizeQuality\" stroke=\"rgb(124,137,167)\" text-rendering=\"optimizeLegibility\" transform=\"translate(0.7344,22.1123) matrix(1,0,0,1.2571,0,0)\"><path d=\"M1.9062 -11.1094 L1.9062 3.4531 L1.2656 3.4531 L1.2656 -11.1094 L1.9062 -11.1094 Z\" stroke=\"none\"/></g><g color-interpolation=\"linearRGB\" color-rendering=\"optimizeQuality\" fill=\"rgb(124,137,167)\" image-rendering=\"optimizeQuality\" stroke=\"rgb(124,137,167)\" text-rendering=\"optimizeLegibility\" transform=\"translate(6.1719,23)\"><path d=\"M7.5156 -7.0781 L5.9844 -1.7812 L5.8125 -1.0625 Q5.7969 -0.9688 5.7969 -0.8906 Q5.7969 -0.7656 5.875 -0.6719 Q5.9375 -0.6094 6.0312 -0.6094 Q6.125 -0.6094 6.2969 -0.7344 Q6.5938 -0.9531 7.1094 -1.6719 L7.375 -1.4844 Q6.8281 -0.6719 6.2578 -0.2422 Q5.6875 0.1875 5.2031 0.1875 Q4.875 0.1875 4.7031 0.0156 Q4.5312 -0.1562 4.5312 -0.4688 Q4.5312 -0.8594 4.7031 -1.4844 L4.875 -2.0625 Q3.8438 -0.7344 2.9844 -0.2031 Q2.375 0.1875 1.7812 0.1875 Q1.2031 0.1875 0.7891 -0.2891 Q0.375 -0.7656 0.375 -1.5938 Q0.375 -2.8281 1.125 -4.2109 Q1.875 -5.5938 3.0156 -6.4219 Q3.9219 -7.0781 4.7188 -7.0781 Q5.1875 -7.0781 5.5078 -6.8281 Q5.8281 -6.5781 5.9844 -6 L6.2656 -6.8906 L7.5156 -7.0781 ZM4.7344 -6.6719 Q4.2344 -6.6719 3.6719 -6.2031 Q2.875 -5.5312 2.25 -4.2266 Q1.625 -2.9219 1.625 -1.875 Q1.625 -1.3438 1.8906 -1.0312 Q2.1562 -0.7188 2.5 -0.7188 Q3.3594 -0.7188 4.3594 -1.9844 Q5.6875 -3.6562 5.6875 -5.4062 Q5.6875 -6.0781 5.4297 -6.375 Q5.1719 -6.6719 4.7344 -6.6719 Z\" stroke=\"none\"/></g><g color-interpolation=\"linearRGB\" color-rendering=\"optimizeQuality\" fill=\"rgb(124,137,167)\" image-rendering=\"optimizeQuality\" stroke=\"rgb(124,137,167)\" text-rendering=\"optimizeLegibility\" transform=\"translate(4.2188,15.9656)\"><path d=\"M8.3594 -4.7031 Q9.0625 -3.9219 9.5859 -3.5156 Q10.1094 -3.1094 10.5781 -2.9219 L10.5781 -2.6719 Q10.0312 -2.4219 9.5391 -2.0156 Q9.0469 -1.6094 8.3438 -0.8438 L7.9375 -0.8438 Q8.4375 -1.9219 8.9844 -2.5 L0.4219 -2.5 L0.4219 -3.0469 L8.9844 -3.0469 Q8.5781 -3.5625 8.4219 -3.8203 Q8.2656 -4.0781 7.9375 -4.7031 L8.3594 -4.7031 Z\" stroke=\"none\"/></g><g color-interpolation=\"linearRGB\" color-rendering=\"optimizeQuality\" fill=\"rgb(124,137,167)\" image-rendering=\"optimizeQuality\" stroke=\"rgb(124,137,167)\" text-rendering=\"optimizeLegibility\" transform=\"translate(18.6503,23)\"><path d=\"M8.7188 -5 L0.2969 -5 L0.2969 -5.6406 L8.7188 -5.6406 L8.7188 -5 Z\" stroke=\"none\"/></g><g color-interpolation=\"linearRGB\" color-rendering=\"optimizeQuality\" fill=\"rgb(124,137,167)\" image-rendering=\"optimizeQuality\" stroke=\"rgb(124,137,167)\" text-rendering=\"optimizeLegibility\" transform=\"translate(32.6287,23)\"><path d=\"M4.625 -11.1094 L3.0781 -5.7188 Q3.8281 -6.5 4.3906 -6.7891 Q4.9531 -7.0781 5.5625 -7.0781 Q6.4219 -7.0781 6.9688 -6.5078 Q7.5156 -5.9375 7.5156 -4.9531 Q7.5156 -3.7031 6.7969 -2.4531 Q6.0781 -1.2031 4.9922 -0.5078 Q3.9062 0.1875 2.8438 0.1875 Q1.6719 0.1875 0.4219 -0.7031 L2.7969 -8.875 Q3.0781 -9.8281 3.0781 -9.9844 Q3.0781 -10.1875 2.9531 -10.2969 Q2.7656 -10.4375 2.4219 -10.4375 Q2.25 -10.4375 1.9219 -10.375 L1.9219 -10.6719 L4.625 -11.1094 ZM1.5938 -0.6094 Q2.375 -0.1875 2.9688 -0.1875 Q3.6562 -0.1875 4.3984 -0.6875 Q5.1406 -1.1875 5.6797 -2.3828 Q6.2188 -3.5781 6.2188 -4.7969 Q6.2188 -5.5156 5.8672 -5.9219 Q5.5156 -6.3281 5.0312 -6.3281 Q4.2969 -6.3281 3.6016 -5.75 Q2.9062 -5.1719 2.6094 -4.125 L1.5938 -0.6094 Z\" stroke=\"none\"/></g><g color-interpolation=\"linearRGB\" color-rendering=\"optimizeQuality\" fill=\"rgb(124,137,167)\" image-rendering=\"optimizeQuality\" stroke=\"rgb(124,137,167)\" text-rendering=\"optimizeLegibility\" transform=\"translate(30.6755,11.9344)\"><path d=\"M8.3594 -4.7031 Q9.0625 -3.9219 9.5859 -3.5156 Q10.1094 -3.1094 10.5781 -2.9219 L10.5781 -2.6719 Q10.0312 -2.4219 9.5391 -2.0156 Q9.0469 -1.6094 8.3438 -0.8438 L7.9375 -0.8438 Q8.4375 -1.9219 8.9844 -2.5 L0.4219 -2.5 L0.4219 -3.0469 L8.9844 -3.0469 Q8.5781 -3.5625 8.4219 -3.8203 Q8.2656 -4.0781 7.9375 -4.7031 L8.3594 -4.7031 Z\" stroke=\"none\"/></g><g color-interpolation=\"linearRGB\" color-rendering=\"optimizeQuality\" fill=\"rgb(124,137,167)\" image-rendering=\"optimizeQuality\" stroke=\"rgb(124,137,167)\" text-rendering=\"optimizeLegibility\" transform=\"translate(42.4099,22.1123) matrix(1,0,0,1.2571,0,0)\"><path d=\"M1.9062 -11.1094 L1.9062 3.4531 L1.2656 3.4531 L1.2656 -11.1094 L1.9062 -11.1094 Z\" stroke=\"none\"/></g><g color-interpolation=\"linearRGB\" color-rendering=\"optimizeQuality\" fill=\"rgb(124,137,167)\" image-rendering=\"optimizeQuality\" stroke=\"rgb(124,137,167)\" text-rendering=\"optimizeLegibility\" transform=\"translate(49.7477,23)\"><path d=\"M0.2969 -6.9062 L8.7188 -6.9062 L8.7188 -6.2656 L0.2969 -6.2656 L0.2969 -6.9062 ZM0.2969 -4.3594 L8.7188 -4.3594 L8.7188 -3.7188 L0.2969 -3.7188 L0.2969 -4.3594 Z\" stroke=\"none\"/></g><g color-interpolation=\"linearRGB\" color-rendering=\"optimizeQuality\" fill=\"rgb(124,137,167)\" image-rendering=\"optimizeQuality\" stroke=\"rgb(124,137,167)\" width=\"1.3333\" text-rendering=\"optimizeLegibility\" transform=\"translate(1.5,0)\"><line fill=\"none\" x1=\"62.19\" x2=\"63.5282\" y1=\"17.80\" y2=\"17.3\"/><line fill=\"none\" x1=\"63.5282\" x2=\"66.8837\" y1=\"17.3\" y2=\"27.3688\"/><line fill=\"none\" x1=\"66.8837\" x2=\"70.2393\" y1=\"27.3688\" y2=\"1.2458\"/><line fill=\"none\" x1=\"70.2393\" x2=\"126.5461\" y1=\"1.2458\" y2=\"1.2458\"/><path d=\"M4.9688 3.1406 L4.9688 3.4219 Q3.7969 2.8281 3 2.0312 Q1.875 0.9062 1.2656 -0.6406 Q0.6562 -2.1875 0.6562 -3.8438 Q0.6562 -6.2656 1.8516 -8.2578 Q3.0469 -10.25 4.9688 -11.1094 L4.9688 -10.7812 Q4.0156 -10.25 3.3984 -9.3281 Q2.7812 -8.4062 2.4766 -6.9922 Q2.1719 -5.5781 2.1719 -4.0469 Q2.1719 -2.375 2.4219 -1 Q2.625 0.0781 2.9141 0.7344 Q3.2031 1.3906 3.6953 1.9922 Q4.1875 2.5938 4.9688 3.1406 Z\" stroke=\"none\" width=\"1\" transform=\"translate(71.583,22.6267) matrix(1,0,0,1.3858,0,0)\"/></g><g color-interpolation=\"linearRGB\" color-rendering=\"optimizeQuality\" fill=\"rgb(124,137,167)\" image-rendering=\"optimizeQuality\" stroke=\"rgb(124,137,167)\" text-rendering=\"optimizeLegibility\" transform=\"translate(80.083,23)\"><path d=\"M7.5156 -7.0781 L5.9844 -1.7812 L5.8125 -1.0625 Q5.7969 -0.9688 5.7969 -0.8906 Q5.7969 -0.7656 5.875 -0.6719 Q5.9375 -0.6094 6.0312 -0.6094 Q6.125 -0.6094 6.2969 -0.7344 Q6.5938 -0.9531 7.1094 -1.6719 L7.375 -1.4844 Q6.8281 -0.6719 6.2578 -0.2422 Q5.6875 0.1875 5.2031 0.1875 Q4.875 0.1875 4.7031 0.0156 Q4.5312 -0.1562 4.5312 -0.4688 Q4.5312 -0.8594 4.7031 -1.4844 L4.875 -2.0625 Q3.8438 -0.7344 2.9844 -0.2031 Q2.375 0.1875 1.7812 0.1875 Q1.2031 0.1875 0.7891 -0.2891 Q0.375 -0.7656 0.375 -1.5938 Q0.375 -2.8281 1.125 -4.2109 Q1.875 -5.5938 3.0156 -6.4219 Q3.9219 -7.0781 4.7188 -7.0781 Q5.1875 -7.0781 5.5078 -6.8281 Q5.8281 -6.5781 5.9844 -6 L6.2656 -6.8906 L7.5156 -7.0781 ZM4.7344 -6.6719 Q4.2344 -6.6719 3.6719 -6.2031 Q2.875 -5.5312 2.25 -4.2266 Q1.625 -2.9219 1.625 -1.875 Q1.625 -1.3438 1.8906 -1.0312 Q2.1562 -0.7188 2.5 -0.7188 Q3.3594 -0.7188 4.3594 -1.9844 Q5.6875 -3.6562 5.6875 -5.4062 Q5.6875 -6.0781 5.4297 -6.375 Q5.1719 -6.6719 4.7344 -6.6719 Z\" stroke=\"none\"/></g><g color-interpolation=\"linearRGB\" color-rendering=\"optimizeQuality\" fill=\"rgb(124,137,167)\" image-rendering=\"optimizeQuality\" stroke=\"rgb(124,137,167)\" text-rendering=\"optimizeLegibility\" transform=\"translate(78.1299,15.9656)\"><path d=\"M8.3594 -4.7031 Q9.0625 -3.9219 9.5859 -3.5156 Q10.1094 -3.1094 10.5781 -2.9219 L10.5781 -2.6719 Q10.0312 -2.4219 9.5391 -2.0156 Q9.0469 -1.6094 8.3438 -0.8438 L7.9375 -0.8438 Q8.4375 -1.9219 8.9844 -2.5 L0.4219 -2.5 L0.4219 -3.0469 L8.9844 -3.0469 Q8.5781 -3.5625 8.4219 -3.8203 Q8.2656 -4.0781 7.9375 -4.7031 L8.3594 -4.7031 Z\" stroke=\"none\"/></g><g color-interpolation=\"linearRGB\" color-rendering=\"optimizeQuality\" fill=\"rgb(124,137,167)\" image-rendering=\"optimizeQuality\" stroke=\"rgb(124,137,167)\" text-rendering=\"optimizeLegibility\" transform=\"translate(92.5614,23)\"><path d=\"M8.7188 -5 L0.2969 -5 L0.2969 -5.6406 L8.7188 -5.6406 L8.7188 -5 Z\" stroke=\"none\"/></g><g color-interpolation=\"linearRGB\" color-rendering=\"optimizeQuality\" fill=\"rgb(124,137,167)\" image-rendering=\"optimizeQuality\" stroke=\"rgb(124,137,167)\" text-rendering=\"optimizeLegibility\" transform=\"translate(106.5398,23)\"><path d=\"M4.625 -11.1094 L3.0781 -5.7188 Q3.8281 -6.5 4.3906 -6.7891 Q4.9531 -7.0781 5.5625 -7.0781 Q6.4219 -7.0781 6.9688 -6.5078 Q7.5156 -5.9375 7.5156 -4.9531 Q7.5156 -3.7031 6.7969 -2.4531 Q6.0781 -1.2031 4.9922 -0.5078 Q3.9062 0.1875 2.8438 0.1875 Q1.6719 0.1875 0.4219 -0.7031 L2.7969 -8.875 Q3.0781 -9.8281 3.0781 -9.9844 Q3.0781 -10.1875 2.9531 -10.2969 Q2.7656 -10.4375 2.4219 -10.4375 Q2.25 -10.4375 1.9219 -10.375 L1.9219 -10.6719 L4.625 -11.1094 ZM1.5938 -0.6094 Q2.375 -0.1875 2.9688 -0.1875 Q3.6562 -0.1875 4.3984 -0.6875 Q5.1406 -1.1875 5.6797 -2.3828 Q6.2188 -3.5781 6.2188 -4.7969 Q6.2188 -5.5156 5.8672 -5.9219 Q5.5156 -6.3281 5.0312 -6.3281 Q4.2969 -6.3281 3.6016 -5.75 Q2.9062 -5.1719 2.6094 -4.125 L1.5938 -0.6094 Z\" stroke=\"none\"/></g><g color-interpolation=\"linearRGB\" color-rendering=\"optimizeQuality\" fill=\"rgb(124,137,167)\" image-rendering=\"optimizeQuality\" stroke=\"rgb(124,137,167)\" text-rendering=\"optimizeLegibility\" transform=\"translate(104.5867,11.9344)\"><path d=\"M8.3594 -4.7031 Q9.0625 -3.9219 9.5859 -3.5156 Q10.1094 -3.1094 10.5781 -2.9219 L10.5781 -2.6719 Q10.0312 -2.4219 9.5391 -2.0156 Q9.0469 -1.6094 8.3438 -0.8438 L7.9375 -0.8438 Q8.4375 -1.9219 8.9844 -2.5 L0.4219 -2.5 L0.4219 -3.0469 L8.9844 -3.0469 Q8.5781 -3.5625 8.4219 -3.8203 Q8.2656 -4.0781 7.9375 -4.7031 L8.3594 -4.7031 Z\" stroke=\"none\"/></g><g color-interpolation=\"linearRGB\" color-rendering=\"optimizeQuality\" fill=\"rgb(124,137,167)\" image-rendering=\"optimizeQuality\" stroke=\"rgb(124,137,167)\" text-rendering=\"optimizeLegibility\" transform=\"translate(115.2273,22.6267) matrix(1,0,0,1.3858,0,0)\"><path d=\"M0.3594 -10.7812 L0.3594 -11.1094 Q1.5469 -10.5312 2.3438 -9.7344 Q3.4531 -8.5938 4.0625 -7.0547 Q4.6719 -5.5156 4.6719 -3.8594 Q4.6719 -1.4375 3.4844 0.5625 Q2.2969 2.5625 0.3594 3.4219 L0.3594 3.1406 Q1.3281 2.5938 1.9453 1.6797 Q2.5625 0.7656 2.8672 -0.6562 Q3.1719 -2.0781 3.1719 -3.625 Q3.1719 -5.2812 2.9062 -6.6562 Q2.7188 -7.7344 2.4219 -8.3828 Q2.125 -9.0312 1.6406 -9.6328 Q1.1562 -10.2344 0.3594 -10.7812 Z\" stroke=\"none\"/></g><g color-interpolation=\"linearRGB\" color-rendering=\"optimizeQuality\" fill=\"rgb(124,137,167)\" image-rendering=\"optimizeQuality\" stroke=\"rgb(124,137,167)\" text-rendering=\"optimizeLegibility\" transform=\"translate(119.8992,10.95)\"><path d=\"M5.0469 -1.4062 L4.5312 0 L0.2344 0 L0.2344 -0.2031 Q2.125 -1.9219 2.8984 -3.0234 Q3.6719 -4.125 3.6719 -5.0312 Q3.6719 -5.7188 3.25 -6.1641 Q2.8281 -6.6094 2.2344 -6.6094 Q1.7031 -6.6094 1.2734 -6.2969 Q0.8438 -5.9844 0.6406 -5.375 L0.4531 -5.375 Q0.5781 -6.375 1.1328 -6.9062 Q1.6875 -7.4375 2.5312 -7.4375 Q3.4062 -7.4375 4 -6.8672 Q4.5938 -6.2969 4.5938 -5.5156 Q4.5938 -4.9688 4.3438 -4.4219 Q3.9375 -3.5469 3.0469 -2.5781 Q1.7188 -1.1094 1.375 -0.8125 L3.2812 -0.8125 Q3.8594 -0.8125 4.0938 -0.8516 Q4.3281 -0.8906 4.5156 -1.0234 Q4.7031 -1.1562 4.8438 -1.4062 L5.0469 -1.4062 Z\" stroke=\"none\"/></g><g color-interpolation=\"linearRGB\" color-rendering=\"optimizeQuality\" fill=\"rgb(124,137,167)\" image-rendering=\"optimizeQuality\" stroke=\"rgb(124,137,167)\" text-rendering=\"optimizeLegibility\" transform=\"translate(131.3109,23)\"><path d=\"M0.2969 -6.9062 L8.7188 -6.9062 L8.7188 -6.2656 L0.2969 -6.2656 L0.2969 -6.9062 ZM0.2969 -4.3594 L8.7188 -4.3594 L8.7188 -3.7188 L0.2969 -3.7188 L0.2969 -4.3594 Z\" stroke=\"none\"/></g><g color-interpolation=\"linearRGB\" color-rendering=\"optimizeQuality\" fill=\"rgb(124,137,167)\" image-rendering=\"optimizeQuality\" stroke=\"rgb(124,137,167)\" width=\"1.3333\" text-rendering=\"optimizeLegibility\" transform=\"translate(1.5,0)\"><line fill=\"none\" x1=\"143.75\" x2=\"145.0914\" y1=\"17.80\" y2=\"17.3\"/><line fill=\"none\" x1=\"145.0914\" x2=\"148.447\" y1=\"17.3\" y2=\"27\"/><line fill=\"none\" x1=\"148.447\" x2=\"151.8025\" y1=\"27\" y2=\"1.2458\"/><line fill=\"none\" x1=\"151.8025\" x2=\"270.9222\" y1=\"1.2458\" y2=\"1.2458\"/><path d=\"M1.9062 -11.1094 L1.9062 3.4531 L1.2656 3.4531 L1.2656 -11.1094 L1.9062 -11.1094 Z\" stroke=\"none\" width=\"1\" transform=\"translate(152.5369,22.1123) matrix(1,0,0,1.2571,0,0)\"/></g><g color-interpolation=\"linearRGB\" color-rendering=\"optimizeQuality\" fill=\"rgb(124,137,167)\" image-rendering=\"optimizeQuality\" stroke=\"rgb(124,137,167)\" text-rendering=\"optimizeLegibility\" transform=\"translate(157.9744,23)\"><path d=\"M7.5156 -7.0781 L5.9844 -1.7812 L5.8125 -1.0625 Q5.7969 -0.9688 5.7969 -0.8906 Q5.7969 -0.7656 5.875 -0.6719 Q5.9375 -0.6094 6.0312 -0.6094 Q6.125 -0.6094 6.2969 -0.7344 Q6.5938 -0.9531 7.1094 -1.6719 L7.375 -1.4844 Q6.8281 -0.6719 6.2578 -0.2422 Q5.6875 0.1875 5.2031 0.1875 Q4.875 0.1875 4.7031 0.0156 Q4.5312 -0.1562 4.5312 -0.4688 Q4.5312 -0.8594 4.7031 -1.4844 L4.875 -2.0625 Q3.8438 -0.7344 2.9844 -0.2031 Q2.375 0.1875 1.7812 0.1875 Q1.2031 0.1875 0.7891 -0.2891 Q0.375 -0.7656 0.375 -1.5938 Q0.375 -2.8281 1.125 -4.2109 Q1.875 -5.5938 3.0156 -6.4219 Q3.9219 -7.0781 4.7188 -7.0781 Q5.1875 -7.0781 5.5078 -6.8281 Q5.8281 -6.5781 5.9844 -6 L6.2656 -6.8906 L7.5156 -7.0781 ZM4.7344 -6.6719 Q4.2344 -6.6719 3.6719 -6.2031 Q2.875 -5.5312 2.25 -4.2266 Q1.625 -2.9219 1.625 -1.875 Q1.625 -1.3438 1.8906 -1.0312 Q2.1562 -0.7188 2.5 -0.7188 Q3.3594 -0.7188 4.3594 -1.9844 Q5.6875 -3.6562 5.6875 -5.4062 Q5.6875 -6.0781 5.4297 -6.375 Q5.1719 -6.6719 4.7344 -6.6719 Z\" stroke=\"none\"/></g><g color-interpolation=\"linearRGB\" color-rendering=\"optimizeQuality\" fill=\"rgb(124,137,167)\" image-rendering=\"optimizeQuality\" stroke=\"rgb(124,137,167)\" text-rendering=\"optimizeLegibility\" transform=\"translate(156.0213,15.9656)\"><path d=\"M8.3594 -4.7031 Q9.0625 -3.9219 9.5859 -3.5156 Q10.1094 -3.1094 10.5781 -2.9219 L10.5781 -2.6719 Q10.0312 -2.4219 9.5391 -2.0156 Q9.0469 -1.6094 8.3438 -0.8438 L7.9375 -0.8438 Q8.4375 -1.9219 8.9844 -2.5 L0.4219 -2.5 L0.4219 -3.0469 L8.9844 -3.0469 Q8.5781 -3.5625 8.4219 -3.8203 Q8.2656 -4.0781 7.9375 -4.7031 L8.3594 -4.7031 Z\" stroke=\"none\"/></g><g color-interpolation=\"linearRGB\" color-rendering=\"optimizeQuality\" fill=\"rgb(124,137,167)\" image-rendering=\"optimizeQuality\" stroke=\"rgb(124,137,167)\" text-rendering=\"optimizeLegibility\" transform=\"translate(167.7557,22.1123) matrix(1,0,0,1.2571,0,0)\"><path d=\"M1.9062 -11.1094 L1.9062 3.4531 L1.2656 3.4531 L1.2656 -11.1094 L1.9062 -11.1094 Z\" stroke=\"none\"/></g><g color-interpolation=\"linearRGB\" color-rendering=\"optimizeQuality\" fill=\"rgb(124,137,167)\" image-rendering=\"optimizeQuality\" stroke=\"rgb(124,137,167)\" text-rendering=\"optimizeLegibility\" transform=\"translate(171.6619,11.8656)\"><path d=\"M5.0469 -1.4062 L4.5312 0 L0.2344 0 L0.2344 -0.2031 Q2.125 -1.9219 2.8984 -3.0234 Q3.6719 -4.125 3.6719 -5.0312 Q3.6719 -5.7188 3.25 -6.1641 Q2.8281 -6.6094 2.2344 -6.6094 Q1.7031 -6.6094 1.2734 -6.2969 Q0.8438 -5.9844 0.6406 -5.375 L0.4531 -5.375 Q0.5781 -6.375 1.1328 -6.9062 Q1.6875 -7.4375 2.5312 -7.4375 Q3.4062 -7.4375 4 -6.8672 Q4.5938 -6.2969 4.5938 -5.5156 Q4.5938 -4.9688 4.3438 -4.4219 Q3.9375 -3.5469 3.0469 -2.5781 Q1.7188 -1.1094 1.375 -0.8125 L3.2812 -0.8125 Q3.8594 -0.8125 4.0938 -0.8516 Q4.3281 -0.8906 4.5156 -1.0234 Q4.7031 -1.1562 4.8438 -1.4062 L5.0469 -1.4062 Z\" stroke=\"none\"/></g><g color-interpolation=\"linearRGB\" color-rendering=\"optimizeQuality\" fill=\"rgb(124,137,167)\" image-rendering=\"optimizeQuality\" stroke=\"rgb(124,137,167)\" text-rendering=\"optimizeLegibility\" transform=\"translate(180.1403,23)\"><path d=\"M8.7188 -5 L0.2969 -5 L0.2969 -5.6406 L8.7188 -5.6406 L8.7188 -5 Z\" stroke=\"none\"/></g><g color-interpolation=\"linearRGB\" color-rendering=\"optimizeQuality\" fill=\"rgb(124,137,167)\" image-rendering=\"optimizeQuality\" stroke=\"rgb(124,137,167)\" text-rendering=\"optimizeLegibility\" transform=\"translate(192.5875,23)\"><path d=\"M7.3438 -2.0469 L6.5938 0 L0.3438 0 L0.3438 -0.2969 Q3.1094 -2.8125 4.2344 -4.4062 Q5.3594 -6 5.3594 -7.3125 Q5.3594 -8.3281 4.7422 -8.9766 Q4.125 -9.625 3.2656 -9.625 Q2.4844 -9.625 1.8594 -9.1641 Q1.2344 -8.7031 0.9375 -7.8281 L0.6562 -7.8281 Q0.8438 -9.2656 1.6562 -10.0391 Q2.4688 -10.8125 3.6719 -10.8125 Q4.9688 -10.8125 5.8281 -9.9844 Q6.6875 -9.1562 6.6875 -8.0312 Q6.6875 -7.2344 6.3125 -6.4219 Q5.7344 -5.1562 4.4375 -3.75 Q2.5 -1.625 2.0156 -1.1875 L4.7812 -1.1875 Q5.625 -1.1875 5.9609 -1.25 Q6.2969 -1.3125 6.5703 -1.5 Q6.8438 -1.6875 7.0469 -2.0469 L7.3438 -2.0469 Z\" stroke=\"none\"/></g><g color-interpolation=\"linearRGB\" color-rendering=\"optimizeQuality\" fill=\"rgb(124,137,167)\" image-rendering=\"optimizeQuality\" stroke=\"rgb(124,137,167)\" text-rendering=\"optimizeLegibility\" transform=\"translate(201.4625,23)\"><path d=\"M7.5156 -7.0781 L5.9844 -1.7812 L5.8125 -1.0625 Q5.7969 -0.9688 5.7969 -0.8906 Q5.7969 -0.7656 5.875 -0.6719 Q5.9375 -0.6094 6.0312 -0.6094 Q6.125 -0.6094 6.2969 -0.7344 Q6.5938 -0.9531 7.1094 -1.6719 L7.375 -1.4844 Q6.8281 -0.6719 6.2578 -0.2422 Q5.6875 0.1875 5.2031 0.1875 Q4.875 0.1875 4.7031 0.0156 Q4.5312 -0.1562 4.5312 -0.4688 Q4.5312 -0.8594 4.7031 -1.4844 L4.875 -2.0625 Q3.8438 -0.7344 2.9844 -0.2031 Q2.375 0.1875 1.7812 0.1875 Q1.2031 0.1875 0.7891 -0.2891 Q0.375 -0.7656 0.375 -1.5938 Q0.375 -2.8281 1.125 -4.2109 Q1.875 -5.5938 3.0156 -6.4219 Q3.9219 -7.0781 4.7188 -7.0781 Q5.1875 -7.0781 5.5078 -6.8281 Q5.8281 -6.5781 5.9844 -6 L6.2656 -6.8906 L7.5156 -7.0781 ZM4.7344 -6.6719 Q4.2344 -6.6719 3.6719 -6.2031 Q2.875 -5.5312 2.25 -4.2266 Q1.625 -2.9219 1.625 -1.875 Q1.625 -1.3438 1.8906 -1.0312 Q2.1562 -0.7188 2.5 -0.7188 Q3.3594 -0.7188 4.3594 -1.9844 Q5.6875 -3.6562 5.6875 -5.4062 Q5.6875 -6.0781 5.4297 -6.375 Q5.1719 -6.6719 4.7344 -6.6719 Z\" stroke=\"none\"/></g><g color-interpolation=\"linearRGB\" color-rendering=\"optimizeQuality\" fill=\"rgb(124,137,167)\" image-rendering=\"optimizeQuality\" stroke=\"rgb(124,137,167)\" text-rendering=\"optimizeLegibility\" transform=\"translate(199.5093,15.9656)\"><path d=\"M8.3594 -4.7031 Q9.0625 -3.9219 9.5859 -3.5156 Q10.1094 -3.1094 10.5781 -2.9219 L10.5781 -2.6719 Q10.0312 -2.4219 9.5391 -2.0156 Q9.0469 -1.6094 8.3438 -0.8438 L7.9375 -0.8438 Q8.4375 -1.9219 8.9844 -2.5 L0.4219 -2.5 L0.4219 -3.0469 L8.9844 -3.0469 Q8.5781 -3.5625 8.4219 -3.8203 Q8.2656 -4.0781 7.9375 -4.7031 L8.3594 -4.7031 Z\" stroke=\"none\"/></g><g color-interpolation=\"linearRGB\" color-rendering=\"optimizeQuality\" fill=\"rgb(124,137,167)\" image-rendering=\"optimizeQuality\" stroke=\"rgb(124,137,167)\" text-rendering=\"optimizeLegibility\" transform=\"translate(212.6909,23)\"><path d=\"M1.5469 -6.5469 L3.0312 -6.5469 L3.0312 -4.5625 L1.5469 -4.5625 L1.5469 -6.5469 Z\" stroke=\"none\"/></g><g color-interpolation=\"linearRGB\" color-rendering=\"optimizeQuality\" fill=\"rgb(124,137,167)\" image-rendering=\"optimizeQuality\" stroke=\"rgb(124,137,167)\" text-rendering=\"optimizeLegibility\" transform=\"translate(220.9818,23)\"><path d=\"M4.625 -11.1094 L3.0781 -5.7188 Q3.8281 -6.5 4.3906 -6.7891 Q4.9531 -7.0781 5.5625 -7.0781 Q6.4219 -7.0781 6.9688 -6.5078 Q7.5156 -5.9375 7.5156 -4.9531 Q7.5156 -3.7031 6.7969 -2.4531 Q6.0781 -1.2031 4.9922 -0.5078 Q3.9062 0.1875 2.8438 0.1875 Q1.6719 0.1875 0.4219 -0.7031 L2.7969 -8.875 Q3.0781 -9.8281 3.0781 -9.9844 Q3.0781 -10.1875 2.9531 -10.2969 Q2.7656 -10.4375 2.4219 -10.4375 Q2.25 -10.4375 1.9219 -10.375 L1.9219 -10.6719 L4.625 -11.1094 ZM1.5938 -0.6094 Q2.375 -0.1875 2.9688 -0.1875 Q3.6562 -0.1875 4.3984 -0.6875 Q5.1406 -1.1875 5.6797 -2.3828 Q6.2188 -3.5781 6.2188 -4.7969 Q6.2188 -5.5156 5.8672 -5.9219 Q5.5156 -6.3281 5.0312 -6.3281 Q4.2969 -6.3281 3.6016 -5.75 Q2.9062 -5.1719 2.6094 -4.125 L1.5938 -0.6094 Z\" stroke=\"none\"/></g><g color-interpolation=\"linearRGB\" color-rendering=\"optimizeQuality\" fill=\"rgb(124,137,167)\" image-rendering=\"optimizeQuality\" stroke=\"rgb(124,137,167)\" text-rendering=\"optimizeLegibility\" transform=\"translate(219.0286,11.9344)\"><path d=\"M8.3594 -4.7031 Q9.0625 -3.9219 9.5859 -3.5156 Q10.1094 -3.1094 10.5781 -2.9219 L10.5781 -2.6719 Q10.0312 -2.4219 9.5391 -2.0156 Q9.0469 -1.6094 8.3438 -0.8438 L7.9375 -0.8438 Q8.4375 -1.9219 8.9844 -2.5 L0.4219 -2.5 L0.4219 -3.0469 L8.9844 -3.0469 Q8.5781 -3.5625 8.4219 -3.8203 Q8.2656 -4.0781 7.9375 -4.7031 L8.3594 -4.7031 Z\" stroke=\"none\"/></g><g color-interpolation=\"linearRGB\" color-rendering=\"optimizeQuality\" fill=\"rgb(124,137,167)\" image-rendering=\"optimizeQuality\" stroke=\"rgb(124,137,167)\" text-rendering=\"optimizeLegibility\" transform=\"translate(232.7145,23)\"><path d=\"M4.1875 -1.1094 L4.1875 -5 L0.2969 -5 L0.2969 -5.6406 L4.1875 -5.6406 L4.1875 -9.5312 L4.8125 -9.5312 L4.8125 -5.6406 L8.7188 -5.6406 L8.7188 -5 L4.8125 -5 L4.8125 -1.1094 L4.1875 -1.1094 Z\" stroke=\"none\"/></g><g color-interpolation=\"linearRGB\" color-rendering=\"optimizeQuality\" fill=\"rgb(124,137,167)\" image-rendering=\"optimizeQuality\" stroke=\"rgb(124,137,167)\" text-rendering=\"optimizeLegibility\" transform=\"translate(245.1503,22.1123) matrix(1,0,0,1.2571,0,0)\"><path d=\"M1.9062 -11.1094 L1.9062 3.4531 L1.2656 3.4531 L1.2656 -11.1094 L1.9062 -11.1094 Z\" stroke=\"none\"/></g><g color-interpolation=\"linearRGB\" color-rendering=\"optimizeQuality\" fill=\"rgb(124,137,167)\" image-rendering=\"optimizeQuality\" stroke=\"rgb(124,137,167)\" text-rendering=\"optimizeLegibility\" transform=\"translate(250.5878,23)\"><path d=\"M4.625 -11.1094 L3.0781 -5.7188 Q3.8281 -6.5 4.3906 -6.7891 Q4.9531 -7.0781 5.5625 -7.0781 Q6.4219 -7.0781 6.9688 -6.5078 Q7.5156 -5.9375 7.5156 -4.9531 Q7.5156 -3.7031 6.7969 -2.4531 Q6.0781 -1.2031 4.9922 -0.5078 Q3.9062 0.1875 2.8438 0.1875 Q1.6719 0.1875 0.4219 -0.7031 L2.7969 -8.875 Q3.0781 -9.8281 3.0781 -9.9844 Q3.0781 -10.1875 2.9531 -10.2969 Q2.7656 -10.4375 2.4219 -10.4375 Q2.25 -10.4375 1.9219 -10.375 L1.9219 -10.6719 L4.625 -11.1094 ZM1.5938 -0.6094 Q2.375 -0.1875 2.9688 -0.1875 Q3.6562 -0.1875 4.3984 -0.6875 Q5.1406 -1.1875 5.6797 -2.3828 Q6.2188 -3.5781 6.2188 -4.7969 Q6.2188 -5.5156 5.8672 -5.9219 Q5.5156 -6.3281 5.0312 -6.3281 Q4.2969 -6.3281 3.6016 -5.75 Q2.9062 -5.1719 2.6094 -4.125 L1.5938 -0.6094 Z\" stroke=\"none\"/></g><g color-interpolation=\"linearRGB\" color-rendering=\"optimizeQuality\" fill=\"rgb(124,137,167)\" image-rendering=\"optimizeQuality\" stroke=\"rgb(124,137,167)\" text-rendering=\"optimizeLegibility\" transform=\"translate(248.6347,11.9344)\"><path d=\"M8.3594 -4.7031 Q9.0625 -3.9219 9.5859 -3.5156 Q10.1094 -3.1094 10.5781 -2.9219 L10.5781 -2.6719 Q10.0312 -2.4219 9.5391 -2.0156 Q9.0469 -1.6094 8.3438 -0.8438 L7.9375 -0.8438 Q8.4375 -1.9219 8.9844 -2.5 L0.4219 -2.5 L0.4219 -3.0469 L8.9844 -3.0469 Q8.5781 -3.5625 8.4219 -3.8203 Q8.2656 -4.0781 7.9375 -4.7031 L8.3594 -4.7031 Z\" stroke=\"none\"/></g><g color-interpolation=\"linearRGB\" color-rendering=\"optimizeQuality\" fill=\"rgb(124,137,167)\" image-rendering=\"optimizeQuality\" stroke=\"rgb(124,137,167)\" text-rendering=\"optimizeLegibility\" transform=\"translate(260.369,22.1123) matrix(1,0,0,1.2571,0,0)\"><path d=\"M1.9062 -11.1094 L1.9062 3.4531 L1.2656 3.4531 L1.2656 -11.1094 L1.9062 -11.1094 Z\" stroke=\"none\"/></g><g color-interpolation=\"linearRGB\" color-rendering=\"optimizeQuality\" fill=\"rgb(124,137,167)\" image-rendering=\"optimizeQuality\" stroke=\"rgb(124,137,167)\" text-rendering=\"optimizeLegibility\" transform=\"translate(264.2753,10.95)\"><path d=\"M5.0469 -1.4062 L4.5312 0 L0.2344 0 L0.2344 -0.2031 Q2.125 -1.9219 2.8984 -3.0234 Q3.6719 -4.125 3.6719 -5.0312 Q3.6719 -5.7188 3.25 -6.1641 Q2.8281 -6.6094 2.2344 -6.6094 Q1.7031 -6.6094 1.2734 -6.2969 Q0.8438 -5.9844 0.6406 -5.375 L0.4531 -5.375 Q0.5781 -6.375 1.1328 -6.9062 Q1.6875 -7.4375 2.5312 -7.4375 Q3.4062 -7.4375 4 -6.8672 Q4.5938 -6.2969 4.5938 -5.5156 Q4.5938 -4.9688 4.3438 -4.4219 Q3.9375 -3.5469 3.0469 -2.5781 Q1.7188 -1.1094 1.375 -0.8125 L3.2812 -0.8125 Q3.8594 -0.8125 4.0938 -0.8516 Q4.3281 -0.8906 4.5156 -1.0234 Q4.7031 -1.1562 4.8438 -1.4062 L5.0469 -1.4062 Z\" stroke=\"none\"/></g><g color-interpolation=\"linearRGB\" color-rendering=\"optimizeQuality\" fill=\"rgb(124,137,167)\" image-rendering=\"optimizeQuality\" stroke=\"rgb(124,137,167)\" text-rendering=\"optimizeLegibility\" transform=\"translate(275.687,23)\"><path d=\"M0.2969 -6.9062 L8.7188 -6.9062 L8.7188 -6.2656 L0.2969 -6.2656 L0.2969 -6.9062 ZM0.2969 -4.3594 L8.7188 -4.3594 L8.7188 -3.7188 L0.2969 -3.7188 L0.2969 -4.3594 Z\" stroke=\"none\"/></g><g color-interpolation=\"linearRGB\" color-rendering=\"optimizeQuality\" fill=\"rgb(124,137,167)\" image-rendering=\"optimizeQuality\" stroke=\"rgb(124,137,167)\" width=\"1.3333\" text-rendering=\"optimizeLegibility\" transform=\"translate(1.5,0)\"><line fill=\"none\" x1=\"288.13\" x2=\"289.4675\" y1=\"17.80\" y2=\"17.3\"/><line fill=\"none\" x1=\"289.4675\" x2=\"292.8231\" y1=\"17.3\" y2=\"27\"/><line fill=\"none\" x1=\"292.8231\" x2=\"296.1786\" y1=\"27\" y2=\"5.7333\"/><line fill=\"none\" x1=\"296.1786\" x2=\"381.3763\" y1=\"5.7333\" y2=\"5.7333\"/><path d=\"M7.3438 -2.0469 L6.5938 0 L0.3438 0 L0.3438 -0.2969 Q3.1094 -2.8125 4.2344 -4.4062 Q5.3594 -6 5.3594 -7.3125 Q5.3594 -8.3281 4.7422 -8.9766 Q4.125 -9.625 3.2656 -9.625 Q2.4844 -9.625 1.8594 -9.1641 Q1.2344 -8.7031 0.9375 -7.8281 L0.6562 -7.8281 Q0.8438 -9.2656 1.6562 -10.0391 Q2.4688 -10.8125 3.6719 -10.8125 Q4.9688 -10.8125 5.8281 -9.9844 Q6.6875 -9.1562 6.6875 -8.0312 Q6.6875 -7.2344 6.3125 -6.4219 Q5.7344 -5.1562 4.4375 -3.75 Q2.5 -1.625 2.0156 -1.1875 L4.7812 -1.1875 Q5.625 -1.1875 5.9609 -1.25 Q6.2969 -1.3125 6.5703 -1.5 Q6.8438 -1.6875 7.0469 -2.0469 L7.3438 -2.0469 Z\" stroke=\"none\" width=\"1\" transform=\"translate(296.1786,23)\"/></g><g color-interpolation=\"linearRGB\" color-rendering=\"optimizeQuality\" fill=\"rgb(124,137,167)\" image-rendering=\"optimizeQuality\" stroke=\"rgb(124,137,167)\" text-rendering=\"optimizeLegibility\" transform=\"translate(303.5223,15.9062)\"><path d=\"M5.0469 -1.4062 L4.5312 0 L0.2344 0 L0.2344 -0.2031 Q2.125 -1.9219 2.8984 -3.0234 Q3.6719 -4.125 3.6719 -5.0312 Q3.6719 -5.7188 3.25 -6.1641 Q2.8281 -6.6094 2.2344 -6.6094 Q1.7031 -6.6094 1.2734 -6.2969 Q0.8438 -5.9844 0.6406 -5.375 L0.4531 -5.375 Q0.5781 -6.375 1.1328 -6.9062 Q1.6875 -7.4375 2.5312 -7.4375 Q3.4062 -7.4375 4 -6.8672 Q4.5938 -6.2969 4.5938 -5.5156 Q4.5938 -4.9688 4.3438 -4.4219 Q3.9375 -3.5469 3.0469 -2.5781 Q1.7188 -1.1094 1.375 -0.8125 L3.2812 -0.8125 Q3.8594 -0.8125 4.0938 -0.8516 Q4.3281 -0.8906 4.5156 -1.0234 Q4.7031 -1.1562 4.8438 -1.4062 L5.0469 -1.4062 Z\" stroke=\"none\"/></g><g color-interpolation=\"linearRGB\" color-rendering=\"optimizeQuality\" fill=\"rgb(124,137,167)\" image-rendering=\"optimizeQuality\" stroke=\"rgb(124,137,167)\" text-rendering=\"optimizeLegibility\" transform=\"translate(312.0007,23)\"><path d=\"M8.7188 -5 L0.2969 -5 L0.2969 -5.6406 L8.7188 -5.6406 L8.7188 -5 Z\" stroke=\"none\"/></g><g color-interpolation=\"linearRGB\" color-rendering=\"optimizeQuality\" fill=\"rgb(124,137,167)\" image-rendering=\"optimizeQuality\" stroke=\"rgb(124,137,167)\" text-rendering=\"optimizeLegibility\" transform=\"translate(324.4479,23)\"><path d=\"M7.3438 -2.0469 L6.5938 0 L0.3438 0 L0.3438 -0.2969 Q3.1094 -2.8125 4.2344 -4.4062 Q5.3594 -6 5.3594 -7.3125 Q5.3594 -8.3281 4.7422 -8.9766 Q4.125 -9.625 3.2656 -9.625 Q2.4844 -9.625 1.8594 -9.1641 Q1.2344 -8.7031 0.9375 -7.8281 L0.6562 -7.8281 Q0.8438 -9.2656 1.6562 -10.0391 Q2.4688 -10.8125 3.6719 -10.8125 Q4.9688 -10.8125 5.8281 -9.9844 Q6.6875 -9.1562 6.6875 -8.0312 Q6.6875 -7.2344 6.3125 -6.4219 Q5.7344 -5.1562 4.4375 -3.75 Q2.5 -1.625 2.0156 -1.1875 L4.7812 -1.1875 Q5.625 -1.1875 5.9609 -1.25 Q6.2969 -1.3125 6.5703 -1.5 Q6.8438 -1.6875 7.0469 -2.0469 L7.3438 -2.0469 Z\" stroke=\"none\"/></g><g color-interpolation=\"linearRGB\" color-rendering=\"optimizeQuality\" fill=\"rgb(124,137,167)\" image-rendering=\"optimizeQuality\" stroke=\"rgb(124,137,167)\" text-rendering=\"optimizeLegibility\" transform=\"translate(334.2231,23)\"><path d=\"M1.2969 -2.5625 L4.0469 -5.3281 L1.2969 -8.0781 L1.75 -8.5312 L4.5 -5.7812 L7.25 -8.5312 L7.6875 -8.0781 L4.9375 -5.3281 L7.7031 -2.5625 L7.2656 -2.1094 L4.5 -4.875 L1.7344 -2.125 L1.2969 -2.5625 Z\" stroke=\"none\"/></g><g color-interpolation=\"linearRGB\" color-rendering=\"optimizeQuality\" fill=\"rgb(124,137,167)\" image-rendering=\"optimizeQuality\" stroke=\"rgb(124,137,167)\" text-rendering=\"optimizeLegibility\" transform=\"translate(345.6547,23)\"><path d=\"M7.3438 -2.0469 L6.5938 0 L0.3438 0 L0.3438 -0.2969 Q3.1094 -2.8125 4.2344 -4.4062 Q5.3594 -6 5.3594 -7.3125 Q5.3594 -8.3281 4.7422 -8.9766 Q4.125 -9.625 3.2656 -9.625 Q2.4844 -9.625 1.8594 -9.1641 Q1.2344 -8.7031 0.9375 -7.8281 L0.6562 -7.8281 Q0.8438 -9.2656 1.6562 -10.0391 Q2.4688 -10.8125 3.6719 -10.8125 Q4.9688 -10.8125 5.8281 -9.9844 Q6.6875 -9.1562 6.6875 -8.0312 Q6.6875 -7.2344 6.3125 -6.4219 Q5.7344 -5.1562 4.4375 -3.75 Q2.5 -1.625 2.0156 -1.1875 L4.7812 -1.1875 Q5.625 -1.1875 5.9609 -1.25 Q6.2969 -1.3125 6.5703 -1.5 Q6.8438 -1.6875 7.0469 -2.0469 L7.3438 -2.0469 Z\" stroke=\"none\"/></g><g color-interpolation=\"linearRGB\" color-rendering=\"optimizeQuality\" fill=\"rgb(124,137,167)\" image-rendering=\"optimizeQuality\" stroke=\"rgb(124,137,167)\" text-rendering=\"optimizeLegibility\" transform=\"translate(355.6843,23)\"><path d=\"M4.1875 -1.1094 L4.1875 -5 L0.2969 -5 L0.2969 -5.6406 L4.1875 -5.6406 L4.1875 -9.5312 L4.8125 -9.5312 L4.8125 -5.6406 L8.7188 -5.6406 L8.7188 -5 L4.8125 -5 L4.8125 -1.1094 L4.1875 -1.1094 Z\" stroke=\"none\"/></g><g color-interpolation=\"linearRGB\" color-rendering=\"optimizeQuality\" fill=\"rgb(124,137,167)\" image-rendering=\"optimizeQuality\" stroke=\"rgb(124,137,167)\" text-rendering=\"optimizeLegibility\" transform=\"translate(367.3857,23)\"><path d=\"M7.3438 -2.0469 L6.5938 0 L0.3438 0 L0.3438 -0.2969 Q3.1094 -2.8125 4.2344 -4.4062 Q5.3594 -6 5.3594 -7.3125 Q5.3594 -8.3281 4.7422 -8.9766 Q4.125 -9.625 3.2656 -9.625 Q2.4844 -9.625 1.8594 -9.1641 Q1.2344 -8.7031 0.9375 -7.8281 L0.6562 -7.8281 Q0.8438 -9.2656 1.6562 -10.0391 Q2.4688 -10.8125 3.6719 -10.8125 Q4.9688 -10.8125 5.8281 -9.9844 Q6.6875 -9.1562 6.6875 -8.0312 Q6.6875 -7.2344 6.3125 -6.4219 Q5.7344 -5.1562 4.4375 -3.75 Q2.5 -1.625 2.0156 -1.1875 L4.7812 -1.1875 Q5.625 -1.1875 5.9609 -1.25 Q6.2969 -1.3125 6.5703 -1.5 Q6.8438 -1.6875 7.0469 -2.0469 L7.3438 -2.0469 Z\" stroke=\"none\"/></g><g color-interpolation=\"linearRGB\" color-rendering=\"optimizeQuality\" fill=\"rgb(124,137,167)\" image-rendering=\"optimizeQuality\" stroke=\"rgb(124,137,167)\" text-rendering=\"optimizeLegibility\" transform=\"translate(374.7295,15.9062)\"><path d=\"M5.0469 -1.4062 L4.5312 0 L0.2344 0 L0.2344 -0.2031 Q2.125 -1.9219 2.8984 -3.0234 Q3.6719 -4.125 3.6719 -5.0312 Q3.6719 -5.7188 3.25 -6.1641 Q2.8281 -6.6094 2.2344 -6.6094 Q1.7031 -6.6094 1.2734 -6.2969 Q0.8438 -5.9844 0.6406 -5.375 L0.4531 -5.375 Q0.5781 -6.375 1.1328 -6.9062 Q1.6875 -7.4375 2.5312 -7.4375 Q3.4062 -7.4375 4 -6.8672 Q4.5938 -6.2969 4.5938 -5.5156 Q4.5938 -4.9688 4.3438 -4.4219 Q3.9375 -3.5469 3.0469 -2.5781 Q1.7188 -1.1094 1.375 -0.8125 L3.2812 -0.8125 Q3.8594 -0.8125 4.0938 -0.8516 Q4.3281 -0.8906 4.5156 -1.0234 Q4.7031 -1.1562 4.8438 -1.4062 L5.0469 -1.4062 Z\" stroke=\"none\"/></g><g color-interpolation=\"linearRGB\" color-rendering=\"optimizeQuality\" fill=\"rgb(124,137,167)\" image-rendering=\"optimizeQuality\" stroke=\"rgb(124,137,167)\" text-rendering=\"optimizeLegibility\" transform=\"translate(386.1412,23)\"><path d=\"M0.2969 -6.9062 L8.7188 -6.9062 L8.7188 -6.2656 L0.2969 -6.2656 L0.2969 -6.9062 ZM0.2969 -4.3594 L8.7188 -4.3594 L8.7188 -3.7188 L0.2969 -3.7188 L0.2969 -4.3594 Z\" stroke=\"none\"/></g><g color-interpolation=\"linearRGB\" color-rendering=\"optimizeQuality\" fill=\"rgb(124,137,167)\" image-rendering=\"optimizeQuality\" stroke=\"rgb(124,137,167)\" text-rendering=\"optimizeLegibility\" transform=\"translate(398.5883,23)\"><path d=\"M7.3438 -2.0469 L6.5938 0 L0.3438 0 L0.3438 -0.2969 Q3.1094 -2.8125 4.2344 -4.4062 Q5.3594 -6 5.3594 -7.3125 Q5.3594 -8.3281 4.7422 -8.9766 Q4.125 -9.625 3.2656 -9.625 Q2.4844 -9.625 1.8594 -9.1641 Q1.2344 -8.7031 0.9375 -7.8281 L0.6562 -7.8281 Q0.8438 -9.2656 1.6562 -10.0391 Q2.4688 -10.8125 3.6719 -10.8125 Q4.9688 -10.8125 5.8281 -9.9844 Q6.6875 -9.1562 6.6875 -8.0312 Q6.6875 -7.2344 6.3125 -6.4219 Q5.7344 -5.1562 4.4375 -3.75 Q2.5 -1.625 2.0156 -1.1875 L4.7812 -1.1875 Q5.625 -1.1875 5.9609 -1.25 Q6.2969 -1.3125 6.5703 -1.5 Q6.8438 -1.6875 7.0469 -2.0469 L7.3438 -2.0469 Z\" stroke=\"none\"/></g></g><script xmlns=\"\"/></svg>";

代码解析方式

这里有多种处理方式,核心是该类型的svg源码包含了所需的base_line属性。如果没有的话,需要其他方式计算。

由于公式有很多中的格式,样式,所以也要对各种情况酌情处理。

    /**
     * 1 根据mathml 计算图片的相对位置。  em作为单位配置
     * @param mathML
     * @param result
     * .先处理height 小于等于13的类型图片
     * .处理特殊的符号,如大括号
     * .在处理包含等号的图片(主要是物理 + 数学)
     * .在处理包含分数线的图片
     * .其他各式图片
     * .高度超过70的图片,垂直居中
     * 
     * @return
     */
    public static String getHeight(String mathML, String result) {
        String tm = "-404";
        result = result.replace("\r\n", "");
        result = result.replace("\n", "");
        result = result.replace("\r", "");
        result = result.replace("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>", "");
        result = result.replace("<?xml version=p'1.0' encoding='UTF-8' standalone='no'?>", "");
        result = result.replace("<!--Converted from MathML using JEuclid-->", "");
        String value = result.substring(result.indexOf("height=\"")+8,result.indexOf("\" image-rendering"));//获取图片内容
        int height = Integer.parseInt(value);
        try {
            Document svg = Parser.getInstance().parseStreamSource(new StreamSource(new StringReader(result)));
//          log.info("svg-info1:{}",svg.getChildNodes().getLength());
//          log.info("svg-info1:{}",svg.getChildNodes().item(0).getNodeName());
//          log.info("svg-info1:{}",svg.getChildNodes().item(0).getChildNodes().getLength());
//          log.info("svg-info1:{}",svg.getChildNodes().item(0).getChildNodes().item(0).getNodeValue());
//          log.info("svg-info1:{}",svg.getChildNodes().item(0).getChildNodes().item(1).getNodeName());
//          log.info("svg-info1:{}",svg.getChildNodes().item(0).getChildNodes().item(1).getChildNodes().getLength());
            NodeList gLevel =svg.getChildNodes().item(0).getChildNodes().item(1).getChildNodes();
            for(int i = 0;i < gLevel.getLength(); i++) {
                Node temp = gLevel.item(i);
                NamedNodeMap nodeMap = temp.getAttributes();
                Node pro = nodeMap.getNamedItem("transform");
                if(pro==null) {
                    continue;
                }
                //获取节点属性
                String transform = nodeMap.getNamedItem("transform").getNodeValue();
                if(transform.indexOf("matrix") > 0) {
                    continue;
                }
                //获取括号内的内容
                transform = transform.substring(transform.indexOf("(")+1, transform.indexOf(")")); 
                if(transform.indexOf(",") < 0) {
                    continue;
                }
                //获取y轴数据
                String sz[] = transform.split(",");
                String baseLine = sz[1];
                if(baseLine.indexOf(".") > 0) {
                    continue;
                }else {
                    tm = (Integer.parseInt(baseLine) - height) + "";
                    break;
                }
            }

            // 这里是大花括号,没有精准坐标位置,不做对齐处理
            if(mathML.indexOf("\\{") > 0 || mathML.indexOf("{") > 0 ) {  
                return "";
            }


            if(tm.equals("-404")) {
                //如果mathMl中包含分数线
                if(mathML.indexOf("mfrac") > 0) { 
                    BigDecimal temp_y = BigDecimal.ZERO; //分数线所在的位置
                    BigDecimal maxLine = BigDecimal.ZERO; //最长分数线高度
                    BigDecimal maxLen = BigDecimal.ZERO; //最长分数线宽度
                    BigDecimal temp_y_check = BigDecimal.ZERO;
                    CulHeightV chv = new CulHeightV();
                    chv.setLen(maxLen);
                    chv.setMax(maxLine);
                    for(int i = 0; i < gLevel.getLength();i++) {
                        Node firstNode = gLevel.item(i).getFirstChild();
                        if(firstNode==null || !firstNode.getNodeName().equals("line")) {
                            continue;
                        }
                        CulHeightV temp_info = getMaxLine(firstNode,temp_y,temp_y_check,chv);
                        chv.setLen(temp_info.getLen());
                        chv.setMax(temp_info.getMax());
                    }
                    maxLine = chv.getMax();
                    // 分数线不是标准 baseline , <g>画法的svg需要 + 5.7才能达到基准线
                    tm = maxLine.add(new BigDecimal(5.7).setScale(2,BigDecimal.ROUND_DOWN)).subtract(new BigDecimal(height)).toString();
//                  log.info("cul2 baseLine:{},height:{},tm:{},svg:{}",maxLine,height,tm,result);
                    return "vertical-align: "+tm+"px";
                }
                if(mathML.indexOf("sqrt") > 0) { //这个是单根号的处理
                    Node firstNode = gLevel.item(0).getFirstChild(); //获取第一个元素
                    if(null == firstNode) {
                        return "";
                    }
                    NamedNodeMap fNode = firstNode.getAttributes();
                    if(null == fNode) {
                        return "";
                    }
                    BigDecimal y1 = new BigDecimal(fNode.getNamedItem("y1").getNodeValue());
                    if(y1.toString().indexOf(".3") > 0) {
                        tm = y1.add(new BigDecimal(5.7).setScale(2,BigDecimal.ROUND_DOWN)).subtract(new BigDecimal(height)).toString();
                    }
                    return "vertical-align: "+tm+"px";
                }
                return ""; 
            }else {
                return "vertical-align: "+tm+"px"; 
            }
        } catch (Exception e) { 
            log.error("--CulHeightStyleUtil异常--,mathMl={},result={},e={}", mathML,result, e);
        }
        return "";

    }

    static CulHeightV getMaxLine(Node node, BigDecimal temp_y ,BigDecimal temp_y_check ,CulHeightV cul) {
        NamedNodeMap nodeMap = node.getAttributes();
        BigDecimal x1 = new BigDecimal(nodeMap.getNamedItem("x1").getNodeValue());
        BigDecimal x2 = new BigDecimal(nodeMap.getNamedItem("x2").getNodeValue());
        BigDecimal y1 = new BigDecimal(nodeMap.getNamedItem("y1").getNodeValue());
        BigDecimal y2 = new BigDecimal(nodeMap.getNamedItem("y2").getNodeValue());
        BigDecimal x_len = x2.subtract(x1);
        if(y1.equals(y2)) { //表示是横线
            if(!temp_y_check.equals(y1)) { //表示不是根号
                temp_y = y1;
                if(cul.getLen().subtract(x_len).intValue() < 0) {
                    cul.setMax(temp_y);
                    cul.setLen(x_len);
                }
            }
            Node next = node.getNextSibling();
            if(next!=null && next.getNodeName().equals("line")) {
                temp_y_check = y2;//获取上一条线的y2
                cul = getMaxLine(next,temp_y,temp_y_check,cul);
            }
        }else {//看横线下是否有其他横线
            Node next = node.getNextSibling();
            if(next!=null && next.getNodeName().equals("line")) {
                temp_y_check = y2;//获取上一条线的y2
                cul = getMaxLine(next,temp_y,temp_y_check,cul);
            }
        }

        return cul;
    }


   原创文章,转载请标明本文链接: 当mathML转化为svg之后,如何保证当前公式可以和文本内容在一水平线上

如果觉得我的文章对您有用,请随意打赏。您的支持将鼓励我继续创作!

发表评论

电子邮件地址不会被公开。 必填项已用*标注