I am writing text on an image . I am using DrawString(x,y,string) method and I set font size as below
Font font = new Font(fontName, fontWeight, fontSize);
As you can see left side text written on image with 12pt size. Right side you can see 12pt size in HTML . Is there any way to map this so that I get same size in output as user sees in HTML ?
解决方案
I found this link. Maybe useful. Try it out.
Basically it says that
Java assumes 72 dpi screen resolution Windows uses 96 dpi or 120 dpi depending
on your font size setting in the display properties.
The site suggests
instead of using getNormalizingTransform() you have to use getScreenResolution()
From the website again.
int screenRes = Toolkit.getDefaultToolkit().getScreenResolution();
int fontSize = (int)Math.round(12.0 * screenRes / 72.0);