Subject: Re: bug#26702: [PATCH 1/2] gnu: Add font-cns11643

From: Marius Bakke <[email-masked]>
Date: Sun, 30 Apr 2017 17:10:02 +0200

Hi Brendan, thanks for this!

Brendan Tildesley <[email-masked]> writes:

> * gnu/packages/fonts.scm (font-cns11643): New variable.

[...]
  
> +(define-public font-cns11643
> +  (package
> +    (name "font-cns11643")
> +    (version "98.1.20170405")
> +    (source (origin
> +              (method url-fetch)
> +              (uri "http://www.cns11643.gov.tw/AIDB/Open_Data.zip")
> +              (sha256
> +               (base32
> +                "1kyfrwamr8zpdp4qw3z9j3cimhsvr4xd05dmxmfphiknlbr6d455"))))

I'm getting a different hash when downloading this:

@ build-failed /gnu/store/b4s6pjp7pvwn5028zxm7dn7hxb7akhxn-Open_Data.zip.drv - 1 output path `/gnu/store/kv2291fl8p8r3ic15pp68751qncrv830-Open_Data.zip' should have sha256 hash `1kyfrwamr8zpdp4qw3z9j3cimhsvr4xd05dmxmfphiknlbr6d455', instead has `02kb3bwjrra0k2hlr2p8xswd2y0xs6j8d9vm6yrby734h02a40qf'

Maybe I'm getting a newer version? If this is updated in-place upstream
very frequently, it would be good to have a way to access older
downloads. Any ideas?

Minor nit-picks follow, but I've corrected this in my local branch:

> +    (outputs '("out" "tw-kai" "tw-sung"))
> +    (build-system trivial-build-system)
> +    (native-inputs
> +     `(("unzip" ,unzip)))
> +    (arguments
> +     `(#:modules ((guix build utils))
> +       #:builder
> +       (begin
> +         (use-modules (guix build utils))
> +         (let* ((font-dir "/share/fonts/truetype/cns11643")
> +                (out (string-append %output font-dir))

I've changes this to use (assoc-ref outputs "out") instead of the
magical %output.

> +                (unzip (string-append
> +                        (assoc-ref %build-inputs "unzip") "/bin/unzip"))
> +                (tw-kai (string-append
> +                         (assoc-ref %outputs "tw-kai") font-dir))
> +                (tw-sung (string-append
> +                          (assoc-ref %outputs "tw-sung") font-dir)))
> +           (system* unzip (assoc-ref %build-inputs "source"))
> +           (chdir "Open_Data/Fonts/")
> +           (install-file "TW-Kai-98_1.ttf" tw-kai)
> +           (install-file "TW-Sung-98_1.ttf" tw-sung)
> +           (install-file "TW-Kai-98_1.ttf" out)
> +           (install-file "TW-Kai-Ext-B-98_1.ttf" out)
> +           (install-file "TW-Kai-Plus-98_1.ttf" out)
> +           (install-file "TW-Sung-98_1.ttf" out)
> +           (install-file "TW-Sung-Ext-B-98_1.ttf" out)
> +           (install-file "TW-Sung-Plus-98_1.ttf" out)))))

And added a #t at the end here, since the return value of "install-file"
is unspecified.

> +    (home-page "http://www.cns11643.gov.tw/AIDB/welcome.do")
> +    (synopsis "CJK TrueType fonts, TW-Kai and TW-Sung")
> +    (description
> +     "@code{CNS 11643} character set (Chinese National Standard, or Chinese
> +Standard Interchange Code) is the standard character set of the Republic of
> +China (Taiwan) for Chinese Characters and other Unicode symbols.  Contained
> +are six TrueType fonts based on two script styles, Regular Script (Kai), and
> +Sung/Ming Script, each with three variants:
> +
> +@itemize
> +@item @code{CNS 11643} (@code{TW-Kai} and @code{TW-Sung}): Tens of thousands
> +of CJK characters from frequency tables published by the Taiwanese
> +Ministry of Education.  ISO 10646 and Unicode compatible code encoding.
> +@item @code{Big-5 Plus}: Several thousand frequently used CJK characters
> +encoded in the user defined area of the Big-5 code.
> +@item @code{Big-5 Extended}: A Big-5 character set based on the
> +@code{Big-5 Plus} and @code{CNS 11643} character sets.
> +@end itemize\n")
> +    (license (license:non-copyleft
> +              "http://data.gov.tw/license"))))

...and added a comment about this license being compatible with CC-BY
4.0 here.

Thanks a lot for packaging these!