Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Fonts in Java 1.5?

3 views
Skip to first unread message

Sam Patterson

unread,
Nov 30, 2002, 4:37:30 AM11/30/02
to
Does anyone know some of the plans in relation to fonts in Java 1.5? I was
pleased that things improved significantly between 1.3 and 1.4 with font
rendering but there is still a long way to go.

For example, antialiasing only looks good on large fonts and very small
fonts with the common point sizes of 10-14 just looking "fuzzy" or blurred.
This has got to be fixed. Non-antialiased fonts look great at those point
sizes but quickly become chunky and grainy at larger sizes. It needs to be
the case that antialiasing can be used at any point size with predictable
results particularly when Java apps have to stand up against native apps.

Sam


Karsten Lentzsch

unread,
Nov 30, 2002, 7:37:35 AM11/30/02
to
"Sam Patterson" <no...@nowhere.com> schrieb:

> Does anyone know some of the plans in relation
> to fonts in Java 1.5?

I haven't heard of any improvements for the 1.5 rasterizer.
There may be better support for enabling anti-aliasing
in Swing and there's an install-time check for bad fonts.

> For example, antialiasing only looks good on large fonts
> and very small fonts with the common point sizes of 10-14
> just looking "fuzzy" or blurred.

Antialiasing can increase and decrease the legability and
readability of a font. That depends on many factors including
the font type, font hints, font size, glyph shapes, glyph
implementation, and screen resolution. Often, a hand-hinted
glyph bitmap provides a significantly better legability
on the typical low-resolution screen - but again, it depends.

Decent raster algorithms, like ClearType, combined with
a precise display hardware, e.g. an LCD, can just lower
the point-size where anti-aliasing outperforms bitmaps.
Nevertheless, the problem will persist.

There's a bunch of rasterization algorithms (some do smooth
edges some not) that have different effects on the readability.
For example on the Microsoft GDI+ graphics kernel, which has
been introduced with Windows XP, you can choose between:
Default, SingleBitPerPixel, SingleBitPerPixelGridFit,
AntiAlias, AntiAliasGridFit, and ClearTypeGridFit.

On a Notebook with LCD color display, one would choose
ClearTypeGridFit for sizes above 12 pixels, where one
would choose AntiAliasGridFit above 16 pixels on CRTs, etc.

> (...) It needs to be the case that antialiasing can be used


> at any point size with predictable results

You can hardly provide this without knowing the display,
the font characteristics and resolution.

> particularly when Java apps have to stand up
> against native apps.

The majority of desktop apps provide weak support
for high-quality rasterization of fonts and graphics.
Mac and Windows XP are exceptions, because they
are provide easy access to rasterization engines
that can compete with Java2D - GDI+ in XP.
The typical Windows 95/98/ME/NT/2000 app,
uses the outdated GDI. Java apps can often provide
better visual results than these Windows native apps.

Here's a list of references for the interested reader:
1) Microsoft GDI+ rasterization styles
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/gdiabt/hh/g
diabt/umanaged_6kc0.asp
2) General GDI+ information
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/gdicpp/cpp_
aboutgdip01_4ss4.asp
3) An introduction to ClearType and LCD subpixel rendering
http://www.microsoft.com/typography/cleartype/default.htm?fname=%20&fsize=
4) A demo of hand-antialiasing
http://www.airwindows.com/inventions/HAFonts.html
5) Smooth Metal Look and Feel
http://smoothmetal.sourceforge.net/
6) Jan Tschichold's masterpiece about Typography from 1925
http://www.ucpress.edu/books/pages/5581.html

Best regards,
--
Karsten Lentzsch
www.JGoodies.com - Java User Interface Design


Sam Patterson

unread,
Nov 30, 2002, 10:55:43 AM11/30/02
to
"Karsten Lentzsch" <Karsten....@no-spam.de> wrote in message
news:asabdt$h04$02$1...@news.t-online.com...

> Antialiasing can increase and decrease the legability and
> readability of a font. That depends on many factors including
> the font type, font hints, font size, glyph shapes, glyph
> implementation, and screen resolution. Often, a hand-hinted
> glyph bitmap provides a significantly better legability
> on the typical low-resolution screen - but again, it depends.

Is antialiased Java2D hand-hinted? Maybe it is just me who thinks that
antialiased Java fonts look blurred and unsightly with Java2D at 10-14
points.

> Here's a list of references for the interested reader:
> 1) Microsoft GDI+ rasterization styles
>
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/gdiabt/hh/g
> diabt/umanaged_6kc0.asp
> 2) General GDI+ information
>
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/gdicpp/cpp_
> aboutgdip01_4ss4.asp
> 3) An introduction to ClearType and LCD subpixel rendering
> http://www.microsoft.com/typography/cleartype/default.htm?fname=%20&fsize=
> 4) A demo of hand-antialiasing
> http://www.airwindows.com/inventions/HAFonts.html
> 5) Smooth Metal Look and Feel
> http://smoothmetal.sourceforge.net/
> 6) Jan Tschichold's masterpiece about Typography from 1925
> http://www.ucpress.edu/books/pages/5581.html

Thanks. Very interesting.

Sam


Karsten Lentzsch

unread,
Nov 30, 2002, 12:06:09 PM11/30/02
to
"Sam Patterson" <no...@nowhere.com> wrote:

> Is antialiased Java2D hand-hinted? Maybe it is
> just me who thinks that antialiased Java fonts look
> blurred and unsightly with Java2D at 10-14 points.

The J2SE 1.4 rasterizer can use hand-hints if the font
includes them. The display result quality depends on
the resolution, font type, font vendor, glyphs and
obviously the display hardware.

Karsten


Tim Tyler

unread,
Dec 1, 2002, 4:44:46 AM12/1/02
to
Sam Patterson <no...@nowhere.com> wrote:

: Maybe it is just me who thinks that antialiased Java fonts look blurred


: and unsightly with Java2D at 10-14 points.

It's not just you - I also think that there is significant room
for improvement in the quality of glyphs rendered from Java.
--
__________
|im |yler http://timtyler.org/ t...@tt1.org

Harry

unread,
Dec 1, 2002, 10:13:12 AM12/1/02
to
This is very interesting. I have assumed that the quality of displayed
text using Java could not equal that of, say, MS Word. 1.4 improvements
were very welcome but didn't seem quite enough yet. Is it really
possible using Java to have text quality as good as what one sees in MS
Word?

Harry

Sam Patterson

unread,
Dec 1, 2002, 5:26:02 PM12/1/02
to
"Tim Tyler" <t...@tt1.org> wrote in message news:H6Fpq...@bath.ac.uk...

> : Maybe it is just me who thinks that antialiased Java fonts look blurred
> : and unsightly with Java2D at 10-14 points.

> It's not just you - I also think that there is significant room
> for improvement in the quality of glyphs rendered from Java.

What can we do about it? IMHO Java will _never_ be a success on the desktop
until font handling is as good as native. We need to have this addressed by
the powers that be at Sun sooner rather than later. I wonder if it's too
late to get this into 1.5? SWT provides an alternative but I don't want to
get into another SWT vs. Swing debate...

Sam


Sam Patterson

unread,
Dec 1, 2002, 5:27:46 PM12/1/02
to
"Harry" <hb...@attglobal.net> wrote in message
news:3DEA2708...@attglobal.net...

> This is very interesting. I have assumed that the quality of displayed
> text using Java could not equal that of, say, MS Word. 1.4 improvements
> were very welcome but didn't seem quite enough yet. Is it really
> possible using Java to have text quality as good as what one sees in MS
> Word?

Yes, if you use SWT (because it uses native fonts).

Sam


Tim Tyler

unread,
Dec 2, 2002, 7:39:14 AM12/2/02
to
Sam Patterson <no...@nowhere.com> wrote:
: "Tim Tyler" <t...@tt1.org> wrote in message news:H6Fpq...@bath.ac.uk...

:> : Maybe it is just me who thinks that antialiased Java fonts look blurred
:> : and unsightly with Java2D at 10-14 points.

:> It's not just you - I also think that there is significant room
:> for improvement in the quality of glyphs rendered from Java.

: What can we do about it? IMHO Java will _never_ be a success on the desktop
: until font handling is as good as native. We need to have this addressed by
: the powers that be at Sun sooner rather than later. I wonder if it's too

: late to get this into 1.5? [...]

The biggest problem I had with Sun's font renderer was that it wasn't
portable.

It is a C++ program - and as such is not available to personal Java
environments, Midlets, Java 1.1 applets - or effectively anyone who
hasn't licensed Java 2 from Sun.

Anything short of Java 2 has no anti-aliased font capablilities at all [*].

The quality considerations seem like a secondary concern to me -
in comparison to that.

My approach to this problem is be build a pure Java font renderer.

I figure that way - if I don't like the quality of hinting provided,
at least I have the source code and can do something about it.

Also I get to run on *all* Java platforms - not just Java 2 - so
I don't cut myself off from the blossoming market of Java phones
and PDAs.

You can see the current state of my project at: http://fonteditor.org/

To quote from there:

``Pure Java Font Rendering
------------------------
We are building a pure Java font-rendering technology - targetted at
J2ME, Personal Java and Java 1.1 environments.

This will support anti-aliasing, hinting, kerning, background blending,
variable-strength emboldening, italicising and condensing - and will
allow access to a range of TrueType fonts.

Initial demonstration
---------------------
While our product is not yet complete, we are making available a
demonstration - to give an indication of the current state of play. This
is a snapshot of the Font Editor - and illustrates the anti-aliasing and
hinting features.

Goals
-----
We are hoping to be able to render high quality displays at small point
sizes from within a small footprint.
By sticking to 100% Java we expect to attain maximal portability.

We will be avoiding using floating point code in the renderer - to
accomodate J2ME profiles which lack floating point support, and to get
maximum speed on StrongARM processors - which typically lack hardware
floating point support.

Our existing code allows for automated generation of fully-hinted bold,
italic and condensed glyphs - allowing factors such as weight, angle and
aspect ratio to be controlled for every font.''

[*] Except for Microsoft's JVM - which renders fonts using the native
font renderer - which supports anti-aliasing.

Sam Patterson

unread,
Dec 2, 2002, 1:52:00 PM12/2/02
to
"Tim Tyler" <t...@tt1.org> wrote in message news:H6HsH...@bath.ac.uk...

> The biggest problem I had with Sun's font renderer was that it wasn't
> portable.

[snip]

> You can see the current state of my project at: http://fonteditor.org/

Impressive, but I imagine it would be very slow for all but the simplest of
text?

Sam


Tim Tyler

unread,
Dec 2, 2002, 3:34:56 PM12/2/02
to
Sam Patterson <no...@nowhere.com> wrote:
: "Tim Tyler" <t...@tt1.org> wrote:

:> The biggest problem I had with Sun's font renderer was that it wasn't
:> portable.

: [snip]

:> You can see the current state of my project at: http://fonteditor.org/

: Impressive, but I imagine it would be very slow for all but the simplest of
: text?

That depends on how you render. If, for example, you cache the
glyphs as bitmaps and paint them using drawImage, redraw will
be as fast as blitting bitmaps. Certainly the complexity of
the *glyphs* will be pretty-much irrelevant to rendering speed -
since glyphs will spend most of their time cached as bitmaps.

drawImage is - in my experience - pretty fast. You can see my program
redrawing using cached glyphs if you drag another window over it.
The redraw is pretty rapid. I fully expect my applet spends more
time clearing the background than it does painting the glyphs on
top of it.

Other redraw operations tend to completely rerender the glyphs from
scrach, and have to redo the anti-aliasing. That operation is currently
not terribly rapid - but it only has to be done once - and I'm a great
believer in optimising such one-off start-up costs last ;-)

Unfortunately, I don't plan to do much rendering using drawImage. I am
mainly going to want my glyphs to be "background blended" onto textured
backdrops.

Since most Java implementations - short of Java 2 - do not support
anything but binary alpha channels properly, I expect to have to do the
rendering myself - using MemoryImageSource. I don't know yet how fast
that will be.

I expect it will wind up being slower than using drawImage - but will
probably still go at a reasonable rate of knots.

Karsten Lentzsch

unread,
Dec 2, 2002, 4:24:28 PM12/2/02
to
"Harry" <hb...@attglobal.net> wrote:

> (...) I have assumed that the quality of displayed


> text using Java could not equal that of, say, MS Word.
> 1.4 improvements were very welcome but didn't seem
> quite enough yet. Is it really possible using Java to have
> text quality as good as what one sees in MS Word?

The J2SE 1.4 rasterizer can compete with MS Word
on GDI based Windows platforms, it cannot compete
with MS Word on Windows XP with ClearType enabled.

The ClearType subpixel renderer can produce superior
raster results on LCDs compared to the J2SE's default
rasterizer. Sure, you are free to build a better rasterizer
but it doesn't come out-of-the-box.

From my perspective, you can outperform the majority
of GDI based Windows native apps, if you carefully
use Java2D features like anti-aliasing, translucency,
and high-quality graphics features.

Jim Sculley

unread,
Dec 3, 2002, 1:03:18 PM12/3/02
to
Tim Tyler wrote:

<snip>

>
> You can see the current state of my project at: http://fonteditor.org/

Nice. It doesn't work with 1.4.1 though. I had to back down to 1.3.1.
Is this a known problem?

Jim S.
--
Remove my extraneous mandibular appendages to reply via e-mail

Tim Tyler

unread,
Dec 3, 2002, 2:37:10 PM12/3/02
to
Jim Sculley <nic...@wisdomteeth.tlanta.com> wrote:
: Tim Tyler wrote:

:> You can see the current state of my project at: http://fonteditor.org/

: Nice. It doesn't work with 1.4.1 though. I had to back down to 1.3.1.
: Is this a known problem?

It is not.

It works under 1.4.1_01 here when run as an application under 'doze here.

It /used/ to work under 1.4 - as an applet and an application.

I can't test whether it works when run as an applet under Sun's VM -
since the upgrade to 1.4.1_01 seems to have broken my Java plugin.

If fails with file not found errors if I enable it, and it sees an applet.

Testing under different VMs is not currently very high on the priority
list - I have to confess.

Jim Sculley

unread,
Dec 3, 2002, 4:01:18 PM12/3/02
to
Tim Tyler wrote:
> Jim Sculley <nic...@wisdomteeth.tlanta.com> wrote:
> : Tim Tyler wrote:
>
> :> You can see the current state of my project at: http://fonteditor.org/
>
> : Nice. It doesn't work with 1.4.1 though. I had to back down to 1.3.1.
> : Is this a known problem?
>
> It is not.
>
> It works under 1.4.1_01 here when run as an application under 'doze here.

D:\TEMP>java -jar fe.jar
Exception in thread "main" java.lang.NullPointerException
at cy.kj(JAX)
at cy.kk(JAX)
at cy.main(JAX)
at Run.main(JAX)

Running it as an application undr Windows NT 4.0. The stack trace isn't
much help after JAXification.

>
> It /used/ to work under 1.4 - as an applet and an application.
>
> I can't test whether it works when run as an applet under Sun's VM -
> since the upgrade to 1.4.1_01 seems to have broken my Java plugin.
>

Applet fifn't work for me either, and Webstart went off and tried to get
the 1.3 VM. A problem in the JNLP file perhaps? Or maybe JWS doesn't
support 1.4.1_01 yet, I can't recall.

> If fails with file not found errors if I enable it, and it sees an applet.
>
> Testing under different VMs is not currently very high on the priority
> list - I have to confess.

Make it run. Then make it run right. Then make it run right and fast.....

Jim Sculley

unread,
Dec 3, 2002, 6:25:13 PM12/3/02
to
Jim Sculley wrote:

<snip>

>
> D:\TEMP>java -jar fe.jar
> Exception in thread "main" java.lang.NullPointerException
> at cy.kj(JAX)
> at cy.kk(JAX)
> at cy.main(JAX)
> at Run.main(JAX)
>
> Running it as an application undr Windows NT 4.0. The stack trace isn't
> much help after JAXification.

Identical error on Linux using Blackdown 1.4.1, Sun 1.4.1_01, Sun 1.4.0
and IBM 1.4.0.

Jim S.


--
Remove my extraneous mandibular appendages to reply via e-mail.

Laurens

unread,
Nov 30, 2002, 5:08:37 AM11/30/02
to
Subpixel font rendering would be a good addition. It only really works on
LCD monitors, but there it is a huge improvement.


Regards
-Laurens


Tim Tyler

unread,
Dec 4, 2002, 11:05:41 AM12/4/02
to
Jim Sculley <nic...@wisdomteeth.tlanta.com> wrote:

: Identical error on Linux using Blackdown 1.4.1, Sun 1.4.1_01, Sun 1.4.0
: and IBM 1.4.0.

Thanks for the report. I /think/ I've found out what's going on.

I downloaded the code from the web site. It did not behave as I expected.
I had left in debugging code in the "main" method.

The symptoms would have been that it /only/ worked when run as an applet.

I've put up another version - which /should/ fix the problem - at
http://fonteditor.org/

Tim Tyler

unread,
Dec 4, 2002, 11:08:05 AM12/4/02
to
Jim Sculley <nic...@wisdomteeth.tlanta.com> wrote:

: Applet fifn't work for me either, and Webstart went off and tried to get

: the 1.3 VM. A problem in the JNLP file perhaps?

Could be. I have:

<resources>
<j2se version="1.3"/>
<jar href="fe.jar"/>
</resources>

I'll research to see whether that's what I should be using.

Jim Sculley

unread,
Dec 4, 2002, 11:45:15 AM12/4/02
to
Tim Tyler wrote:
> Jim Sculley <nic...@wisdomteeth.tlanta.com> wrote:
>
> : Identical error on Linux using Blackdown 1.4.1, Sun 1.4.1_01, Sun 1.4.0
> : and IBM 1.4.0.
>
> Thanks for the report. I /think/ I've found out what's going on.
>
> I downloaded the code from the web site. It did not behave as I expected.
> I had left in debugging code in the "main" method.
>
> The symptoms would have been that it /only/ worked when run as an applet.
>
> I've put up another version - which /should/ fix the problem - at
> http://fonteditor.org/

Yep. Works fine now.

Jim Sculley

unread,
Dec 4, 2002, 12:44:51 PM12/4/02
to
Tim Tyler wrote:
> Jim Sculley <nic...@wisdomteeth.tlanta.com> wrote:
>
> : Applet fifn't work for me either, and Webstart went off and tried to get
> : the 1.3 VM. A problem in the JNLP file perhaps?
>
> Could be. I have:
>
> <resources>
> <j2se version="1.3"/>

1.3+ may do the trick:

http://java.sun.com/products/javawebstart/docs/developersguide.html#jnlp

Tim Tyler

unread,
Dec 4, 2002, 2:51:25 PM12/4/02
to
Jim Sculley <nic...@wisdomteeth.tlanta.com> wrote:

: Tim Tyler wrote:
:> Jim Sculley <nic...@wisdomteeth.tlanta.com> wrote:

:> : Webstart went off and tried to get the 1.3 VM.

:> : A problem in the JNLP file perhaps?
:>
:> Could be. I have:
:>
:> <resources>
:> <j2se version="1.3"/>

: 1.3+ may do the trick:

Yes thanks. I've changed it to read "1.1+".

Thanks again - for continuing the feedback about the problems you were having.

0 new messages