[gnome-characters/wip/exalm/unistring: 1/15] Stop handling wide chars
- From: Alexander Mikhaylenko <alexm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-characters/wip/exalm/unistring: 1/15] Stop handling wide chars
- Date: Fri, 26 Nov 2021 09:32:21 +0000 (UTC)
commit b48be80c1e40f2b5155bd8694351634b4e2fee99
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 | 13 +++++--------
3 files changed, 5 insertions(+), 21 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..4f42613 100644
--- a/src/charactersView.js
+++ b/src/charactersView.js
@@ -64,7 +64,7 @@ const CharacterListRow = GObject.registerClass({
layout.set_text(character, -1);
snapshot.save();
if (Gc.character_is_invisible(character)) {
- this._drawBoundingBox(snapshot, layout, styleContext, cellRect, character);
+ this._drawBoundingBox(snapshot, layout, styleContext, cellRect);
this._drawCharacterName(snapshot, pangoContext, styleContext, cellRect, character);
} else if (layout.get_unknown_glyphs_count() === 0) {
let layoutBaseline = layout.get_baseline();
@@ -78,14 +78,14 @@ const CharacterListRow = GObject.registerClass({
snapshot.append_layout(layout, textColor);
} else {
- this._drawBoundingBox(snapshot, layout, styleContext, cellRect, character);
+ this._drawBoundingBox(snapshot, layout, styleContext, cellRect);
this._drawCharacterName(snapshot, pangoContext, styleContext, cellRect, character);
}
snapshot.restore();
}
}
- _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;
@@ -121,10 +118,10 @@ const CharacterListRow = GObject.registerClass({
return shapeRect;
}
- _drawBoundingBox(snapshot, pangoLayout, styleContext, cellRect, uc) {
+ _drawBoundingBox(snapshot, pangoLayout, styleContext, cellRect) {
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]