Skip to content

Commit

Permalink
cairo: backport fix and enabled dwrite backend
Browse files Browse the repository at this point in the history
  • Loading branch information
lazka committed Mar 20, 2022
1 parent 0fb0e74 commit 853c407
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 16 deletions.
11 changes: 0 additions & 11 deletions mingw-w64-cairo/0040-disable-dwrite.patch

This file was deleted.

31 changes: 31 additions & 0 deletions mingw-w64-cairo/302.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
From 36d75971dde8dffd80311b0e67de53b5dd919e3b Mon Sep 17 00:00:00 2001
From: Adrian Johnson <ajohnson@redneon.com>
Date: Sun, 20 Mar 2022 11:15:12 +1030
Subject: [PATCH] Ensure DWrite toy fonts can not fail if font name not found

---
src/win32/cairo-dwrite-font.cpp | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/win32/cairo-dwrite-font.cpp b/src/win32/cairo-dwrite-font.cpp
index afa859fbd..575d46642 100644
--- a/src/win32/cairo-dwrite-font.cpp
+++ b/src/win32/cairo-dwrite-font.cpp
@@ -327,8 +327,12 @@ _cairo_dwrite_font_face_create_for_toy (cairo_toy_font_face_t *toy_face,
IDWriteFontFamily *family = DWriteFactory::FindSystemFontFamily(face_name);
delete face_name;
if (!family) {
- *font_face = (cairo_font_face_t*)&_cairo_font_face_nil;
- return CAIRO_STATUS_FONT_TYPE_MISMATCH;
+ /* If the family is not found, pick a default that should work to avoid failing. */
+ family = DWriteFactory::FindSystemFontFamily(L"Arial");
+ if (!family) {
+ *font_face = (cairo_font_face_t*)&_cairo_font_face_nil;
+ return CAIRO_STATUS_FONT_TYPE_MISMATCH;
+ }
}

DWRITE_FONT_WEIGHT weight;
--
GitLab

10 changes: 5 additions & 5 deletions mingw-w64-cairo/PKGBUILD
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ pkgbase=mingw-w64-${_realname}
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
_commit='b43e7c6f3cf7855e16170a06d3a9c7234c60ca94'
pkgver=1.17.6
pkgrel=1
pkgrel=2
pkgdesc="Cairo vector graphics library (mingw-w64)"
arch=('any')
mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64' 'clang32' 'clangarm64')
Expand All @@ -32,11 +32,11 @@ options=('strip' 'staticlibs')
source=("https://gitlab.freedesktop.org/cairo/cairo/-/archive/${_commit}/cairo-${_commit}.tar.gz"
0026-create-argb-fonts.all.patch
0030-ucrt-clang-fixes.patch
0040-disable-dwrite.patch)
302.patch)
sha256sums=('e65ca82c44308e36ff07ad860db4eb8b066223277a0f7c9440c839ff204ce86e'
'6db6c44fbdb4926d09afa978fe80430186c4b7b7d255059602b1f94c6a079975'
'86c1af2878a20bd3608fc476e4ba1f2451458a5f6f12e457e37b61082c38db82'
'542802548bd8acf97365abb9f4255e6a9bfdfc12447128fa636c571cb75d3e61')
'86401dee68cdd9463d5f520863d56caa336d06aead90a848e715ab64e11e469e')

prepare() {
mv "${srcdir}/${_realname}-${_commit}" "${srcdir}/${_realname}-${pkgver}"
Expand All @@ -46,8 +46,8 @@ prepare() {

patch -p1 -i ${srcdir}/0030-ucrt-clang-fixes.patch

# https://gitlab.freedesktop.org/cairo/cairo/-/issues/544
patch -p1 -i ${srcdir}/0040-disable-dwrite.patch
# https://gitlab.freedesktop.org/cairo/cairo/-/merge_requests/302
patch -p1 -i ${srcdir}/302.patch
}

build() {
Expand Down

0 comments on commit 853c407

Please sign in to comment.