summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2021-11-28 15:54:46 +0000
committerMatthias Clasen <mclasen@redhat.com>2021-11-28 15:54:46 +0000
commit5c292b15d4049c8692b85663431d5a2fd37c8604 (patch)
tree3f1808885d3147a73f034e5b04a9be1e348f8b0e
parent3fdbd3fe01842e683a26a1e1c9c9eb04099f27f1 (diff)
parent6f775850ae51d7b0db3a5ef9d6c824979a4b38c1 (diff)
downloadpango-5c292b15d4049c8692b85663431d5a2fd37c8604.tar.gz
Merge branch 'matthiasc/for-main' into 'main'
Never show variation selectors See merge request GNOME/pango!526
-rw-r--r--pango/pango-impl-utils.h42
-rw-r--r--pango/shape.c7
-rw-r--r--tests/layouts/valid-21.layout170
-rw-r--r--tests/meson.build57
4 files changed, 244 insertions, 32 deletions
diff --git a/pango/pango-impl-utils.h b/pango/pango-impl-utils.h
index a0183d69..55c743df 100644
--- a/pango/pango-impl-utils.h
+++ b/pango/pango-impl-utils.h
@@ -128,8 +128,46 @@ pango_glyph_string_reverse_range (PangoGlyphString *glyphs,
}
}
-/* The cairo hexbox drawing code assumes
- * that these nicks are 1-6 ASCII chars
+static inline gboolean
+pango_is_default_ignorable (gunichar ch)
+{
+ int plane = ch >> 16;
+
+ if (G_LIKELY (plane == 0))
+ {
+ int page = ch >> 8;
+ switch (page)
+ {
+ case 0x00: return ch == 0x00ad;
+ case 0x03: return ch == 0x034f;
+ case 0x06: return ch == 0x061c;
+ case 0x17: return (0x17b4 <= ch && ch <= 0x17b5);
+ case 0x18: return (0x180b <= ch && ch <= 0x180e);
+ case 0x20: return (0x200b <= ch && ch <= 0x200f) ||
+ (0x202a <= ch && ch <= 0x202e) ||
+ (0x2060 <= ch && ch <= 0x206f);
+ case 0xfe: return (0xfe00 <= ch && ch <= 0xfe0f) || ch == 0xfeff;
+ case 0xff: return (0xfff0 <= ch && ch <= 0xfff8);
+ default: return FALSE;
+ }
+ }
+ else
+ {
+ /* Other planes */
+ switch (plane)
+ {
+ case 0x01: return (0x1d173 <= ch && ch <= 0x1d17a);
+ case 0x0e: return (0xe0000 <= ch && ch <= 0xe0fff);
+ default: return FALSE;
+ }
+ }
+}
+
+/* These are the default ignorables that we render as hexboxes
+ * with nicks if PANGO_SHOW_IGNORABLES is used.
+ *
+ * The cairo hexbox drawing code assumes that these nicks are
+ * 1-6 ASCII chars
*/
static struct {
gunichar ch;
diff --git a/pango/shape.c b/pango/shape.c
index caefeae4..45c979f2 100644
--- a/pango/shape.c
+++ b/pango/shape.c
@@ -111,9 +111,12 @@ pango_hb_font_get_nominal_glyph (hb_font_t *font,
}
if ((context->show_flags & PANGO_SHOW_IGNORABLES) != 0 &&
- pango_get_ignorable (unicode))
+ pango_is_default_ignorable (unicode))
{
- *glyph = PANGO_GET_UNKNOWN_GLYPH (unicode);
+ if (pango_get_ignorable (unicode))
+ *glyph = PANGO_GET_UNKNOWN_GLYPH (unicode);
+ else
+ *glyph = PANGO_GLYPH_EMPTY;
return TRUE;
}
diff --git a/tests/layouts/valid-21.layout b/tests/layouts/valid-21.layout
new file mode 100644
index 00000000..9088c721
--- /dev/null
+++ b/tests/layouts/valid-21.layout
@@ -0,0 +1,170 @@
+{
+ "context" : {
+ "font" : "serif 12",
+ "language" : "en-us",
+ "base-gravity" : "south",
+ "gravity-hint" : "natural",
+ "base-dir" : "weak-ltr",
+ "round-glyph-positions" : true,
+ "transform" : [
+ 1.0,
+ 0.0,
+ 0.0,
+ 1.0,
+ 0.0,
+ 0.0
+ ]
+ },
+ "comment" : "Visible and nickless ignorables",
+ "text" : "😊️ ‍",
+ "attributes" : [
+ {
+ "type" : "show",
+ "value" : 4
+ }
+ ],
+ "font" : "Cantarell 11",
+ "output" : {
+ "is-wrapped" : false,
+ "is-ellipsized" : false,
+ "unknown-glyphs" : 1,
+ "width" : 45056,
+ "height" : 19456,
+ "log-attrs" : [
+ {
+ "char-break" : true,
+ "cursor-position" : true,
+ "sentence-boundary" : true,
+ "sentence-start" : true,
+ "backspace-deletes-character" : true,
+ "word-boundary" : true
+ },
+ { },
+ {
+ "char-break" : true,
+ "white" : true,
+ "cursor-position" : true,
+ "expandable-space" : true,
+ "word-boundary" : true
+ },
+ {
+ "line-break" : true
+ },
+ {
+ "line-break" : true,
+ "mandatory-break" : true,
+ "char-break" : true,
+ "white" : true,
+ "cursor-position" : true,
+ "sentence-boundary" : true,
+ "sentence-end" : true,
+ "backspace-deletes-character" : true,
+ "word-boundary" : true
+ }
+ ],
+ "lines" : [
+ {
+ "start-index" : 0,
+ "length" : 11,
+ "paragraph-start" : true,
+ "direction" : "ltr",
+ "runs" : [
+ {
+ "offset" : 0,
+ "length" : 7,
+ "text" : "😊️",
+ "bidi-level" : 0,
+ "gravity" : "south",
+ "language" : "en-us",
+ "script" : "common",
+ "font" : {
+ "description" : "Noto Color Emoji 11",
+ "checksum" : "054c1c2e2ca956b920262840dcad39dcf27bb88d6f70b892b2b1180de2c2ab47",
+ "matrix" : [
+ 0.13455956135321101,
+ -0.0,
+ -0.0,
+ 0.13455956135321101,
+ 0.0,
+ 0.0
+ ]
+ },
+ "flags" : 0,
+ "extra-attributes" : [
+ {
+ "type" : "show",
+ "value" : 4
+ }
+ ],
+ "y-offset" : 0,
+ "start-x-offset" : 0,
+ "end-x-offset" : 0,
+ "glyphs" : [
+ {
+ "glyph" : 13,
+ "width" : 18432,
+ "is-cluster-start" : true,
+ "is-color" : true,
+ "log-cluster" : 0
+ },
+ {
+ "glyph" : 268435455,
+ "width" : 0,
+ "is-cluster-start" : true,
+ "log-cluster" : 4
+ }
+ ]
+ },
+ {
+ "offset" : 7,
+ "length" : 4,
+ "text" : " ‍",
+ "bidi-level" : 0,
+ "gravity" : "south",
+ "language" : "en-us",
+ "script" : "common",
+ "font" : {
+ "description" : "Cantarell 11",
+ "checksum" : "5bcb6ee14ee9d210b2e91d643de1fe456e9d1aea770983fdb05951545efebbe2",
+ "variations" : {
+ "wght" : 0
+ },
+ "matrix" : [
+ 1.0,
+ -0.0,
+ -0.0,
+ 1.0,
+ 0.0,
+ 0.0
+ ]
+ },
+ "flags" : 0,
+ "extra-attributes" : [
+ {
+ "type" : "show",
+ "value" : 4
+ }
+ ],
+ "y-offset" : 0,
+ "start-x-offset" : 0,
+ "end-x-offset" : 0,
+ "glyphs" : [
+ {
+ "glyph" : 1109,
+ "width" : 3072,
+ "is-cluster-start" : true,
+ "log-cluster" : 0
+ },
+ {
+ "glyph" : 268443661,
+ "width" : 23552,
+ "is-cluster-start" : true,
+ "log-cluster" : 1
+ }
+ ]
+ }
+ ]
+ }
+ ]
+ }
+}
diff --git a/tests/meson.build b/tests/meson.build
index af56433e..3d47ba85 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -88,28 +88,35 @@ installed_test_data = [
'CharBreakTest.txt',
]
-test_layouts_data = [
- 'layouts/valid-1',
- 'layouts/valid-2',
- 'layouts/valid-3',
- 'layouts/valid-4',
- 'layouts/valid-5',
- 'layouts/valid-6',
- 'layouts/valid-7',
- 'layouts/valid-8',
- 'layouts/valid-9',
- 'layouts/valid-10',
- 'layouts/valid-11',
- 'layouts/valid-12',
- 'layouts/valid-13',
- 'layouts/valid-14',
- 'layouts/valid-15',
- 'layouts/valid-16',
- 'layouts/valid-17',
- 'layouts/valid-18',
- 'layouts/valid-19',
- 'layouts/valid-20',
- 'layouts/valid-21',
+installed_test_layouts_data = [
+ 'layouts/bratwurst2.layout',
+ 'layouts/bratwurst3.layout',
+ 'layouts/bratwurst4.layout',
+ 'layouts/bratwurst.layout',
+ 'layouts/effigy.layout',
+ 'layouts/kebab.layout',
+ 'layouts/valid-1.layout',
+ 'layouts/valid-2.layout',
+ 'layouts/valid-3.layout',
+ 'layouts/valid-4.layout',
+ 'layouts/valid-5.layout',
+ 'layouts/valid-6.layout',
+ 'layouts/valid-7.layout',
+ 'layouts/valid-8.layout',
+ 'layouts/valid-9.layout',
+ 'layouts/valid-10.layout',
+ 'layouts/valid-11.layout',
+ 'layouts/valid-12.layout',
+ 'layouts/valid-13.layout',
+ 'layouts/valid-14.layout',
+ 'layouts/valid-15.layout',
+ 'layouts/valid-16.layout',
+ 'layouts/valid-17.layout',
+ 'layouts/valid-18.layout',
+ 'layouts/valid-19.layout',
+ 'layouts/valid-20.layout',
+ 'layouts/valid-21.layout',
+ 'layouts/valid-22.layout',
]
test_markups_data = [
@@ -194,12 +201,6 @@ test_items_data = [
'itemize/two',
]
-installed_test_layouts_data = []
-foreach d: test_layouts_data
- installed_test_layouts_data += d + '.markup'
- installed_test_layouts_data += d + '.expected'
-endforeach
-
installed_test_markups_data = []
foreach d: test_markups_data
installed_test_markups_data += d + '.markup'