Home > Software design >  JavaHelp Swing wrong rendering of HTML vertical-align
JavaHelp Swing wrong rendering of HTML vertical-align

Time:10-22

I know that the JavaHelp HTML rendering is known to be poor/outdated but I would like to know if there is a workaround exists to fix the following problem. The following HTML fragment

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body>
      <div>
          <span>This is a </span>
          <img style="vertical-align:middle" src='./_LaTeX_cvode_solve.xml_1.png' /> 
          <span>formula</span>
      </div>
  </body>
</html>

is wrongly rendered in JavaHelp by javax.help.SwingHelpUtilities:

enter image description here

the (correct) rendering in Firefox is the following

enter image description here

What are other ways (that could be supported by JavaHelp) to verticaly align an inline image w.r.t. text ? I have tested many popular ways but none worked so far. So if someone who has already struggled with JavaHelp may give some hints I would be very grateful.

CodePudding user response:

Java Swing's support for CSS is very hit and miss. Here is the list of attributes supported (with notes):

The following describes the CSS properties that are supported by the rendering engine:

  • font-family
  • ..
  • text-decoration (with the exception of blink and overline)
  • vertical-align (only sup and super)
  • text-align (justify is treated as center)
  • ..
  • list-style-position

So your best shot might be to use the actual HTML for the formula, with super and sub-script.

Note: Java-FX offers the WebView which (AFAIU) embeds an actual browser.

  • Related