[pango/simple-fontmap: 23/26] Add gravity
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pango/simple-fontmap: 23/26] Add gravity
- Date: Thu, 2 Sep 2021 10:52:29 +0000 (UTC)
commit 6a2e8099787bae816504debc4a7292f2696adf3d
Author: Matthias Clasen <mclasen redhat com>
Date: Thu Sep 2 00:03:43 2021 -0400
Add gravity
Rotate glyphs of PangoHbFont according to gravity.
pango/pango-hbfont-private.h | 1 +
pango/pango-hbfont.c | 4 +++-
pango/pango-hbfont.h | 3 ++-
pango/pango-simplefontmap.c | 3 ++-
pango/pangocairo-fcfont.c | 8 +++++++-
5 files changed, 15 insertions(+), 4 deletions(-)
---
diff --git a/pango/pango-hbfont-private.h b/pango/pango-hbfont-private.h
index 96bc1efc..82f4849a 100644
--- a/pango/pango-hbfont-private.h
+++ b/pango/pango-hbfont-private.h
@@ -10,4 +10,5 @@ struct _PangoHbFont
PangoHbFace *face;
PangoFontDescription *description;
+ PangoGravity gravity;
};
diff --git a/pango/pango-hbfont.c b/pango/pango-hbfont.c
index 8193a29b..8c92911c 100644
--- a/pango/pango-hbfont.c
+++ b/pango/pango-hbfont.c
@@ -305,7 +305,8 @@ pango_hb_font_class_init (PangoHbFontClass *class)
PangoHbFont *
pango_hb_font_new (PangoHbFace *face,
- const PangoFontDescription *description)
+ const PangoFontDescription *description,
+ PangoGravity gravity)
{
PangoHbFont *font;
@@ -313,6 +314,7 @@ pango_hb_font_new (PangoHbFace *face,
font->face = g_object_ref (face);
font->description = pango_font_description_copy (description);
+ font->gravity = gravity;
return font;
}
diff --git a/pango/pango-hbfont.h b/pango/pango-hbfont.h
index 67a5cd5f..a159897b 100644
--- a/pango/pango-hbfont.h
+++ b/pango/pango-hbfont.h
@@ -34,6 +34,7 @@ G_DECLARE_FINAL_TYPE (PangoHbFont, pango_hb_font, PANGO, HB_FONT, PangoFont)
PANGO_AVAILABLE_IN_1_50
PangoHbFont *pango_hb_font_new (PangoHbFace *face,
- const PangoFontDescription *description);
+ const PangoFontDescription *description,
+ PangoGravity gravity);
G_END_DECLS
diff --git a/pango/pango-simplefontmap.c b/pango/pango-simplefontmap.c
index 3b452df0..a3297908 100644
--- a/pango/pango-simplefontmap.c
+++ b/pango/pango-simplefontmap.c
@@ -26,6 +26,7 @@
#include "pango-simplefontmap.h"
#include "pango-hbface-private.h"
#include "pango-hbfont-private.h"
+#include "pango-context.h"
struct _PangoSimpleFontMap
{
@@ -213,7 +214,7 @@ pango_simple_font_map_load_font (PangoFontMap *map,
if (face == NULL)
face = g_ptr_array_index (self->faces, 0);
- return PANGO_FONT (pango_hb_font_new (face, desc));
+ return PANGO_FONT (pango_hb_font_new (face, desc, pango_context_get_gravity (context)));
}
static PangoFontset *
diff --git a/pango/pangocairo-fcfont.c b/pango/pangocairo-fcfont.c
index b5ef0fee..7de5e2ab 100644
--- a/pango/pangocairo-fcfont.c
+++ b/pango/pangocairo-fcfont.c
@@ -307,15 +307,21 @@ create_scaled_font (PangoHbFont *font)
cairo_face = cairo_ft_font_face_create_for_ft_face (ft_face, FT_LOAD_NO_HINTING | FT_LOAD_COLOR);
- cairo_matrix_t ctm, font_matrix;
+ cairo_matrix_t ctm, font_matrix, gravity_matrix;
cairo_font_options_t *font_options;
size = pango_font_description_get_size (font->description);
+ cairo_matrix_init_rotate (&gravity_matrix,
+ pango_gravity_to_rotation (font->gravity));
+
cairo_matrix_init_identity (&ctm);
cairo_matrix_init_scale (&font_matrix,
size * (96. / 72.) / PANGO_SCALE,
size * (96. / 72) / PANGO_SCALE);
+ cairo_matrix_multiply (&font_matrix,
+ &font_matrix,
+ &gravity_matrix);
font_options = cairo_font_options_create ();
cairo_font_options_set_hint_style (font_options, CAIRO_HINT_STYLE_NONE);
cairo_font_options_set_hint_metrics (font_options, CAIRO_HINT_METRICS_OFF);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]