Are more font variants in the pipeline?
Randahl Fink Isaksen
randahl at rockit.dk
Fri Aug 17 08:30:20 PDT 2012
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:
http://docs.oracle.com/cd/E17802_01/javafx/javafx/1.1/docs/api/javafx.scene.text/javafx.scene.text.FontWeight.html
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.
Yours
Randahl
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?
>
> Thanks
> Richard
>
> 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?
>>
>> Randahl
>>
>>
>
More information about the openjfx-dev
mailing list