short getFontHeight() Get the font height in unit's of 1/20th of a point. Type short is wrong. There must be a double. The font size can be for example 8.5. Now it returns 8, throwing a fractional part. 170 / 20 =8,5 from HSSFFont: public short getFontHeightInPoints() { return ( short ) (font.getFontHeight() / 20); } from XSSFFont: public short getFontHeightInPoints() { return (short)(getFontHeight()/20); }
Unfortunately, changing the return type of this method would break backwards compatibility. If you need the accuracy of fractional points, perform this computation yourself using getFontHeight. We could add a warning in the JavaDoc that fractional values are discarded. We could also make the 20 constant a public constant in Font. Otherwise we could try to change the return type through some slow deprecation process.
As described the migration to different API would be a long and tedious process. Also some of the underlying formats store the 1/20th as integer-value, so they cannot represent the decimal value anyway. Therefore I think we should stick with what we have right now as you can use the InPoints() for the raw value and do computations yourself in double-precision if necessary. Updated comments and introduced a common constant Font.TWIPS_PER_POINT for the "20" via r1874966.