[pango/synthetic-slant: 1/2] Add pango_matrix_get_slant_ratio
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pango/synthetic-slant: 1/2] Add pango_matrix_get_slant_ratio
- Date: Sat, 11 Sep 2021 16:47:01 +0000 (UTC)
commit 016854859a2d24ef9a123ad8f5eed090b259d30b
Author: Matthias Clasen <mclasen redhat com>
Date: Sat Sep 11 12:30:46 2021 -0400
Add pango_matrix_get_slant_ratio
pango/pango-matrix.c | 13 +++++++++++++
pango/pango-matrix.h | 2 ++
2 files changed, 15 insertions(+)
---
diff --git a/pango/pango-matrix.c b/pango/pango-matrix.c
index a066eb57..b19df073 100644
--- a/pango/pango-matrix.c
+++ b/pango/pango-matrix.c
@@ -262,6 +262,19 @@ pango_matrix_get_font_scale_factors (const PangoMatrix *matrix,
*yscale = minor;
}
+double
+pango_matrix_get_slant_ratio (const PangoMatrix *matrix)
+{
+ double x, y;
+
+ x = 0;
+ y = 1;
+
+ pango_matrix_transform_distance (matrix, &x, &y);
+
+ return - x / y;
+}
+
/**
* pango_matrix_transform_distance:
* @matrix: (nullable): a `PangoMatrix`
diff --git a/pango/pango-matrix.h b/pango/pango-matrix.h
index d4277401..cb53a422 100644
--- a/pango/pango-matrix.h
+++ b/pango/pango-matrix.h
@@ -121,6 +121,8 @@ double pango_matrix_get_font_scale_factor (const PangoMatrix *matrix) G_GNUC_PUR
PANGO_AVAILABLE_IN_1_38
void pango_matrix_get_font_scale_factors (const PangoMatrix *matrix,
double *xscale, double *yscale);
+PANGO_AVAILABLE_IN_1_50
+double pango_matrix_get_slant_ratio (const PangoMatrix *matrix) G_GNUC_PURE;
G_END_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]