[pango/fix-small-caps-line-height: 47/48] Add some private api
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pango/fix-small-caps-line-height: 47/48] Add some private api
- Date: Sun, 19 Dec 2021 15:41:02 +0000 (UTC)
commit 6770050e74cf83830e255f1d1e9b574feb5a60fc
Author: Matthias Clasen <mclasen redhat com>
Date: Sun Dec 19 10:39:37 2021 -0500
Add some private api
Add some api to let us store another font in
a PangoAnalysis. This will be used in the following
commits.
pango/pango-item-private.h | 22 ++++++++++++++++++++++
pango/pango-item.c | 41 +++++++++++++++++++++++++++++++++++++++++
2 files changed, 63 insertions(+)
---
diff --git a/pango/pango-item-private.h b/pango/pango-item-private.h
index 6e20953f..9d2fa805 100644
--- a/pango/pango-item-private.h
+++ b/pango/pango-item-private.h
@@ -38,6 +38,24 @@ G_BEGIN_DECLS
#define PANGO_ANALYSIS_FLAG_HAS_CHAR_OFFSET (1 << 7)
+typedef struct _PangoAnalysisPrivate PangoAnalysisPrivate;
+
+struct _PangoAnalysisPrivate
+{
+ gpointer reserved;
+ PangoFont *size_font;
+ PangoFont *font;
+
+ guint8 level;
+ guint8 gravity;
+ guint8 flags;
+
+ guint8 script;
+ PangoLanguage *language;
+
+ GSList *extra_attrs;
+};
+
typedef struct _PangoItemPrivate PangoItemPrivate;
#if defined(__x86_64__) && !defined(__ILP32__)
@@ -74,6 +92,10 @@ void pango_analysis_collect_features (const PangoAnalysis
guint length,
guint *num_features);
+void pango_analysis_set_size_font (PangoAnalysis *analysis,
+ PangoFont *font);
+PangoFont * pango_analysis_get_size_font (const PangoAnalysis *analysis);
+
GList * pango_itemize_with_font (PangoContext *context,
PangoDirection base_dir,
const char *text,
diff --git a/pango/pango-item.c b/pango/pango-item.c
index 2b2664c5..d7291a08 100644
--- a/pango/pango-item.c
+++ b/pango/pango-item.c
@@ -324,3 +324,44 @@ pango_analysis_collect_features (const PangoAnalysis *analysis,
}
}
}
+
+/*< private >
+ * pango_analysis_set_size_font:
+ * @analysis: a `PangoAnalysis`
+ * @font: a `PangoFont`
+ *
+ * Sets the font to use for determining the line height.
+ *
+ * This is used when scaling fonts for emulated Small Caps,
+ * to preserve the original line height.
+ */
+void
+pango_analysis_set_size_font (PangoAnalysis *analysis,
+ PangoFont *font)
+{
+ PangoAnalysisPrivate *priv = (PangoAnalysisPrivate *)analysis;
+
+ if (priv->size_font)
+ g_object_unref (priv->size_font);
+ priv->size_font = font;
+ if (priv->size_font)
+ g_object_ref (priv->size_font);
+}
+
+/*< private >
+ * pango_analysis_get_size_font:
+ * @analysis: a `PangoAnalysis`
+ *
+ * Gets the font to use for determining line height.
+ *
+ * If this returns `NULL`, use analysis->font.
+ *
+ * Returns: (nullable) (transfer none): the font
+ */
+PangoFont *
+pango_analysis_get_size_font (const PangoAnalysis *analysis)
+{
+ PangoAnalysisPrivate *priv = (PangoAnalysisPrivate *)analysis;
+
+ return priv->size_font;
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]