[pango/simple-fontmap: 10/11] pango-view: Add italic Cantarell variant
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pango/simple-fontmap: 10/11] pango-view: Add italic Cantarell variant
- Date: Mon, 25 Oct 2021 09:55:26 +0000 (UTC)
commit ab936679676b7ff7e73f3de67d02828d5a3f33fb
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 | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
---
diff --git a/utils/viewer-pangocairo.c b/utils/viewer-pangocairo.c
index 1b3d2f80..37c5abeb 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
{
@@ -62,6 +80,7 @@ pangocairo_view_create (const PangoViewer *klass G_GNUC_UNUSED)
pango_cairo_font_map_set_resolution (PANGO_CAIRO_FONT_MAP (instance->fontmap), opt_dpi);
}
+
instance->font_options = cairo_font_options_create ();
if (opt_hinting != HINT_DEFAULT)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]