[pango/simple-fontmap: 13/18] pango-view: Add italic Cantarell variant
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pango/simple-fontmap: 13/18] pango-view: Add italic Cantarell variant
- Date: Fri, 29 Oct 2021 01:42:47 +0000 (UTC)
commit 3b9d6adb03c70824344927af22a85490c1bbabe0
Author: Matthias Clasen <mclasen redhat com>
Date: Sun Oct 24 01:37:51 2021 -0700
pango-view: Add italic Cantarell variant
This is a hack to test the synthetic oblique support.
utils/viewer-pangocairo.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
---
diff --git a/utils/viewer-pangocairo.c b/utils/viewer-pangocairo.c
index 1b3d2f80..ef90c6aa 100644
--- a/utils/viewer-pangocairo.c
+++ b/utils/viewer-pangocairo.c
@@ -25,6 +25,8 @@
#include "viewer-cairo.h"
#include <pango/pangocairo.h>
+#include <pango/pango-hbface.h>
+#include <pango/pango-simplefontmap.h>
static int opt_annotate = 0;
static const char **opt_font_file = NULL;
@@ -51,10 +53,26 @@ pangocairo_view_create (const PangoViewer *klass G_GNUC_UNUSED)
if (opt_font_file != NULL)
{
+ PangoFontFamily *fam;
+
instance->fontmap = PANGO_FONT_MAP (pango_simple_font_map_new ());
pango_simple_font_map_set_resolution (PANGO_SIMPLE_FONT_MAP (instance->fontmap), opt_dpi);
for (int i = 0; opt_font_file[i]; i++)
pango_simple_font_map_add_file (PANGO_SIMPLE_FONT_MAP (instance->fontmap), opt_font_file[i], 0);
+
+ fam = pango_font_map_get_family (instance->fontmap, "Cantarell");
+ if (fam)
+ {
+ PangoFontFace *face = pango_font_family_get_face (fam, "Regular");
+ PangoHbFace *slanted;
+ PangoMatrix matrix = { 1., -0.2,
+ 0., 1.,
+ 0., 0. };
+
+ slanted = pango_hb_face_new_transformed (PANGO_HB_FACE (face), "Italic", &matrix);
+ pango_simple_font_map_add_face (PANGO_SIMPLE_FONT_MAP (instance->fontmap), slanted);
+ g_object_unref (slanted);
+ }
}
else
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]