CSS Font size in points doesn't match Node.Font.Size

Stephen F Northover steve.x.northover at oracle.com
Wed Mar 5 14:45:14 PST 2014

Hi all,

To change the Java API now would break the universe.  All you can do is 
add new API.  This can be in the form of new methods on Font, however 
things like Font.getSize() must always return pixels.  A new method can 
be added getPoints() and new constructors that take points added, or 
perhaps a boolean parameter that says the the double parameter is in 
points, not pixels.  A global mode would be horrible and error prone 
(unless I am missing something).


On 2014-03-05 5:19 PM, Tom Schindl wrote:
>  From my tests the font size generated by CSS is what one gets with the same point size and font using native apps and Qt - my complaint was the font size when using the Java API.
> Tom
> Von meinem iPhone gesendet
>> Am 05.03.2014 um 23:03 schrieb Felipe Heidrich <felipe.heidrich at oracle.com>:
>> The problem is that point size used by Node and point size used by CSS are not the same.
>> One uses a 72 DPI and the other 96. Thus the final pixel sizes are different.
>> I don’t see how to change one or the other without breaking a ton of people.
>> Maybe adding a global font DPI so that Node can be made to match CSS ?
>> Suggestions ?
>> Felipe
>>> On Mar 5, 2014, at 12:39 PM, Pedro Duque Vieira <pedro.duquevieira at gmail.com> wrote:
>>> Hi Tom, Jeff, Felipe...
>>> Having bugs stay in to maintain backwards compatibility sounds very weird
>>> to me IMHO.
>>> If we go down that road aren't we creating a library that will some day
>>> have too many glitches and as such less appeal to programmers looking for
>>> UI libraries?
>>> Thanks,
>>>> Hi
>>>>> On Mar 4, 2014, at 4:42 PM, Jeff Martin <jeff at reportmill.com> wrote:
>>>>> Thanks Tom! I assume the thread was this one:
>>>>>      Font.font() says it is point size but it looks like it are pixels
>>>> http://mail.openjdk.java.net/pipermail/openjfx-dev/2014-January/012398.html
>>>>> I guess the final word is that CSS assumes 1pt==1/92in,
>>>> Yes
>>>>> and Nodes convert that to the real world on render?
>>>> On the printer yes, on the display it assumes 72 (pt=px).
>>>>> And that this is basically a bug, but it can't be fixed due to legacy
>>>> considerations?
>>>> Yes
>>>> Felipe
>>> -- 
>>> Pedro Duque Vieira

More information about the openjfx-dev mailing list