[pango/visible-things: 9/12] fc: Implement showing space
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pango/visible-things: 9/12] fc: Implement showing space
- Date: Fri, 12 Jul 2019 22:24:00 +0000 (UTC)
commit 5471998d7079b8081f8bc212ac61d1e952baabc4
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 4e49dd05..d914a3b7 100644
--- a/pango/pangofc-shape.c
+++ b/pango/pangofc-shape.c
@@ -139,6 +139,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;
@@ -353,6 +368,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);
@@ -370,6 +386,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]