After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 584380 - Fraction format alignment
Fraction format alignment
Status: RESOLVED FIXED
Product: libgoffice
Classification: Other
Component: General
unspecified
Other All
: Normal minor
: ---
Assigned To: Andreas J. Guelzow
Jody Goldberg
Depends on:
Blocks:
 
 
Reported: 2009-05-31 17:35 UTC by Andreas J. Guelzow
Modified: 2011-08-02 06:32 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
screen shot showing the misalignment (12.55 KB, image/png)
2009-05-31 17:37 UTC, Andreas J. Guelzow
  Details
proposed patch to goffice (2.01 KB, patch)
2011-06-06 01:53 UTC, Andreas J. Guelzow
none Details | Review
proposed patch to goffice (2.15 KB, patch)
2011-06-06 02:10 UTC, Andreas J. Guelzow
none Details | Review
screenshot (74.74 KB, image/png)
2011-08-02 03:57 UTC, Andreas J. Guelzow
  Details

Description Andreas J. Guelzow 2009-05-31 17:35:44 UTC
The alignment of fractions seems to depend on the font and so does not work coirrectly for variable width fonts.

The screen shot on the next page shows two column of the same values, the second column formatted as "# ?/2". I would expec tthe "3" to line up. (The fact that the "3" is not on the right of the cell seems to indicate that it is intended to line up.)
Comment 1 Andreas J. Guelzow 2009-05-31 17:37:57 UTC
Created attachment 135680 [details]
screen shot showing the misalignment
Comment 2 Morten Welinder 2009-05-31 22:08:03 UTC
Correct.  All alignment we do -- including the fill operator -- depends on
the font.  I don't think there is much we can do in terms of a proper fix 
with a reasonable amount of work.  PangoLayouts just aren't meant for this.

In this case there is one think we ought to check: if we're formatting to
a PangoLayout (as opposed to a string) we could probably use different kinds
of whitespace characters to get a better match.
Comment 3 Andreas J. Guelzow 2009-05-31 22:32:33 UTC
If we are going directly into a PangoLayout, then we also have tab stops available and we might be able to use them.
Comment 4 Morten Welinder 2009-09-25 01:20:22 UTC
> I don't think there is much we can do in terms of a proper fix 
> with a reasonable amount of work.  PangoLayouts just aren't meant for this.

This is not correct, at least not anymore.  We can set the exact width of
a space (or any other character if we wish) using an attribute from
pango_attr_shape_new.
Comment 5 Andreas J. Guelzow 2011-06-06 01:53:33 UTC
Created attachment 189285 [details] [review]
proposed patch to goffice

This patch would fix this issue by using one or more appropriately sized spaces. (In most scripts it will be a single space).

This patch requires the patches from bug #651561.
Comment 6 Andreas J. Guelzow 2011-06-06 02:10:32 UTC
Created attachment 189286 [details] [review]
proposed patch to goffice

We need to avoid trying to use this for graph ticks since their layouts have no fontmap yet.
Comment 7 Andreas J. Guelzow 2011-08-02 03:12:16 UTC
This problem has been fixed in the development version. The fix will be available in the next major software release. Thank you for your bug report.
Comment 8 Andreas J. Guelzow 2011-08-02 03:57:53 UTC
Created attachment 193026 [details]
screenshot

Well the fix committed works fine for single digit denominators but it doesn't cover the case of multiple digit denominators when the numerators could be 1, 2, ... digits. See the attached screenshot.
Comment 9 Andreas J. Guelzow 2011-08-02 06:32:23 UTC
hopefully really fixed now. (If a font is used where the digits have different width this may still be incorrect but we'll address that when we get there.)

This problem has been fixed in the development version. The fix will be available in the next major software release. Thank you for your bug report.