LCD text in Canvas
james.graham at oracle.com
Thu Dec 20 16:43:18 PST 2012
One issue with canvas is that LCD text needs to be rendered when the
device space transform is known. With Canvas we know what the pixel
space is of the backing raster, but the transform that is applied when
we render the backing raster to the screen (which is probably identity
in many common cases) can wreak havoc with the sub-pixel work we did on
the text. If we provided a control for it on GraphicsContext then you'd
have to commit to not involving the canvas in any transforms except for
Also, I'd have to think about how this would be affected by HiDPI as
well. The typical Apple retina screen would be a simple 2x scale so the
same integer translate restriction would still work fine, but I haven't
delved too deep into what scaling options Windows 8 offers...
On 12/17/2012 12:23 AM, John C. Turnbull wrote:
> The way I see it, Canvas is certainly for dynamic rendering but that's not
> to say that LCD text would need to be animated (although it would be
> absolutely wonderful if it could be). I am thinking of developing some
> sophisticated controls which have a very dynamic nature and, as I said, I
> want the text in those controls to be as crisp and clear as the other more
> "standard/static" controls.
> For the uninitiated, what exactly is the problem with animating LCD text
> anyway? It seems to be possible in Flash, Silverlight and even in HTML 5 so
> why should it not be possible in JavaFX?
> -----Original Message-----
> From: Joseph Andresen [mailto:joseph.andresen at oracle.com]
> Sent: Monday, 17 December 2012 16:14
> To: ozemale at ozemail.com.au
> Cc: Phil Race; John C. Turnbull; openjfx-dev at openjdk.java.net
> Subject: Re: LCD text in Canvas
> It would really help if you could explain your use cases.
> Canvas is meant for very dynamic rendering, and I don't really want to say
> LCD text isn't, but it certainly is not meant to be animated. Hmm...
> On Dec 16, 2012, at 3:14 PM, ozemale at ozemail.com.au wrote:
>> I think for the vast majority of use cases we would want LCD text in
>> Canvas. The current grayscale antialiasing is just too blurry and is
>> very noticeably different in rendering quality to the text used in
>> I am thinking that adding a single method to set the smoothing type
>> for text would not cause too much bloat in the API. I am officially
>> requesting it!
>> ----- Original Message -----
>> From: "Phil Race"
>> To:"John C. Turnbull"
>> Cc:"Dr. Michael Paus" ,
>> Sent:Sun, 16 Dec 2012 14:25:17 -0800
>> Subject:Re: LCD text in Canvas
>> We could easily add API to support LCD text on Canvas although we
>> wanted to minimise the amount of Text related API there until we have
>> more experience with how people use it and how it should be developed
>> in general.
>> The blurriness is down to the grayscale text being unhinted so it
>> behaves predictably under transformations as supposed to be the most
>> typical canvas uses case. This is also why its the default on a Text
>> On 12/16/12 7:16 AM, John C. Turnbull wrote:
>>> Yes sorry, I was referring to LCD font rendering (or sub-pixel
>>> antialiasing). It seems JavaFX text controls support this but text
>>> in Canvas is always using gray-scale antialiasing and looks blurry
>>> comparison as a result.
>>> -----Original Message-----
>>> From: openjfx-dev-bounces at openjdk.java.net
>>> [mailto:openjfx-dev-bounces at openjdk.java.net] On Behalf Of Dr.
>> Michael Paus
>>> Sent: Monday, 17 December 2012 00:36
>>> To: openjfx-dev at openjdk.java.net
>>> Subject: Re: LCD text in Canvas
>>> I am quite sure the OP is referring to this:
>>> Whether that is or will be supported for Cancas - I don't know.
>>> Am 16.12.2012 11:49, schrieb Tom Eugelink:
>>>> I think Canvas will never support that, just like a real world
>>>> painting canvas will never support a Rembrand. You'll have to
>>>> LCD yourself But Gerrit has created a few LCD gauges in the
>>>> project, maybe those will help.
>>>> On 2012-12-16 10:33, John C. Turnbull wrote:
>>>>> When will JavaFX Canvas support LCD text?
>>> Dr. Michael Paus, Chairman of the Java User Group Stuttgart e.V.
>>> For more information visit www.jugs.de.
More information about the openjfx-dev