$OpenBSD: patch-src_cairo-pdf-surface_c,v 1.1 2021/10/25 07:21:40 ajacoutot Exp $

From a3b69a0215fdface0fd5730872a4b3242d979dca Mon Sep 17 00:00:00 2001
From: Uli Schlachter <psychon@znc.in>
Date: Tue, 9 Feb 2021 16:54:35 +0100
Subject: [PATCH] pdf font subset: Generate valid font names

Index: src/cairo-pdf-surface.c
--- src/cairo-pdf-surface.c.orig
+++ src/cairo-pdf-surface.c
@@ -5309,18 +5309,14 @@ _create_font_subset_tag (cairo_scaled_font_subset_t	*f
 {
     uint32_t hash;
     int i;
-    long numerator;
-    ldiv_t d;
 
     hash = _hash_data ((unsigned char *) font_name, strlen(font_name), 0);
     hash = _hash_data ((unsigned char *) (font_subset->glyphs),
 		       font_subset->num_glyphs * sizeof(unsigned long), hash);
 
-    numerator = hash;
     for (i = 0; i < 6; i++) {
-	d = ldiv (numerator, 26);
-	numerator = d.quot;
-        tag[i] = 'A' + d.rem;
+	tag[i] = 'A' + (hash % 26);
+	hash /= 26;
     }
     tag[i] = 0;
 }
