[evince] shell: Use tabular figures for zoom level and page numbers



commit af9afc4d24696fb76595fce84ebcd8378b158322
Author: Lukas K <lu 0x83 eu>
Date:   Sun Dec 26 17:27:46 2021 +0100

    shell: Use tabular figures for zoom level and page numbers
    
    Without tabular figures, the decimal point and the leftmost
    digit move around when zooming in and out (following the
    proportional size of each digit).
    
    With tabular figures, each figure uses the same space and
    when zooming in and out (or switching pages), the numbers
    stay in place.
    
    See https://gitlab.gnome.org/GNOME/evince/-/merge_requests/414

 libmisc/ev-page-action-widget.c | 1 +
 shell/ev-zoom-action.c          | 1 +
 shell/evince.css                | 4 ++++
 3 files changed, 6 insertions(+)
---
diff --git a/libmisc/ev-page-action-widget.c b/libmisc/ev-page-action-widget.c
index 3d41019d2..e5c26901a 100644
--- a/libmisc/ev-page-action-widget.c
+++ b/libmisc/ev-page-action-widget.c
@@ -218,6 +218,7 @@ ev_page_action_widget_init (EvPageActionWidget *action_widget)
         style_context = gtk_widget_get_style_context (hbox);
         gtk_style_context_add_class (style_context, "raised");
         gtk_style_context_add_class (style_context, "linked");
+        gtk_style_context_add_class (style_context, "tnum");
 
        action_widget->entry = gtk_entry_new ();
        gtk_widget_add_events (action_widget->entry,
diff --git a/shell/ev-zoom-action.c b/shell/ev-zoom-action.c
index dd47eb002..65c9fa1c3 100644
--- a/shell/ev-zoom-action.c
+++ b/shell/ev-zoom-action.c
@@ -434,6 +434,7 @@ ev_zoom_action_init (EvZoomAction *zoom_action)
         gtk_entry_set_icon_from_icon_name (GTK_ENTRY (priv->entry),
                                            GTK_ENTRY_ICON_SECONDARY,
                                            "pan-down-symbolic");
+        gtk_style_context_add_class (gtk_widget_get_style_context (priv->entry), "tnum");
         gtk_box_pack_start (GTK_BOX (zoom_action), priv->entry, TRUE, FALSE, 0);
         g_object_set (priv->entry, "xalign", 1.0, NULL);
         gtk_widget_show (priv->entry);
diff --git a/shell/evince.css b/shell/evince.css
index 83e281cf6..73277385a 100644
--- a/shell/evince.css
+++ b/shell/evince.css
@@ -93,3 +93,7 @@ evannotationwindow label {
     padding-left: 2px;
     padding-right: 2px;
 }
+
+.tnum {
+    font-feature-settings: "tnum 1";
+}


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