New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Lineheight of TTF and OTF not the same in Java #32
Comments
Not a font issue, I think. |
Ok thanks. So this might be a Java7 (Swing, Nimbus L&F) issue. |
I have tried http://ipanemagrafica.rede.gl/carme/ And with this font it looks like this: And the values are also the same in FontForge |
@DanielRuf I'm failing to understand how you're coming to the conclusion that the problem is in the fonts. Do you happen to know how Java7 does vertical layout, and which data it collects from the fonts to accomplish it? |
I will recheck this. Hopefully Oracle/the OpenJDK team can confirm that this is a bug but he says it is not a Java or Nimbus/Swing but but in the font files: http://stackoverflow.com/a/18462739/753676 But I think you are rgiht. What I don't understand is why this happens (this has to be a bug in Java) but even this experienced (Java) user on Stackoverflow tells me something other (but he did not prove the opposite) Currently this bug is unfortunately a blocker for an application but I am very sure that this is a Java bug (hopefully Oracle will react much faster this time to provide a solution) I will use this issue here for the bug report to Oracle because here we have the fonts, links, screenshots and additional information (source code of the files) |
OK, please keep us posted. We appreciate your feedback, and we're open to consider tweaking the fonts. But as far as I can tell this vertical difference in the layout should not be happening, because the two font formats have exactly the same vertical metrics that are used by apps when they layout things vertically. Those values are in the OS/2 table -- sTypoAscender, sTypoDescender, sTypoLineGap, usWinAscent, usWinDescent -- and in the hhea table -- Ascender, Descender, LineGap. |
Thanks for the info about the important values so I know where to look exactly. Sure, I will keep you posted. |
@miguelsousa http://onlinefontconverter.com/font Here is a zip file with the old and new files which were processed by the online font converter tool: |
Is the vertical spacing of the modified fonts like the original OTF or like the original TTF? Screenshots please. |
@miguelsousa They both lokk same in the browser: I do not see any difference in the height or vertical spacing? |
I did look at the fonts. They have too many differences from the original, so my comparison was inconclusive. (If you're interested in comparing the fonts, the best way is to convert them to XML using TTX http://sourceforge.net/projects/fonttools/) I also compiled the Java examples and my results were:
Below are the screenshots I took. I still don't understand why the TTFs and the OTFs are not aligning the same way. But one thing I can say (from looking at the TTX dumps) is that all 4 fonts have the same vertical metrics values in the OS/2 table. So, taking this info and the results into account, my guess for what's happening is: |
Also the original OTF and TTF are a bit different. The font weight seems to be different/one of the fonts looks more crips and the other a bit more blurry (is this a feature of OTF compared to TTF?). Right, this is what the others also found out. But fixing the fonts also fixed the OTF font version. mkorbel at stackoverflow always says that it is not a Java bug (fonts were fixed by the online font converter tool and it works now). So how should B possible? It seems we have to ask some other experts and need some more info why this is happening. |
This is due to the different outline formats and to the rasterizers that render the glyphs.
You're saying that the fonts are fixed yet the TTF modified image and the OTF modified image are significantly different in terms of vertical spacing. So what does "fixed" mean to you? I thought it meant TTF = OTF.
I read the thread and I see nowhere being explained WHY it's not a Java bug. Does mkorbel have access to Java's source code? Does he know how Java uses the font data internally?
Which ones? Certainly not the ones you pointed me to, because as you can see above TTF modified does NOT look the same as OTF modified.
A, B and C are just my guesses; to know for sure you'd have to ask someone at Oracle who's familiar with the internals of Java in regards to font handling.
If my guesses A and B are correct, than the answer is No. The fix would have to be made on the Java source code. That fix being: For OpenType fonts (.otf) use the values in the OS/2 table.
Agree. You should try to find a developer of Java (not a Java developer) that knows about how the fonts are handled internally.
Err, I am a font expert. I've gone above and beyond to test this issue, and I thought I had made my argument about this issue not being a font bug very clear. But you're more than welcome to seek a second opinion. |
@miguelsousa which Java version did you use? I used Java 7 U45. Sorry for the part about the font expert, I did not know or know very little about you and how you are involved with this. Currently there are the arguments from the Stackoverflow user mkorbel vs your arguments and me in between. But I believe that you know more about the fonts and the rasterizers and values than mkorbel. |
If you don't mind my asking, why is it important to you to have parity between OTF and TTF in Java? |
Because OTF fonts in Java are supported in almost all operating systems but I think TTF not? Or is this chart outdated for Java? |
I would say it's the opposite. Because it's an earlier format, TTF fonts are supported in more places than OTF fonts. |
Mh, so TTF is better? But OTF hs more features compared to OTF or am I wrong? Like ligatures? |
It's not a matter of being better or worse, it's a matter of working better or worse depending on the platform you're deploying the fonts on. TTF fonts can have as many OpenType features as OTF fonts. I can't speak for other fonts, but in Source Sans you'll get exactly the same functionality regardless of the font format you choose. Apart from the differences in the format of the outlines, the OTF and TTF files are basically identical. |
my view (just copy-paste my comment from OPs question, with a few fixes) in several points
addendum, I can't resist
|
I'm sure there are other projects out there that provide the fonts in both formats, but I can't think of any right now. |
There are some fonts with OTF and TTF version on http://fontsquirrel.com and http://ipanemagrafica.rede.gl/carme/ |
better, for example FiraSansOT-Regular.otf caused with this issue, but only for JComboBox (win7/8 java6/7) |
reference codes for testing Fonts on fly http://stackoverflow.com/questions/9311720/how-to-change-jlabel-font-size-to-fill-jpanel-free-space-while-resizing |
So it is a Java bug? |
not or yes I think BasicComboBoxRenderer that is responsible for standard painting in those fonts correctly, you can to find some layout disproporcies on selection for standard Fonts (Win8) in JComboBoxes JList, Items have got very different layout and they aren't correctly laid by comparing with the same selection in MsWord/Excell2013 e.g. Aharoni, Blackadder ITC, Corbel (my endless lazyness to kill me to continue...) |
"not or yes" I would say yes, definitely. |
:-) excluding fact that tested in MsOffice2013, this isn't quilified SW for comparing, there are milions dollars for simple development, issue with font isn't there allowed you can try to create a new trace in BugParade, |
@mKorbel "you can try to create a new trace in BugParade" Sorry but your english is very hard to read. |
@miguelsousa still not fixed =( and @mKorbel did not help at all, so this will not be fixed in the font itself but Java (Oracle) has to provide a patch? I have filed a bug in the past, got a bug ID but it seems the bug search does not find a bug report for this ID |
I know this problem is not resolved, but it's not a font bug, so I closed this issue. |
ok, I hope Oracle and their community reacts and finally fixes this bug! =( |
Hope so too. |
There are some differences when I am using the fonts on Windows 7 in Java 7 (Swing):
ttf:
otf:
Seems the lineheight varies btween those 2. Is this issue related to the fonts themself or is it a Swing issue?
@miguelsousa @adobe
https://forums.oracle.com/thread/2573652
The text was updated successfully, but these errors were encountered: