[pango/visible-things-2: 13/16] fc: Implement showing space
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pango/visible-things-2: 13/16] fc: Implement showing space
- Date: Wed, 10 Jul 2019 19:24:49 +0000 (UTC)
commit f68f04ed79eed667574f3722f6cbffffdd5cf68e
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 c33a19e1..6a5088c1 100644
--- a/pango/pangofc-shape.c
+++ b/pango/pangofc-shape.c
@@ -96,6 +96,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;
@@ -308,6 +323,7 @@ _pango_fc_shape (PangoFont *font,
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);
@@ -358,6 +374,7 @@ _pango_fc_shape (PangoFont *font,
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]