From 48d3b3084864df1e55a9e03e981e9d71561865f2 Mon Sep 17 00:00:00 2001 From: Samuel Rounce Date: Sat, 16 Nov 2024 23:54:01 +0000 Subject: [PATCH] freecad: 1.0rc2 -> 1.0rc4 (cherry picked from commit c2321088e8c7bfb05e2a42616572c17602431349) --- .../0003-freecad-font-issue-10514.patch | 61 ------------------- pkgs/by-name/fr/freecad/package.nix | 5 +- 2 files changed, 2 insertions(+), 64 deletions(-) delete mode 100644 pkgs/by-name/fr/freecad/0003-freecad-font-issue-10514.patch diff --git a/pkgs/by-name/fr/freecad/0003-freecad-font-issue-10514.patch b/pkgs/by-name/fr/freecad/0003-freecad-font-issue-10514.patch deleted file mode 100644 index 3e55b6610265..000000000000 --- a/pkgs/by-name/fr/freecad/0003-freecad-font-issue-10514.patch +++ /dev/null @@ -1,61 +0,0 @@ -diff --git a/src/Gui/PreferencePages/DlgSettingsEditor.cpp b/src/Gui/PreferencePages/DlgSettingsEditor.cpp -index 5f92058c18..b00104497b 100644 ---- a/src/Gui/PreferencePages/DlgSettingsEditor.cpp -+++ b/src/Gui/PreferencePages/DlgSettingsEditor.cpp -@@ -56,27 +56,34 @@ namespace - * - * Based on - * https://stackoverflow.com/questions/18896933/qt-qfont-selection-of-a-monospace-font-doesnt-work -+ * Local fix to based on comment in -+ * https://github.com/FreeCAD/FreeCAD/issues/10514#issuecomment-1849176386 - */ -+bool hasFixedPitch(const QFont& font) -+{ -+ return QFontInfo(font).fixedPitch(); -+} -+ - QFont getMonospaceFont() - { -- QFont font(QString::fromLatin1("monospace")); -- if (font.fixedPitch()) { -- return font; -- } -- font.setStyleHint(QFont::Monospace); -- if (font.fixedPitch()) { -- return font; -+ if (QFont font = QFontDatabase::systemFont(QFontDatabase::FixedFont); hasFixedPitch(font)) { -+ return font; // should typically work. - } -- font.setStyleHint(QFont::TypeWriter); -- if (font.fixedPitch()) { -+ -+ QFont font; // default QApplication font -+ font.setStyleHint(QFont::Courier); // may not work -+ if (hasFixedPitch(font)) { - return font; - } -- font.setFamily(QString::fromLatin1("courier")); -- if (font.fixedPitch()) { -- return font; -+ for (const char* family : {"Monospace", "Courier"}) { -+ font.setFamily(QString::fromLatin1(family)); -+ if (hasFixedPitch(font)) { -+ return font; -+ } - } -- return font; // We failed, but return whatever we have anyway -+ return font; - } -+ - } // namespace - - /* TRANSLATOR Gui::Dialog::DlgSettingsEditor */ -@@ -302,7 +309,7 @@ void DlgSettingsEditor::loadSettings() - ui->fontSize->setValue(10); - ui->fontSize->setValue(hGrp->GetInt("FontSize", ui->fontSize->value())); - -- QByteArray defaultMonospaceFont = getMonospaceFont().family().toLatin1(); -+ QByteArray defaultMonospaceFont = QFontInfo(getMonospaceFont()).family().toLatin1(); - - #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) - QStringList familyNames = QFontDatabase().families(QFontDatabase::Any); diff --git a/pkgs/by-name/fr/freecad/package.nix b/pkgs/by-name/fr/freecad/package.nix index 83d7598ce3e0..f4816f6112fe 100644 --- a/pkgs/by-name/fr/freecad/package.nix +++ b/pkgs/by-name/fr/freecad/package.nix @@ -63,13 +63,13 @@ let in stdenv.mkDerivation (finalAttrs: { pname = "freecad"; - version = "1.0rc2"; + version = "1.0rc4"; src = fetchFromGitHub { owner = "FreeCAD"; repo = "FreeCAD"; rev = finalAttrs.version; - hash = "sha256-kPmfx/C1fCYwBqh6ZOKZAVNVR9m3VryPmBKu3ksDD5E="; + hash = "sha256-b7aeVQkgdsDRdnVIr+5ZNuWAm6GLH7sepa8kFp2Zm2U="; fetchSubmodules = true; }; @@ -131,7 +131,6 @@ stdenv.mkDerivation (finalAttrs: { patches = [ ./0001-NIXOS-don-t-ignore-PYTHONPATH.patch ./0002-FreeCad-OndselSolver-pkgconfig.patch - ./0003-freecad-font-issue-10514.patch ]; cmakeFlags = [