-
Bug
-
Resolution: Fixed
-
P4
-
7, 8, 11
-
b14
-
generic
-
generic
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8230070 | 11.0.6-oracle | Philip Race | P2 | Resolved | Fixed | b01 |
JDK-8230811 | 11.0.5-oracle | Martin Balao Alonso | P4 | Resolved | Fixed | b09 |
JDK-8222886 | 11.0.4 | Martin Balao Alonso | P4 | Resolved | Fixed | b01 |
JDK-8228386 | openjdk8u232 | Martin Balao Alonso | P4 | Resolved | Fixed | b01 |
JDK-8240054 | openjdk7u | Martin Balao Alonso | P4 | Resolved | Fixed | master |
This bug was noticed in JDK-11 with Z003-MediumItalic.otf font (1px, italic + bold style, default rendering mode). Char point 37 width was greater than the max advance (2px vs. 1px). Libfreetype 2.6 font rendering library in Linux was used.
A test case that reproduces the above scenario is attached to this ticket. Note: test case works before changset for
Test case failure message is:
Testing java.awt.Font[family=Z003,name=Z003-MediumItalic,style=bolditalic,size=1] in FT_LOAD_TARGET_MONO
getMaxAdvance: 1
Exception in thread "main" java.lang.Exception: FAILED: getMaxAdvance is not max for font: java.awt.Font[family=Z003,name=Z003-MediumItalic,style=bolditalic,size=1]getMaxAdvance(): 1getWidths()[37]: 2
at MaxAdvanceIsMax.main(MaxAdvanceIsMax.java:135)
Expected value is:
"TEST PASS - OK"
The root cause of this bug is well understood. FontMetrics.getMaxAdvance value is based on a font file attribute and the scale. Assuming the font file attribute is correct, the effects of applying algorithmic bold are not taken into account at all. On the other hand, FontMetrics.charWidth renders the glyph (a bitmap previous to
We can compare this issue with algorithmic obliqueness. The difference is that FontMetrics.getMaxAdvance takes into account the effect of applying obliqueness and adds a value based on Libfreetype internals.
One possible way to fix this issue would be to follow the same strategy and add a value, taken from Libfreetype internals, in case of algorithmic bold. The Libfreetype function related to algorithmic bold is FT_GlyphSlot_Embolden.
As part of this ticket, we propose to update algorithmic obliqueness value to align with the current libfreetype version (2.9.1).
- backported by
-
JDK-8230070 FontMetrics.getMaxAdvance may be less than the maximum FontMetrics.charWidth
- Resolved
-
JDK-8222886 FontMetrics.getMaxAdvance may be less than the maximum FontMetrics.charWidth
- Resolved
-
JDK-8228386 FontMetrics.getMaxAdvance may be less than the maximum FontMetrics.charWidth
- Resolved
-
JDK-8230811 FontMetrics.getMaxAdvance may be less than the maximum FontMetrics.charWidth
- Resolved
-
JDK-8240054 FontMetrics.getMaxAdvance may be less than the maximum FontMetrics.charWidth
- Resolved
- relates to
-
JDK-8017773 OpenJDK7 returns incorrect TrueType font metrics
- Resolved
-
JDK-8221304 Problem list java/awt/FontMetrics/MaxAdvanceIsMax.java
- Resolved
-
JDK-8230672 Specification for java.awt.FontMetrics.getMaxAdvance() is too prescriptive.
- Resolved