RFR: 8360136: Support setting 'Figure Styles' while creating AWT Font

Phil Race prr at openjdk.org
Fri Jul 11 19:37:40 UTC 2025


On Sun, 6 Jul 2025 16:29:51 GMT, Valery Semenchuk <duke at openjdk.org> wrote:

> Introducing to API constants, and implementation for controlling Figure Styles
> 
> Target font: *Inter*
> 
> Example screenshot 
> 
> ![image](https://github.com/user-attachments/assets/e19af8ad-9809-4a0a-8a30-60921e490bd4)

Even if there's no easy way to verify it, there should be a test that at least uses these new values.

Also we need a CSR for this.

src/java.desktop/share/classes/java/awt/font/TextAttribute.java line 1122:

> 1120:      * <p>The constant value {@link #PROPORTIONAL_FIGURES_ON} is defined.
> 1121:      *
> 1122:      * <p>Conflicts with {@link #TABULAR_FIGURES}

True. So at an API level, should it be allowed to specify both at the same time ?
Perhaps instead the attribute should be called FIGURE_WIDTH and have values of PROPORTIONAL and TABULAR
But what about the other figure related 'standard' opentype features : lining and old style ?

https://learn.microsoft.com/en-us/typography/opentype/spec/features_ko#lnum
https://learn.microsoft.com/en-us/typography/opentype/spec/features_ko#onum

They are the same idea but it affects height / vertical positioning instead of width

So do we add FIGURE_HEIGHT too with values of LINING and OLDSTYLE ?

Or .. do we add 
FIGURE_STYLE and provide the combinations  like
TABULAR_LINING and PROPORTIONAL_OLDSTYLE ?

There'd be 16 values so I am not sure about that.
May be have the WIDTH and HEIGHT options and let people select the pairs they want.
Also it means if they 'don't care" about one or the other they can just not set it instead of thinking.

src/java.desktop/share/classes/java/awt/font/TextAttribute.java line 1130:

> 1128: 
> 1129:     /**
> 1130:      * Request to enable proprotional figures.

typo : proprotional -> proportional

-------------

PR Review: https://git.openjdk.org/jdk/pull/26144#pullrequestreview-3011621639
PR Review Comment: https://git.openjdk.org/jdk/pull/26144#discussion_r2201679599
PR Review Comment: https://git.openjdk.org/jdk/pull/26144#discussion_r2201602266


More information about the client-libs-dev mailing list