summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcus Lundblad <ml@update.uu.se>2021-02-09 23:15:17 +0100
committerMarcus Lundblad <ml@update.uu.se>2021-02-10 18:26:56 +0100
commit94ad5918dc97f305623af1d4ff6414bbc449817d (patch)
tree8a653a4425b9c2f37e68be42f4541aaabf822456
parentfeebfa1e90df0fd6a97ce63119db16255f351601 (diff)
downloadgnome-maps-wip/mlundblad/phone-number-ltr.tar.gz
placeView: Always set text direction to LTR for phone numberswip/mlundblad/phone-number-ltr
Since phone numbers are typically displayed using international format (starting with a +) this seems to result in Pango laying out the text with an overall RTL direction in RTL languages, resulting in groups of digits (separated by spaces) being arranged RTL, while the digit groups internally correctly is rendered LTR. And since also eastern Arabic numerals are written left-to-right, just insert a LRM marker to ensure the direction within the text is LTR (setting the text direction of the entire label widget gives off alignment).
-rw-r--r--src/placeView.js11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/placeView.js b/src/placeView.js
index 36dd10af..faa96a10 100644
--- a/src/placeView.js
+++ b/src/placeView.js
@@ -42,6 +42,9 @@ const Wikipedia = imports.wikipedia;
// maximum dimension of thumbnails to fetch from Wikipedia
const THUMBNAIL_FETCH_SIZE = 360;
+// Unicode left-to-right marker
+const LRM = '\u200E';
+
var PlaceView = GObject.registerClass({
Properties: {
'overpass-place': GObject.ParamSpec.object('overpass-place',
@@ -257,9 +260,15 @@ var PlaceView = GObject.registerClass({
}
if (place.phone) {
+ /* since the phone numbers are typically always rendered
+ * left-to-right, insert an explicit LRM char to avoid issues
+ * with phone numbers in international format starting with a +
+ * which is considered a "weak" character to determine Unicode
+ * text direction
+ */
let phone = { label: _("Phone number"),
icon: 'phone-oldschool-symbolic',
- info: GLib.markup_escape_text(place.phone, -1) };
+ info: LRM + GLib.markup_escape_text(place.phone, -1) };
if (Utils.uriSchemeSupported('tel')) {
/* RFC3966 only allows "-", '.", "(", and ")" as visual