Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / March 2006

Tip: Looking for answers? Try searching our database.

make drawString render fonts identically to PhotoShop 7.0

Thread view: 
opalpa@gmail.com opalinski from opalpaweb - 27 Feb 2006 21:48 GMT
Hello,

 I've noticed that there are differences, pixel for pixel, when
rendering characters in the same Font with Java and with Photoshop.
Most characters match pixel for pixel, but a significant percentage do
not.  The percentage varies with font choice.  I've been googling to
find information about how Java draws characters, but I am not coming
across nuanced information.  Also, I notice that PhotoShop renderings
match the renderings of Windows applications that appear not to be
written in Java.

 I have tried a variety of rendering hints in Java, so I do not think
the answer lies in setting rendering hints.  I suppose my question is:
does Java do its own font rendering instead of calling out to system
libraries?  If Java does so, that is perfectly acceptable, I'd like a
confirmation.

 Thanks for your time and attention.

Opalinski
opalpa@gmail.com
http://www.geocities.com/opalpaweb/
Larry Barowski - 28 Feb 2006 01:21 GMT
>  I've noticed that there are differences, pixel for pixel, when
> rendering characters in the same Font with Java and with Photoshop.
[quoted text clipped - 10 lines]
> libraries?  If Java does so, that is perfectly acceptable, I'd like a
> confirmation.

Java is doing it's own rendering. I'm sure PhotoShop does the
same. Rendering a TrueType font is quite complicated, and
the Java renderer may not follow the TrueType specification
to the letter in all cases. This has improved over time. In my
experience, the Windows renderer follows the spec. exactly
(I have a font that is very sensitive to control point placement).

I once complained to Adobe about their TrueType font
rendering in Acrobat, which even with "Font Smoothing"
turned off, does not follow the TrueType specification
exactly. Their answer (or perhaps the opinion of the guy
who did not want to fix the problem), was that the hinting
is just a suggestion. In my opinion, if the font specification,
including hints, leaves no room for doubt about where a
control point should go, then that's where it should go.
Roedy Green - 28 Feb 2006 19:23 GMT
On Mon, 27 Feb 2006 20:21:26 -0600, "Larry Barowski"
<MElarrybar-AT-eng_DOT_auburnANOTHERDOTeduEND> wrote, quoted or
indirectly quoted someone who said :

>Java is doing it's own rendering

It sometimes does anti-aliasing but it is terrible at small font sizes
because it does not pay attention to hints.  The solution is, stick to
font sizes 11+

see http://mindprod.com/jgloss/font.html
Signature

Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.

Thomas Weidenfeller - 28 Feb 2006 08:28 GMT
> Hello,
>
[quoted text clipped - 4 lines]
> find information about how Java draws characters, but I am not coming
> across nuanced information.

Java uses Typesolution's T2K rasterizer (until recently it used a
version which didn't use hints from the font data). On some platforms it
can alternatively use the native rasterizer from the OS. When one uses
AWT (the old AWT, not the one reimplemented on top of Swing), the native
AWT components typically use the OS' font rasterizer.

/Thomas
Signature

The comp.lang.java.gui FAQ:
ftp://ftp.cs.uu.nl/pub/NEWS.ANSWERS/computer-lang/java/gui/faq
http://www.uni-giessen.de/faq/archiv/computer-lang.java.gui.faq/

opalpa@gmail.com opalinski from opalpaweb - 28 Feb 2006 12:58 GMT
Thomas, how can one insert a character rasterized by OS' font
rasterizer into a BufferedImage when using Java 5.0?  Is this feat
possible?  Or is it that the old AWT is no longer available in current
versions of Java?

Opalinski
opalpa@gmail.com
http://www.geocities.com/opalpaweb/
Roedy Green - 28 Feb 2006 19:25 GMT
On 28 Feb 2006 04:58:39 -0800, "opalpa@gmail.com opalinski from
opalpaweb" <opalpa@gmail.com> wrote, quoted or indirectly quoted
someone who said :

>Thomas, how can one insert a character rasterized by OS' font
>rasterizer into a BufferedImage when using Java 5.0?  Is this feat
>possible?  Or is it that the old AWT is no longer available in current
>versions of Java?

You could use image files prepared off line.
Signature

Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.

Roedy Green - 28 Feb 2006 20:02 GMT
On Tue, 28 Feb 2006 19:25:27 GMT, Roedy Green
<my_email_is_posted_on_my_website@munged.invalid> wrote, quoted or
indirectly quoted someone who said :

>You could use image files prepared off line.

This is not as crazy as it sounds. You might want a line of fine
print for legal matters that is still readable, or a line of
instructions for something obvious that most people would never read.
They could be field labels that most people never look at.
Signature

Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.

opalpa@gmail.com opalinski from opalpaweb - 01 Mar 2006 13:19 GMT
> You could use image files prepared off line.
> This is not as crazy as it sounds.

Crazy?  No!  Precisely what I did!  For the short term, anyway.  It
seems there might be a way to defer font rendering to OS' renderer (per
Thomas Weidenfeller's posts in this thread).

Opalinski
opalpa@gmail.com
http://www.geocities.com/opalpaweb/
Thomas Weidenfeller - 01 Mar 2006 08:36 GMT
> Thomas, how can one insert a character rasterized by OS' font
> rasterizer into a BufferedImage when using Java 5.0?  Is this feat
> possible?  Or is it that the old AWT is no longer available in current
> versions of Java?

I don't know. I seem to remember that there once was a system property
which one could set on the command line for the whole application, but I
can't remember what it was, or where Sun has buried the description.

/Thomas
Signature

The comp.lang.java.gui FAQ:
ftp://ftp.cs.uu.nl/pub/NEWS.ANSWERS/computer-lang/java/gui/faq
http://www.uni-giessen.de/faq/archiv/computer-lang.java.gui.faq/

opalpa@gmail.com opalinski from opalpaweb - 01 Mar 2006 13:14 GMT
Your comment got me searching for the system property  which one could
set on the command line.  Do any of these ring a bell?

java2d.font.usePlatformFont
sun.awt.fontconfig
sun.java2d.font.minstrikes
sun.java2d.fontpath
sun.java2d.noType1Font

java.awt.fonts
swing.useSystemFontSettings

Do you recall any of these and appropriate associated value?  I located
some info via google on last two and believe I can exclude them from
being the correct property.

Thank you for continuing with this pursuit.

Opalinski
opalpa@gmail.com
http://www.geocities.com/opalpaweb/


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.