title: How to disable anti-aliasing in JavaFX fonts?
body: <p>Using JavaFX to render HTML content using a <code>javafx.scene.web.WebView</code>, the content is always drawn with text anti-aliasing on.</p>
  
  <p>Although this makes fonts look smoother, it often makes the printing of content to a monochrome/thermal style printer (receipt, shipping label) problematic.  A <code>nearest-neighbor</code> scale would be much better.</p>
  
  <p><a href="https://i.stack.imgur.com/wUMdu.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/wUMdu.png" alt="default lcd rendering"></a></p>
  
  <p>The <code>awt</code> and <code>swing</code> techniques (<code>-Dawt.useSystemAAFontSettings</code> and <code>-Dswing.aatext</code> respectively) don't seem to help JavaFX.</p>
  
  <p>There's an option to switch from <code>lcd</code> anti-aliasing to <code>gray</code> via <code>-Dprism.lcdtext=false</code>, which helps, but doesn't fix the anti-aliasing problem.</p>
  
  <p><a href="https://i.stack.imgur.com/nfxsy.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/nfxsy.png" alt="enter image description here"></a></p>
  
  <p>How does one achieve nearest-neighbor font scaling with JavaFX's WebView?</p>
  
  <p>Related: <a href="https://stackoverflow.com/questions/26734001/javafx-printable-to-image-very-pix-elated-but-perfect-to-printer">JavaFX Printable to Image very pix-elated, but perfect to printer</a></p>