fb8b9d7358
- Backport upstream patch to fix self tests with newer pango
101 lines
3.7 KiB
Diff
101 lines
3.7 KiB
Diff
From 73c1ee7519555aa90c1c45828ffaa2f573812864 Mon Sep 17 00:00:00 2001
|
|
From: Federico Mena Quintero <federico@gnome.org>
|
|
Date: Fri, 22 Sep 2023 11:04:38 -0600
|
|
Subject: [PATCH] (#1019): Fix small-caps and bump the version of Pango
|
|
required to 1.50.0
|
|
|
|
In https://gitlab.gnome.org/GNOME/pango/-/issues/566 it used to be
|
|
that PANGO_VARIANT_SMALL_CAPS didn't work, so librsvg had to request an
|
|
'smcp' feature from OpenType fonts that support it.
|
|
|
|
However, with
|
|
https://gitlab.gnome.org/GNOME/pango/-/merge_requests/497 Pango got
|
|
the ability to do that on its own, or to emulate small-caps for fonts
|
|
that don't have glyphs for them. From the caller's perspective,
|
|
PANGO_VARIANT_SMALL_CAPS now works out of the box.
|
|
|
|
This got introduced in Pango 1.49.3. So, let's bump the requirement
|
|
to Pango 1.50.0. It has been out since December 2021 anyway.
|
|
|
|
I still don't know why updating harfbuzz from 8.1.x ot 8.2.0 made
|
|
librsvg's 'smcp' code stop working. But now that Pango does smarter
|
|
things, I'd rather just require a newer Pango version.
|
|
|
|
Fixes https://gitlab.gnome.org/GNOME/librsvg/-/issues/1019
|
|
|
|
Part-of: <https://gitlab.gnome.org/GNOME/librsvg/-/merge_requests/896>
|
|
---
|
|
configure.ac | 2 +-
|
|
rsvg/Cargo.toml | 6 +++---
|
|
rsvg/src/text.rs | 11 +----------
|
|
3 files changed, 5 insertions(+), 14 deletions(-)
|
|
|
|
diff --git a/configure.ac b/configure.ac
|
|
index 12e39452..f655ba10 100644
|
|
--- a/configure.ac
|
|
+++ b/configure.ac
|
|
@@ -66,7 +66,7 @@ GIO_REQUIRED=2.24.0
|
|
GLIB_REQUIRED=2.50.0
|
|
HARFBUZZ_REQUIRED=2.0.0
|
|
LIBXML_REQUIRED=2.9.0
|
|
-PANGO_REQUIRED=1.46.0
|
|
+PANGO_REQUIRED=1.50.0
|
|
|
|
dnl ===========================================================================
|
|
|
|
diff --git a/rsvg/Cargo.toml b/rsvg/Cargo.toml
|
|
index d95162bf..bc572e8a 100644
|
|
--- a/rsvg/Cargo.toml
|
|
+++ b/rsvg/Cargo.toml
|
|
@@ -28,15 +28,15 @@ gio = { name = "gio-2.0", version = "2.24" }
|
|
glib = { name = "glib-2.0", version = "2.50" }
|
|
harfbuzz = "2.0"
|
|
libxml2 = { name = "libxml-2.0", fallback-names = ["libxml2"], version = "2.9" }
|
|
-pangocairo = "1.46"
|
|
+pangocairo = "1.50"
|
|
|
|
[package.metadata.system-deps.'cfg(windows)']
|
|
fontconfig = { version = "1.7", optional = true }
|
|
-pangoft2 = { version = "1.46", optional = true }
|
|
+pangoft2 = { version = "1.50", optional = true }
|
|
|
|
[package.metadata.system-deps.'cfg(not(windows))']
|
|
fontconfig = { version = "1.7" }
|
|
-pangoft2 = { version = "1.46" }
|
|
+pangoft2 = { version = "1.50" }
|
|
|
|
[features]
|
|
c-api = []
|
|
diff --git a/rsvg/src/text.rs b/rsvg/src/text.rs
|
|
index 10843cdd..a810442c 100644
|
|
--- a/rsvg/src/text.rs
|
|
+++ b/rsvg/src/text.rs
|
|
@@ -1283,9 +1283,7 @@ fn add_pango_attributes(
|
|
font_desc.set_family(props.font_family.as_str());
|
|
font_desc.set_style(pango::Style::from(props.font_style));
|
|
|
|
- // PANGO_VARIANT_SMALL_CAPS does nothing: https://gitlab.gnome.org/GNOME/pango/-/issues/566
|
|
- // see below for using the "smcp" OpenType feature for fonts that support it.
|
|
- // font_desc.set_variant(pango::Variant::from(props.font_variant));
|
|
+ font_desc.set_variant(pango::Variant::from(props.font_variant));
|
|
|
|
font_desc.set_weight(pango::Weight::from(props.font_weight));
|
|
font_desc.set_stretch(pango::Stretch::from(props.font_stretch));
|
|
@@ -1308,13 +1306,6 @@ fn add_pango_attributes(
|
|
attributes.push(pango::AttrInt::new_strikethrough(true).upcast());
|
|
}
|
|
|
|
- // FIXME: Using the "smcp" OpenType feature only works for fonts that support it. We
|
|
- // should query if the font supports small caps, and synthesize them if it doesn't.
|
|
- if props.font_variant == FontVariant::SmallCaps {
|
|
- // smcp - small capitals - https://docs.microsoft.com/en-ca/typography/opentype/spec/features_pt#smcp
|
|
- attributes.push(pango::AttrFontFeatures::new("'smcp' 1").upcast());
|
|
- }
|
|
-
|
|
// Set the range in each attribute
|
|
|
|
for attr in &mut attributes {
|
|
--
|
|
2.41.0
|
|
|