Are more font variants in the pipeline?
philip.race at oracle.com
Fri Aug 17 09:49:41 PDT 2012
The creators of related FX 1.X API exposed a lot of API that
was present on the Java 2D APIs as it was basically sitting on top of all
the existing AWT/2D/Swing APIs which had similar API.
But unbeknown to the FX 1.X API designers the width/weight support they
were calling down to didn't really as do much of what it appeared to support
as you might hope. At least not on the Sun implementation.
FX 2 has even less (zero) of that since Prism etc. is a new stack entirely.
So we are starting from square one and such API was 100% non-functional
so was removed until such time as there could be an implementation to
On 8/17/2012 8:30 AM, Randahl Fink Isaksen wrote:
> Yes Richard, I am able to load the font properly using code like this:
> URL openSansSemiboldUrl = getClass().getResource("/fonts/OpenSans-Semibold-webfont.ttf");
> Font openSansSemiboldFont = Font.loadFont(openSansSemiboldUrl.toString(), 12);
> The font is loaded just fine, and it even has properties telling that it is the semibold variant I have loaded.
> What I don't get is, why was the support for styling with these variants abandoned from JavaFX 1.x to 2.x? If you look here, you will see that constants like SEMI_BOLD, LIGHT etc. used to be supported:
> As Phil just mentioned, I can also style my App with the font using a full font name like this
> -fx-font-family: "Open Sans Semibold";
> But the problem with this approach is, I get the font family dependency spread out over all of my CSS code (many lines containing "Open Sans").
> In stead I was hoping to be able to just style my application using
> -fx-font-weight: semibold;
> thereby only choosing the "Open Sans" font once, and letting different part of my app use different weights.
> Again, I do not get why support for this was removed from JavaFX.
> On Aug 17, 2012, at 16:50 , Richard Bair<Richard.Bair at oracle.com> wrote:
>> Are you able to get the font in Extrabold from within Java code? That is, do you know the problem is CSS or is it in the platform itself?
>> On Aug 17, 2012, at 6:48 AM, Randahl Fink Isaksen wrote:
>>> I noticed that the current CSS implementation only supports regular fonts, italic fonts, and bold fonts.
>>> Many modern fonts come in more variants – Open Sans, for instance, comes in variants
>>> Light, Regular, Italic, Light Italic, Bold, Extrabold, Semibold, Bold Italic, Extrabold Italic, and Semibold Italic.
>>> Have I overlooked something or am I right that it is impossible to style a JavaFX app using CSS and get one of these variants, say, Open Sans Semibold?
More information about the openjfx-dev