[pango/visible-things: 37/40] fc: Implement showing space
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pango/visible-things: 37/40] fc: Implement showing space
- Date: Sat, 13 Jul 2019 04:46:18 +0000 (UTC)
commit b89a9a239a694b052832c4a5ee13b9c269ca6b1a
Author: Matthias Clasen <mclasen redhat com>
Date: Wed Jul 10 09:02:54 2019 -0400
fc: Implement showing space
When told to make space visible, we use the glyph
for 0x2324 instead of 0x20. We have to do some
post-processing to counteract harfbuzz using
space glyphs for its own purposes.
pango/pangofc-shape.c | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
---
diff --git a/pango/pangofc-shape.c b/pango/pangofc-shape.c
index 991b7612..53bbb716 100644
--- a/pango/pangofc-shape.c
+++ b/pango/pangofc-shape.c
@@ -138,6 +138,21 @@ pango_hb_font_get_nominal_glyph (hb_font_t *font,
}
}
+ if (context->flags & PANGO_SHAPE_SHOW_SPACE)
+ {
+ if (g_unichar_type (unicode) == G_UNICODE_SPACE_SEPARATOR)
+ {
+ /* Replace 0x20 by visible space, since we
+ * don't draw a hex box for 0x20
+ */
+ if (unicode == 0x20)
+ *glyph = PANGO_GET_UNKNOWN_GLYPH (0x2423);
+ else
+ *glyph = PANGO_GET_UNKNOWN_GLYPH (unicode);
+ return TRUE;
+ }
+ }
+
if (hb_font_get_glyph (context->parent, unicode, 0, glyph))
return TRUE;
@@ -352,6 +367,7 @@ pango_hb_shape (const char *item_text,
hb_buffer_set_cluster_level (hb_buffer, HB_BUFFER_CLUSTER_LEVEL_MONOTONE_CHARACTERS);
#endif
hb_buffer_set_flags (hb_buffer, hb_buffer_flags);
+ hb_buffer_set_invisible_glyph (hb_buffer, PANGO_GLYPH_EMPTY);
hb_buffer_add_utf8 (hb_buffer, paragraph_text, paragraph_length, item_offset, item_length);
@@ -369,6 +385,7 @@ pango_hb_shape (const char *item_text,
pango_glyph_string_set_size (glyphs, num_glyphs);
infos = glyphs->glyphs;
last_cluster = -1;
+
for (i = 0; i < num_glyphs; i++)
{
infos[i].glyph = hb_glyph->codepoint;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]