[gnome-characters/wip/exalm/unistring: 1/15] Stop handling wide chars




commit 96b51444c888a84422c77c22e5b3c5220d1471b1
Author: Alexander Mikhaylenko <alexm gnome org>
Date:   Fri Nov 26 12:13:59 2021 +0500

    Stop handling wide chars
    
    We already default to 2-character bounding box, no need to make it even
    wider.

 lib/gc.c              | 12 ------------
 lib/gc.h              |  1 -
 src/charactersView.js |  7 ++-----
 3 files changed, 2 insertions(+), 18 deletions(-)
---
diff --git a/lib/gc.c b/lib/gc.c
index d4b4c75..3caba22 100644
--- a/lib/gc.c
+++ b/lib/gc.c
@@ -572,18 +572,6 @@ gc_character_is_invisible (gunichar uc)
     || uc_is_property_zero_width (uc);
 }
 
-/**
- * gc_character_width:
- * @uc: a UCS-4 character
- *
- * Returns: column width of @uc, or -1 if @uc is a control character.
- */
-gint
-gc_character_width (gunichar uc)
-{
-  return uc_width (uc, "UTF-8");
-}
-
 G_DEFINE_QUARK (gc-search-error-quark, gc_search_error)
 
 G_DEFINE_BOXED_TYPE (GcSearchResult, gc_search_result,
diff --git a/lib/gc.h b/lib/gc.h
index 18238f5..884b2cd 100644
--- a/lib/gc.h
+++ b/lib/gc.h
@@ -109,7 +109,6 @@ GcSearchResult       *gc_filter_characters  (GcCategory            category,
 gchar                *gc_character_name     (gunichar              uc);
 gboolean              gc_character_is_invisible
                                             (gunichar              uc);
-gint                  gc_character_width    (gunichar              uc);
 
 /* Pango support.  PangoAttrFallback is not accessible from GI.  */
 void                  gc_pango_layout_disable_fallback
diff --git a/src/charactersView.js b/src/charactersView.js
index 4b0d528..3e20dc1 100644
--- a/src/charactersView.js
+++ b/src/charactersView.js
@@ -85,7 +85,7 @@ const CharacterListRow = GObject.registerClass({
         }
     }
 
-    _computeBoundingBox(layout, cellRect, uc) {
+    _computeBoundingBox(layout, cellRect) {
         let shapeRect;
         let layoutBaseline;
         if (layout.get_unknown_glyphs_count() === 0) {
@@ -109,9 +109,6 @@ const CharacterListRow = GObject.registerClass({
                 width: this._baseGlyphRect.width,
                 height: this._baseGlyphRect.height,
             });
-            let characterWidth = Gc.character_width(uc);
-            if (characterWidth > 1)
-                shapeRect.width *= characterWidth;
         }
 
         shapeRect.x = cellRect.x - shapeRect.x / Pango.SCALE + (cellRect.width - shapeRect.width / 
Pango.SCALE) / 2;
@@ -124,7 +121,7 @@ const CharacterListRow = GObject.registerClass({
     _drawBoundingBox(snapshot, pangoLayout, styleContext, cellRect, uc) {
         snapshot.save();
 
-        let shapeRect = this._computeBoundingBox(pangoLayout, cellRect, uc);
+        let shapeRect = this._computeBoundingBox(pangoLayout, cellRect);
         let borderWidth = 1;
 
         let boxBgColor = styleContext.get_color();


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