[pango/matthiasc/for-main: 2/3] Add pango_layout_iter_get_run_baseline
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pango/matthiasc/for-main: 2/3] Add pango_layout_iter_get_run_baseline
- Date: Mon, 30 Aug 2021 01:25:06 +0000 (UTC)
commit 8bc08dc2900da1cbb34987934b8954fdb576dfeb
Author: Matthias Clasen <mclasen redhat com>
Date: Sun Aug 29 21:20:37 2021 -0400
Add pango_layout_iter_get_run_baseline
This is useful information.
pango/pango-layout.c | 16 ++++++++++++++++
pango/pango-layout.h | 2 ++
2 files changed, 18 insertions(+)
---
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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]