From patchwork Wed Feb 28 03:08:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hilton Chain X-Patchwork-Id: 61187 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 0804927BBE2; Wed, 28 Feb 2024 03:09:56 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-0.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,FROM_SUSPICIOUS_NTLD,MAILING_LIST_MULTI,PDS_OTHER_BAD_TLD, SPF_HELO_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 5E7AB27BBE9 for ; Wed, 28 Feb 2024 03:09:54 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rfAKG-0000pX-4x; Tue, 27 Feb 2024 22:09:44 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rfAKE-0000pH-Qx for guix-patches@gnu.org; Tue, 27 Feb 2024 22:09:42 -0500 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rfAKE-0005rk-JR for guix-patches@gnu.org; Tue, 27 Feb 2024 22:09:42 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rfAKa-0005Rp-4X; Tue, 27 Feb 2024 22:10:04 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#69424] [PATCH v2 2/5] gnu: font-google-noto: Prefer variable fonts and split outputs. Resent-From: Hilton Chain Original-Sender: "Debbugs-submit" Resent-CC: hako@ultrarare.space, all_but_last@163.com, iyzsong@envs.net, guix-patches@gnu.org Resent-Date: Wed, 28 Feb 2024 03:10:04 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 69424 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 69424@debbugs.gnu.org Cc: Hilton Chain , Jiwei YANG , Hilton Chain , Zhu Zihao , =?utf-8?b?5a6L5paH5q2m?= X-Debbugs-Original-Xcc: Hilton Chain , Zhu Zihao , =?utf-8?b?5a6L5paH5q2m?= Received: via spool by 69424-submit@debbugs.gnu.org id=B69424.170908978820853 (code B ref 69424); Wed, 28 Feb 2024 03:10:04 +0000 Received: (at 69424) by debbugs.gnu.org; 28 Feb 2024 03:09:48 +0000 Received: from localhost ([127.0.0.1]:54893 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rfAKJ-0005Pz-17 for submit@debbugs.gnu.org; Tue, 27 Feb 2024 22:09:47 -0500 Received: from mail.boiledscript.com ([144.168.59.46]:39644) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rfAKF-0005Pg-Ik for 69424@debbugs.gnu.org; Tue, 27 Feb 2024 22:09:44 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ultrarare.space; s=dkim; t=1709089739; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=CxrmAUiAuNNpi/74WGNjP2fOodvf/bJ7laKHOgCh67k=; b=CKRiyoLOT1vzQrAI+KGHpp1+xqvbHaYUZMOIwB0LtDtLV1F8rVBw9N5xd8Ge6hQBkEoI9g oqIEB2LwKi48E+w8GExrZ/Pps0NcdtQmTAcJDF18R+oookNS4WC42M9BJuN3mPcKCJHlCG k8GY5C7qlW3p4dehOsYpZnjTHOopg89rH0HptgFWROuVPJ23rvb6APBJ3zUr374YGSrwz9 XEAa6LaLtdu5A9zL8GdEGEzX21N1eUZpbpZk8Md2JTfPZ+rT61ZgeYCLN4eoOb8WIUpfmL TWgrOXJcr5z6CvreVYp5YwBCBbF3bc59KU7LpXyx1bvtMeVnciDXvRFIixSG7g== Authentication-Results: mail.boiledscript.com; auth=pass smtp.mailfrom=hako@ultrarare.space Date: Wed, 28 Feb 2024 11:08:33 +0800 Message-ID: <236164f917c76f445814e3cdf9bce736c7798ef9.1709089250.git.hako@ultrarare.space> In-Reply-To: References: MIME-Version: 1.0 X-Spamd-Bar: -- X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-to: Hilton Chain X-ACL-Warn: , Hilton Chain via Guix-patches X-Patchwork-Original-From: Hilton Chain via Guix-patches via From: Hilton Chain Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches * gnu/packages/fonts.scm (font-google-noto) [arguments]<#:phase>: Only install variable fonts to "out" when available. Install hinted TTFs into "ttf" output. [outputs]: Add "ttf". Suggested-by: Jiwei YANG Change-Id: Icac2927fb6c35d08504c379e273a5fc03b08ac46 --- gnu/packages/fonts.scm | 44 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/gnu/packages/fonts.scm b/gnu/packages/fonts.scm index 72bf0124c4..9a268364d7 100644 --- a/gnu/packages/fonts.scm +++ b/gnu/packages/fonts.scm @@ -1092,6 +1092,50 @@ (define-public font-google-noto (sha256 (base32 "087jg8ahpq35xwyrmvm9ivxl0wjic2j4r28bbrwqmgdva9brms40")))) (build-system font-build-system) + (arguments + (list + #:modules + '((guix build font-build-system) + (guix build utils) + (ice-9 ftw)) + #:phases + #~(modify-phases %standard-phases + (replace 'install + (lambda _ + (define install + (assoc-ref %standard-phases 'install)) + (define (scan-directory name) + (scandir name (lambda (file) + (not (member file '("." ".." "LICENSE")))))) + (define (install-font-variant variant) + "Given font variant VARIANT, install one of its formats, +variable TTF or OTF or TTF." + (with-directory-excursion variant + (let ((formats (scan-directory "."))) + (cond + ((member "variable-ttf" formats) + (with-directory-excursion "variable-ttf" + (install #:outputs `(("out" . ,#$output))))) + ((member "otf" formats) + (with-directory-excursion "otf" + (install #:outputs `(("out" . ,#$output))))) + ((member "ttf" formats) + (with-directory-excursion "ttf" + (install #:outputs `(("out" . ,#$output))))))))) + (define (install-font font) + "Given font FONT, install one of its variants, full or unhinted, +and install its hinted variant into 'ttf' output. + +unhinted and hinted variants are always available." + (with-directory-excursion font + (if (member "full" (scan-directory ".")) + (install-font-variant "full") + (install-font-variant "unhinted")) + (with-directory-excursion "hinted" + (install #:outputs `(("out" . ,#$output:ttf)))))) + (with-directory-excursion "fonts" + (for-each install-font (scan-directory ".")))))))) + (outputs '("out" "ttf")) (home-page "https://www.google.com/get/noto/") (synopsis "Fonts to cover all languages") (description "Google Noto Fonts is a family of fonts designed to support