swing - Java Fontrendering with JEditorPane -


i want font rendering using java html2image-classes. works fine - there issues cannot resolve.

the code use following:

import gui.ava.html.image.generator.htmlimagegenerator; import java.awt.color; import java.awt.font; import java.awt.fontmetrics; import java.awt.graphics2d; import java.awt.graphicsenvironment; import java.awt.renderinghints; import java.awt.font.linemetrics; import java.awt.image.bufferedimage; import java.io.file; import java.io.fileinputstream; import javax.imageio.imageio;  public class fonttest {   public static void main(string[] args)     throws throwable   {     htmlimagegenerator imagegenerator = new htmlimagegenerator();     imagegenerator.loadhtml("<html>\n" + "<body bgcolor=green>\n" + "\n" + "<span style=\"font-family:'times new roman',times,serif; font-size:200%\">" + "gro&szlig;er beispieltext $ in times new roman</span>" + "</body>\n" + "</html>");     imagegenerator.saveasimage("test.png");   } } 

the resulting image has 6 pixel in width. issue can fixed decreasing preffered size of jeditorpane. tricky issue left , bottom side of image containing pixel- rows , colums don't want have within image.

the lines of pixels above text , pixel-rows on left side of resulting image shouldn't part of image. found out amount of "error-pixels" depends on used font-size.

does have idea how find out correct (minimal) bounding-box contain rendered text?


Comments

Popular posts from this blog

windows - Single EXE to Install Python Standalone Executable for Easy Distribution -

c# - Access objects in UserControl from MainWindow in WPF -

javascript - How to name a jQuery function to make a browser's back button work? -