From patchwork Wed Feb 28 13:32:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hilton Chain X-Patchwork-Id: 61217 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 4F8F727BBE9; Wed, 28 Feb 2024 13:52:57 +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 6B41D27BBE2 for ; Wed, 28 Feb 2024 13:52:56 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rfKMV-0003kM-C5; Wed, 28 Feb 2024 08:52:43 -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 1rfKMU-0003k8-02 for guix-patches@gnu.org; Wed, 28 Feb 2024 08:52: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 1rfKMT-0000tH-Kv for guix-patches@gnu.org; Wed, 28 Feb 2024 08:52:41 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rfKMo-00082K-0z; Wed, 28 Feb 2024 08:53:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#69424] [PATCH v3 2/5] gnu: font-google-noto: Prefer variable fonts and split outputs. Resent-From: Hilton Chain Original-Sender: "Debbugs-submit" Resent-CC: all_but_last@163.com, iyzsong@envs.net, guix-patches@gnu.org Resent-Date: Wed, 28 Feb 2024 13:53:01 +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 , Zhu Zihao , =?utf-8?b?5a6L5paH5q2m?= X-Debbugs-Original-Xcc: Zhu Zihao , =?utf-8?b?5a6L5paH?= =?utf-8?b?5q2m?= Received: via spool by 69424-submit@debbugs.gnu.org id=B69424.170912837130866 (code B ref 69424); Wed, 28 Feb 2024 13:53:01 +0000 Received: (at 69424) by debbugs.gnu.org; 28 Feb 2024 13:52:51 +0000 Received: from localhost ([127.0.0.1]:41216 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rfKMd-00081m-EF for submit@debbugs.gnu.org; Wed, 28 Feb 2024 08:52:51 -0500 Received: from mail.boiledscript.com ([144.168.59.46]:43486) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rfKMb-00081Y-AN for 69424@debbugs.gnu.org; Wed, 28 Feb 2024 08:52:50 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ultrarare.space; s=dkim; t=1709127145; 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=M3yaA3QTBkKFg+jr1fn3xfUHUVFered2vb1S8Pa+4MQ=; b=hvew+DF4QjCENgPtvpOCpuTAp+U2BndH+uwAFspxrG1cS3CK1lqVQVlj5Q1W+RitZLr2mB ac0PIyTrulv5rFkb48f/LcF7Sa0dYfQ78M2WXqBjHOf1+WE7DNtNNqqfx/D3LuuHWqpEbh Pcg7DacYDPWngkP8s2zuPrMcx5pO9ViV48/cTdC0JtjA87Y681nNqhmTTfvs+PfbBlkQ5F CZ7rCke5oejVHpgtDEOn+BD5f7Kjes73dTNAHsadXsI4QJlQ3uFY4/UXI5jUlUmJjV5In2 vq41wuCUiWeKTMfr61OLk8YTkA29NOqO06hTnG4Ra06cPD9rrBrpfgEvq0/Psw== Authentication-Results: mail.boiledscript.com; auth=pass smtp.mailfrom=hako@ultrarare.space Date: Wed, 28 Feb 2024 21:32:19 +0800 Message-ID: <5eada4da5298fdaba9d6a05b411161637b3a42a4.1709126510.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)[outputs]: Add "ttf". [arguments]<#:phase>: Move hinted TTFs into it. Prefer variable fonts. Suggested-by: Jiwei YANG Change-Id: Icac2927fb6c35d08504c379e273a5fc03b08ac46 --- gnu/packages/fonts.scm | 45 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/gnu/packages/fonts.scm b/gnu/packages/fonts.scm index 72bf0124c4..4f9400047f 100644 --- a/gnu/packages/fonts.scm +++ b/gnu/packages/fonts.scm @@ -1092,6 +1092,51 @@ (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 source #:optional (output #$output)) + (let ((%install (assoc-ref %standard-phases 'install))) + (with-directory-excursion source + (%install #:outputs `(("out" . ,output)))))) + + (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) + (install "variable-ttf")) + ((member "otf" formats) + (install "otf")) + ((member "ttf" formats) + (install "ttf")))))) + + (define (install-font font) + "Given FONT, install one of its variants, either full or +unhinted, and install its hinted variant into 'ttf' output. According to the +source, unhinted and hinted variants are always available." + (with-directory-excursion font + (if (member "full" (scan-directory ".")) + (install-font-variant "full") + (install-font-variant "unhinted")) + (install "hinted" #$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