[Bug 61169] New: Text with Japanese characters overflows textbox

classic Classic list List threaded Threaded
13 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[Bug 61169] New: Text with Japanese characters overflows textbox

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

            Bug ID: 61169
           Summary: Text with Japanese characters overflows textbox
           Product: POI
           Version: 3.16-FINAL
          Hardware: PC
            Status: NEW
          Severity: normal
          Priority: P2
         Component: XSLF
          Assignee: [hidden email]
          Reporter: [hidden email]
  Target Milestone: ---

Created attachment 35041
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=35041&action=edit
Java repro case

When using the XSLF API, text with Japanese characters (left-to-right)
overflows the textbox, even when using default styling (default font family,
size and style).

--
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
|  
Report Content as Inappropriate

[Bug 61169] Text with Japanese characters overflows textbox

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

--- Comment #1 from François Beaune <[hidden email]> ---
Created attachment 35042
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=35042&action=edit
PowerPoint file generated by repro case

--
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
|  
Report Content as Inappropriate

[Bug 61169] Text with Japanese characters overflows textbox

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=61169

Andreas Beeker <[hidden email]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 OS|                            |All

--- Comment #2 from Andreas Beeker <[hidden email]> ---
tl;dr: the textbox is too short because of an undefined/unregistered font and
there is an issue in calculating the text height / width in POI.

There are a few issues with the current rendering code, which also applies for
calculating the text height:
- the textbox indents are ignored when the text height is calculated
- you need to register a font having those japanese glyphs in
- my test font (mona) has a textlayout leading of 0, hence the leading need to
be fixed somehow

The rendering in Libre Office seems to use some kind of tracking (= opposite of
kerning). Although the Tracking attribute can be added to the AttributedString,
this is ignored when breaking the text. An alternative to modify the registered
font [1] doesn't work.


[1] https://stackoverflow.com/questions/13229725

--
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
|  
Report Content as Inappropriate

[Bug 61169] Text with Japanese characters overflows textbox

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=61169

--- Comment #3 from Andreas Beeker <[hidden email]> ---
for the records, the corresponding SO issue:
https://stackoverflow.com/questions/44438618

--
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
|  
Report Content as Inappropriate

[Bug 61169] Text with Japanese characters overflows textbox

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=61169

--- Comment #4 from Andreas Beeker <[hidden email]> ---
"LineBreakMeasurer does not measure correctly if TextAttribute.TRACKING is
set."
https://bugs.openjdk.java.net/browse/JDK-8165943
(Affects Version/s: 6.0, 7, 8, 8u102, 9)

To recap: Libre Office uses more lines to display the text, because the glyphs
are wider spread opposed to the Java rendering. Although the rendering can be
modified with the TRACKING attribute, the linebreak measurer is not taking it
into account.

Maybe it's possible to copy&adapt the standard linebreak measurer ...

--
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
|  
Report Content as Inappropriate

[Bug 61169] Text with Japanese characters overflows textbox

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=61169

Andreas Beeker <[hidden email]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|XSLF                        |SL Common
           Hardware|PC                          |All

--
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
|  
Report Content as Inappropriate

[Bug 61169] Text with Japanese characters overflows textbox

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=61169

--- Comment #5 from Andreas Beeker <[hidden email]> ---
Created attachment 35059
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=35059&action=edit
Test class with registered font

--
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
|  
Report Content as Inappropriate

[Bug 61169] Text with Japanese characters overflows textbox

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=61169

Andreas Beeker <[hidden email]> changed:

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

--- Comment #6 from Andreas Beeker <[hidden email]> ---
Added a (partial *) ) fix via r1798986

Lets forget about the tracking issue mentioned above - you need to specify also
the "ea" attribute for asian fonts - see my test class.

*) ... at least for the Mona font, the rendering output is similar to the libre
office dimensions, so I'm closing this now.

--
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
|  
Report Content as Inappropriate

[Bug 61169] Text with Japanese characters overflows textbox

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=61169

Andreas Beeker <[hidden email]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Blocks|                            |45140


Referenced Bugs:

https://bz.apache.org/bugzilla/show_bug.cgi?id=45140
[Bug 45140] TextShape.resizeToFitText() Not Properly Sizing TextShape
--
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
|  
Report Content as Inappropriate

[Bug 61169] Text with Japanese characters overflows textbox

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=61169

--- Comment #7 from François Beaune <[hidden email]> ---
Thanks for the updates and the fix Andreas. We just tried our repro case with
the latest Apache POI cloned from GitHub.

Unfortunately it looks like it doesn't entirely fix our problem. On Windows,
there is pretty much no difference between Apache POI 3.16 Final and Git master
as of today (with your fix). On Linux, the box is indeed taller but it still
doesn't enclose all the text, see my latest attachment.

--
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
|  
Report Content as Inappropriate

[Bug 61169] Text with Japanese characters overflows textbox

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=61169

--- Comment #8 from François Beaune <[hidden email]> ---
Created attachment 35076
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=35076&action=edit
Result when using Apache POI (commit a753adb84805ff0f7b7385905780b07e5fe9e4ab
on GitHub)

--
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
|  
Report Content as Inappropriate

[Bug 61169] Text with Japanese characters overflows textbox

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=61169

François Beaune <[hidden email]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|FIXED                       |---

--
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
|  
Report Content as Inappropriate

[Bug 61169] Text with Japanese characters overflows textbox

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=61169

--- Comment #9 from Andreas Beeker <[hidden email]> ---
add resize methods with Graphics argument via r1801329

I still need to provide new methods to specify the charset - for east asian and
complex script fonts, otherwise Libre Office and probably also Office don't use
the set font family but default to something else, which renders futile any
textbox calculation.

--
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]

Loading...