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 662472 - failure to correctly autofit row
failure to correctly autofit row
Status: RESOLVED FIXED
Product: Gnumeric
Classification: Applications
Component: GUI
git master
Other Linux
: Normal normal
: ---
Assigned To: Jody Goldberg
Jody Goldberg
Depends on:
Blocks:
 
 
Reported: 2011-10-22 18:44 UTC by Andreas J. Guelzow
Modified: 2011-10-28 18:25 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
proposed patch (1.10 KB, patch)
2011-10-28 07:12 UTC, Andreas J. Guelzow
none Details | Review

Description Andreas J. Guelzow 2011-10-22 18:44:24 UTC
in F10: =pi()*10000
format F10 to scientific number with superscript
turn on extension markers in view->viewproperties
select row 10 and request autofit.

Note that the content in A10 is still truncated at the bottom.
Comment 1 Andreas J. Guelzow 2011-10-28 06:15:50 UTC
Okay we have:

	if (!VALUE_IS_STRING (cell->value)) {
		/*
		 * Mildly cheating to avoid performance problems, See bug
		 * 359392.  This assumes that non-strings do not wrap and
		 * that they are all the same height, more or less.
		 */
		Sheet const *sheet = cell->base.sheet;
		height =  gnm_style_get_pango_height (gnm_cell_get_style (cell),
                sheet->rendered_values->context,
	        sheet->last_zoom_factor_used);
	} else {

and in gnm_style_get_pango_height:

{
	PangoAttrList *attrs = gnm_style_get_pango_attrs (style, context, zoom);

	if (style->pango_attrs_height == -1) {
		int h;
		PangoLayout *layout = pango_layout_new (context);
		pango_layout_set_attributes (layout, attrs);
		pango_layout_set_text (layout, "+1.23456789E-01", -1);
		pango_layout_get_pixel_size (layout, NULL, &h);
		g_object_unref (layout);
		((GnmStyle *)style)->pango_attrs_height = h;
	}

	pango_attr_list_unref (attrs);
	return style->pango_attrs_height;
}

so we are using only the attributes of the style and not of the number format.

I would think that if we have a valid rendered value at the given zoom level we should use it!

Alternatively we could look at the number format and if it is a scientific format with superscript, we should apply said superscript to the sample text.
Comment 2 Andreas J. Guelzow 2011-10-28 07:12:38 UTC
Created attachment 200157 [details] [review]
proposed patch

Before evaluating this patch one might want to read bug #359392 and check the current performance.
Comment 3 Andreas J. Guelzow 2011-10-28 18:25:14 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.