[pango/simple-fontmap: 276/278] pango-view: Add a few synthetic variants
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pango/simple-fontmap: 276/278] pango-view: Add a few synthetic variants
- Date: Thu, 23 Dec 2021 00:01:35 +0000 (UTC)
commit c1fd82979170189177e7cecbbde2f0041a5beda2
Author: Matthias Clasen <mclasen redhat com>
Date: Sun Oct 24 01:37:51 2021 -0700
pango-view: Add a few synthetic variants
Add italic and condensed Cantarell variants, as
well as a monospace alias (for hex boxes).
This is a hack to test the support for transformed
and aliased fonts.
utils/viewer-pangocairo.c | 33 +++++++++++++++++++++++++++++++++
1 file changed, 33 insertions(+)
---
diff --git a/utils/viewer-pangocairo.c b/utils/viewer-pangocairo.c
index f83e3ba3..deb7013e 100644
--- a/utils/viewer-pangocairo.c
+++ b/utils/viewer-pangocairo.c
@@ -51,10 +51,43 @@ 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, -1);
+
+ 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);
+
+ matrix = (PangoMatrix) { 0.5, 0., 0., 1., 0., 0. };
+
+ slanted = pango_hb_face_new_transformed (PANGO_HB_FACE (face), "Condensed", &matrix);
+ pango_simple_font_map_add_face (PANGO_SIMPLE_FONT_MAP (instance->fontmap), slanted);
+ g_object_unref (slanted);
+ }
+
+ fam = pango_font_map_get_family (instance->fontmap, "Liberation Mono");
+ if (fam)
+ {
+ PangoFontFace *face = pango_font_family_get_face (fam, "Regular");
+ PangoHbFace *alias;
+
+ alias = pango_hb_face_new_alias (PANGO_HB_FACE (face), "Monospace");
+ pango_simple_font_map_add_face (PANGO_SIMPLE_FONT_MAP (instance->fontmap), alias);
+ g_object_unref (alias);
+ }
}
else
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]