Hey Felipe,

I recall a couple of years ago when Phil drilled it into me that Font size was pixels. So when you said that Font size is point, I was skeptical. But, indeed, you are correct and I am mistaken.

I see now that setting font size from point units in our CSS is broken. Our CSS implementation will convert -fx-font-size: 12pt; to 9px since CSS says that 72/96th of a point equals a pixel. But that should convert to 12px. Fortunately, modena and caspian are all pixel based units.

It is important to note that if the assertion that DPI=72 ever changes, then CSS will be broken since I've (incorrectly) assumed all along that Font size is pixels.

On 3/6/14, 1:47 PM, Felipe Heidrich wrote:
On Mar 5, 2014, at 3:18 PM, Tom Schindl <tom.schi...@bestsolution.at> wrote:

Why can't JavaFX not at least provide a font-API to create fonts with point?

The current JavaFX API is point (see the doc).
The thing is, on the desktop it uses DPI=72, so px=pt.
In the printer the actual device DPI is used (so that 72pt=1in on the paper).

Note, Mac is exactly the same,  see the doc for CTFontRef for example
https://developer.apple.com/library/mac/documentation/Carbon/Reference/CTFontRef/Reference/reference.html#//apple_ref/doc/uid/TP40005110
It talks about point size the very same way JavaFX does.

That is so true that the very value passed to Font.font(double) is passed to 
CTFontCreateWithName() in CTFontStrike.java as is.
The same is true for Windows, using DirectWrite and Linux, using FreeType.


Felipe


Reply via email to