Re: HiDPI (Retina) support



Please file this at bugzilla.gnome.org, product gnumeric, so it
won't get lost.

I don't think it's the compeltely right way to do this, though.  Pango
ought to supply a 10pt font when we ask it to.  We should not have
to scale by hand.  Actual debugging will probably have to wait until
we happen to end up with hardware of that nature.

Morten



On Thu, Mar 20, 2014 at 8:53 AM, Vanja Z <vanja_z yahoo com> wrote:
Hi Guys,

I'm a long time user of Gnumeric and just got a 13" Macbook Retina (to run GNU/Linux on). In case anyone is 
unfamiliar, this computer has a 2560x1600 screen with a 13" diagonal so the pixel density is around double 
the usual. This makes unmodified programs appear tiny. I think high DPI displays will become more common on 
the desktop soon with the rise of 4K displays.

To my delight, Gnumeric already has a DPI setting which defaults to 96. I doubled it to 192 and most things 
look good however the text appearing in cells is not effected and remains tiny compared to the increased 
size of the cells. I've come up with a simple patch (below) that also scales the text displayed in cells 
and in the item edit area.

Since I am completely unfamiliar with the code this patch may be done in a silly way but the result looks 
good on my computer. I was hoping that it would be possible to have this improvement added to Gnumeric.


Can somebody let me know what the correct way to submit patches to the project is? I have some other things 
I would like to work on in the future.


Regards,
Vanja


--- src/item-edit.orig.c
+++ src/item-edit.c
@@ -34,6 +34,7 @@
 #include "wbc-gtk.h"
 #include "gui-util.h"
 #include "widgets/gnumeric-expr-entry.h"
+#include "application.h"
 #define GNUMERIC_ITEM "EDIT"

 #include <gtk/gtk.h>
@@ -397,6 +398,7 @@
 {
        GnmItemEdit *ie = GNM_ITEM_EDIT (item);
        double scale = item->canvas->pixels_per_unit;
+       double font_scale = scale*gnm_app_display_dpi_get(FALSE)/96.;

        if (ie->gfont != NULL) {
                GtkWidget const  *canvas = GTK_WIDGET (item->canvas);
@@ -444,7 +446,7 @@
                        pango_attr_list_insert (attrs, attr);
                }
                pango_attr_list_insert_before (attrs,
-                                              pango_attr_scale_new (scale));
+                                              pango_attr_scale_new (font_scale));

                pango_layout_set_attributes (ie->layout, attrs);
                pango_attr_list_unref (attrs);

--- src/cell.orig.c
+++ src/cell.c
@@ -24,6 +24,7 @@
 #include "number-match.h"
 #include "sheet-style.h"
 #include "parse-util.h"
+#include "application.h"

 #include <goffice/goffice.h>

@@ -590,7 +591,8 @@
        rv = gnm_rendered_value_new (cell,
                                     sheet->rendered_values->context,
                                     allow_variable_width,
-                                    sheet->last_zoom_factor_used);
+                                    sheet->last_zoom_factor_used
+                                      *gnm_app_display_dpi_get(FALSE)/96.);

        gnm_rvc_store (sheet->rendered_values, cell, rv);
_______________________________________________
gnumeric-list mailing list
gnumeric-list gnome org
https://mail.gnome.org/mailman/listinfo/gnumeric-list


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]