[Bug 60282] New: getFontHeight() has wrong type

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

[Bug 60282] New: getFontHeight() has wrong type

Bugzilla from bugzilla@apache.org
https://bz.apache.org/bugzilla/show_bug.cgi?id=60282

            Bug ID: 60282
           Summary: getFontHeight() has wrong type
           Product: POI
           Version: unspecified
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: HSSF
          Assignee: [hidden email]
          Reporter: [hidden email]

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);
    }

--
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

[Bug 60282] getFontHeightInPoints() has wrong type

Bugzilla from bugzilla@apache.org
https://bz.apache.org/bugzilla/show_bug.cgi?id=60282

najh <[hidden email]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|getFontHeight() has wrong   |getFontHeightInPoints() has
                   |type                        |wrong type

--
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

[Bug 60282] getFontHeightInPoints() has wrong type

Bugzilla from bugzilla@apache.org
In reply to this post by Bugzilla from bugzilla@apache.org
https://bz.apache.org/bugzilla/show_bug.cgi?id=60282

--- Comment #1 from Javen O'Neal <[hidden email]> ---
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.

--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

[Bug 60282] getFontHeightInPoints() has wrong type

Bugzilla from bugzilla@apache.org
In reply to this post by Bugzilla from bugzilla@apache.org
https://bz.apache.org/bugzilla/show_bug.cgi?id=60282

Dominik Stadler <[hidden email]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |WONTFIX

--- Comment #2 from Dominik Stadler <[hidden email]> ---
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.

--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]