summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2021-08-29 21:20:37 -0400
committerMatthias Clasen <mclasen@redhat.com>2021-08-29 21:20:37 -0400
commit8bc08dc2900da1cbb34987934b8954fdb576dfeb (patch)
treebb28813cb297c1890cff1070c32e9448fb30b7f0
parentf7a99fd86067f0ed9baa466d0f612365462cca20 (diff)
downloadpango-8bc08dc2900da1cbb34987934b8954fdb576dfeb.tar.gz
Add pango_layout_iter_get_run_baseline
This is useful information.
-rw-r--r--pango/pango-layout.c16
-rw-r--r--pango/pango-layout.h2
2 files changed, 18 insertions, 0 deletions
diff --git a/pango/pango-layout.c b/pango/pango-layout.c
index 5aa9ee12..86c67020 100644
--- a/pango/pango-layout.c
+++ b/pango/pango-layout.c
@@ -7305,6 +7305,22 @@ pango_layout_iter_get_baseline (PangoLayoutIter *iter)
return iter->line_extents[iter->line_index].baseline;
}
+int
+pango_layout_iter_get_run_baseline (PangoLayoutIter *iter)
+{
+ ItemProperties properties;
+
+ if (ITER_IS_INVALID (iter))
+ return 0;
+
+ if (!iter->run)
+ return iter->line_extents[iter->line_index].baseline;
+
+ pango_layout_get_item_properties (iter->run->item, &properties);
+
+ return iter->line_extents[iter->line_index].baseline - properties.rise;
+}
+
/**
* pango_layout_iter_get_layout_extents:
* @iter: a `PangoLayoutIter`
diff --git a/pango/pango-layout.h b/pango/pango-layout.h
index 3b30a251..e28f9295 100644
--- a/pango/pango-layout.h
+++ b/pango/pango-layout.h
@@ -466,6 +466,8 @@ void pango_layout_iter_get_layout_extents (PangoLayoutIter *iter,
PangoRectangle *logical_rect);
PANGO_AVAILABLE_IN_ALL
int pango_layout_iter_get_baseline (PangoLayoutIter *iter);
+PANGO_AVAILABLE_IN_1_50
+int pango_layout_iter_get_run_baseline (PangoLayoutIter *iter);
G_END_DECLS