summaryrefslogtreecommitdiff
path: root/pango/itemize.c
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2021-12-19 15:49:39 +0000
committerMatthias Clasen <mclasen@redhat.com>2021-12-19 15:49:39 +0000
commit3cdcf7d31f2a68731678f8bde4e236decb21c90a (patch)
tree438fd00eba4b44afd4cf81b6618eb68624d43e88 /pango/itemize.c
parentc0c70393f798be29e3835fa0abd04b15a6235562 (diff)
parent704662e39856e308ef1683be607d62db0b738708 (diff)
downloadpango-3cdcf7d31f2a68731678f8bde4e236decb21c90a.tar.gz
Merge branch 'fix-small-caps-line-height' into 'main'
Fix line height with emulated small caps Closes #622 See merge request GNOME/pango!543
Diffstat (limited to 'pango/itemize.c')
-rw-r--r--pango/itemize.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/pango/itemize.c b/pango/itemize.c
index 6c07e4c2..6380c12f 100644
--- a/pango/itemize.c
+++ b/pango/itemize.c
@@ -1045,7 +1045,8 @@ collect_font_scale (PangoContext *context,
GList **stack,
PangoItem *item,
PangoItem *prev,
- double *scale)
+ double *scale,
+ gboolean *is_small_caps)
{
gboolean retval = FALSE;
GList *l;
@@ -1123,11 +1124,14 @@ collect_font_scale (PangoContext *context,
}
*scale = 1.0;
+ *is_small_caps = TRUE;
for (l = *stack; l; l = l->next)
{
ScaleItem *entry = l->data;
*scale *= entry->scale;
+ if (((PangoAttrInt *)entry->attr)->value != PANGO_FONT_SCALE_SMALL_CAPS)
+ *is_small_caps = FALSE;
retval = TRUE;
}
@@ -1152,11 +1156,15 @@ collect_font_scale (PangoContext *context,
static void
apply_scale_to_item (PangoContext *context,
PangoItem *item,
- double scale)
+ double scale,
+ gboolean is_small_caps)
{
PangoFontDescription *desc;
double size;
+ if (is_small_caps)
+ pango_analysis_set_size_font (&item->analysis, item->analysis.font);
+
desc = pango_font_describe (item->analysis.font);
size = scale * pango_font_description_get_size (desc);
@@ -1182,9 +1190,10 @@ apply_font_scale (PangoContext *context,
{
PangoItem *item = l->data;
double scale;
+ gboolean is_small_caps;
- if (collect_font_scale (context, &stack, item, prev, &scale))
- apply_scale_to_item (context, item, scale);
+ if (collect_font_scale (context, &stack, item, prev, &scale, &is_small_caps))
+ apply_scale_to_item (context, item, scale, is_small_caps);
prev = item;
}