1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2013, 2014, 2015 Andreas Enge <andreas@enge.fr>
3 ;;; Copyright © 2014, 2016 Eric Bavier <bavier@member.fsf.org>
4 ;;; Copyright © 2016 Mark H Weaver <mhw@netris.org>
5 ;;; Copyright © 2016, 2017 Efraim Flashner <efraim@flashner.co.il>
6 ;;; Copyright © 2017 Rene Saavedra <rennes@openmailbox.org>
7 ;;; Copyright © 2017 Leo Famulari <leo@famulari.name>
8 ;;; Copyright © 2017 ng0 <ng0@n0.is>
9 ;;; Copyright © 2017, 2018 Tobias Geerinckx-Rice <me@tobias.gr>
10 ;;; Copyright © 2018 Ricardo Wurmus <rekado@elephly.net>
11 ;;; Copyright © 2018 Ludovic Courtès <ludo@gnu.org>
13 ;;; This file is part of GNU Guix.
15 ;;; GNU Guix is free software; you can redistribute it and/or modify it
16 ;;; under the terms of the GNU General Public License as published by
17 ;;; the Free Software Foundation; either version 3 of the License, or (at
18 ;;; your option) any later version.
20 ;;; GNU Guix is distributed in the hope that it will be useful, but
21 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
22 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 ;;; GNU General Public License for more details.
25 ;;; You should have received a copy of the GNU General Public License
26 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
28 (define-module (gnu packages fontutils)
29 #:use-module (gnu packages)
30 #:use-module (gnu packages compression)
31 #:use-module (gnu packages check)
32 #:use-module (gnu packages ghostscript)
33 #:use-module (gnu packages linux)
34 #:use-module (gnu packages perl)
35 #:use-module (gnu packages pkg-config)
36 #:use-module (gnu packages autotools)
37 #:use-module (gnu packages gettext)
38 #:use-module (gnu packages python)
39 #:use-module (gnu packages python-xyz)
40 #:use-module (gnu packages image)
41 #:use-module (gnu packages bison)
42 #:use-module (gnu packages flex)
43 #:use-module (gnu packages glib)
44 #:use-module (gnu packages gperf)
45 #:use-module (gnu packages xorg)
46 #:use-module (gnu packages gtk)
47 #:use-module (gnu packages xml)
48 #:use-module ((guix licenses) #:prefix license:)
49 #:use-module (guix packages)
50 #:use-module (guix download)
51 #:use-module (guix svn-download)
52 #:use-module (guix git-download)
53 #:use-module (guix build-system cmake)
54 #:use-module (guix build-system gnu)
55 #:use-module (guix build-system python))
57 (define-public freetype
63 (uri (string-append "mirror://savannah/freetype/freetype-"
66 "0kg8w6qyiizlyzh4a8lpzslipcbv96hcg3rqqpnxba8ffbm8g3fv"))))
67 (build-system gnu-build-system)
69 ;; The use of "freetype-config" is deprecated, but other packages still
71 `(#:configure-flags (list "--enable-freetype-config")))
73 `(("pkg-config" ,pkg-config)))
75 ;; These are all in the Requires.private field of freetype2.pc.
79 (synopsis "Font rendering library")
81 "Freetype is a library that can be used by applications to access the
82 contents of font files. It provides a uniform interface to access font files.
83 It supports both bitmap and scalable formats, including TrueType, OpenType,
84 Type1, CID, CFF, Windows FON/FNT, X11 PCF, and others. It supports high-speed
85 anti-aliased glyph bitmap generation with 256 gray levels.")
86 (license license:freetype) ; some files have other licenses
87 (home-page "https://www.freetype.org/")))
89 (define-public ttfautohint
96 (uri (string-append "mirror://savannah/freetype/ttfautohint-"
100 "1lgghck46p33z3hg8dnl76jryig4fh6d8rhzms837zp7x4hyfkv4"))
101 (patches (list (search-patch "ttfautohint-source-date-epoch.patch")))))
102 (build-system gnu-build-system)
106 ("pkg-config" ,pkg-config)))
108 `(("freetype" ,freetype)
109 ("harfbuzz" ,harfbuzz)))
111 `(#:configure-flags '("--with-qt=no"))) ;no gui
112 (synopsis "Automated font hinting")
114 "ttfautohint provides a 99% automated hinting process and a platform for
115 finely hand-hinting the last 1%. It is ideal for web fonts and supports many
117 (license (list license:gpl2+ license:freetype)) ;choose one or the other
118 (home-page "http://www.freetype.org/ttfautohint/")))
120 (define-public woff-tools
123 (version "2009.10.04")
127 ;; Upstream source is unversioned, so use Debian's versioned tarball
128 (uri (string-append "mirror://debian/pool/main/w/woff-tools/"
129 "woff-tools_" version ".orig.tar.gz"))
130 (file-name (string-append name "-" version ".tar.gz"))
133 "1i97gkqa6jfzlslsngqf556kx60knlgf7yc9pzsq2pizc6f0d4zl"))))
134 (build-system gnu-build-system)
138 `(#:make-flags '("CC=gcc")
139 #:tests? #f ;no tests
141 (modify-phases %standard-phases
142 (delete 'configure) ;no configuration
144 (lambda* (#:key outputs #:allow-other-keys)
145 (let* ((out (assoc-ref outputs "out"))
146 (bin (string-append out "/bin")))
147 (install-file "sfnt2woff" bin)
148 (install-file "woff2sfnt" bin)))))))
149 (synopsis "Convert between OpenType and WOFF fonts")
151 "This package provides two tools:
154 Converts OpenType fonts to WOFF fonts
156 Converts WOFF fonts to OpenType fonts
158 (license (list license:mpl1.1 license:gpl2+ license:lgpl2.1+))
159 (home-page "https://people.mozilla.com/~jkew/woff/")))
161 (define-public ttf2eot
169 (url "https://github.com/wget/ttf2eot.git")
170 (commit (string-append "v" version))))
171 (file-name (git-file-name name version))
174 "0l2yh2ialx7135pjzhjs204kk3br7zxjr09zwaia493by2adzigr"))
175 (patches (list (search-patch "ttf2eot-cstddef.patch")))))
176 (build-system gnu-build-system)
178 `(#:tests? #f ; no tests
180 (modify-phases %standard-phases
181 (delete 'configure) ; no configuration
182 (replace 'install ; no install target
183 (lambda* (#:key outputs #:allow-other-keys)
184 (let* ((out (assoc-ref outputs "out"))
185 (bin (string-append out "/bin")))
186 (install-file "ttf2eot" bin)
188 (synopsis "Convert from TrueType to Embeddable Open Type")
190 "This package contains a commandline wrapper around OpenTypeUtilities.cpp
191 from Chromium, used to make EOT (Embeddable Open Type) files from
192 TTF (TrueType/OpenType Font) files.")
193 ;; While the README states "License: Derived from WebKit, so BSD/LGPL
194 ;; 2/LGPL 2.1", the single derived source file includes only BSD in its
195 ;; license header, and the wrapper source contains no license header.
196 (license license:bsd-2)
197 (home-page "https://github.com/wget/ttf2eot")))
199 (define-public ttf2pt1
205 (uri (string-append "mirror://sourceforge/ttf2pt1/ttf2pt1/"
206 version "/ttf2pt1-" version ".tgz"))
209 "1l718n4k4widx49xz7qrj4mybzb8q67kp2jw7f47604ips4654mf"))
210 (modules '((guix build utils)))
213 ;; Remove trailing backslashes in the sed expression of the
214 ;; 'install' rule since sed would otherwise fail.
215 (substitute* "Makefile"
216 (("\\|;\\\\[[:space:]]*$") "|; "))
218 (build-system gnu-build-system)
220 '(#:tests? #f ;no tests
221 #:phases (modify-phases %standard-phases
223 (lambda* (#:key outputs #:allow-other-keys)
224 (let ((out (assoc-ref outputs "out")))
225 (substitute* "Makefile"
227 (string-append "INSTDIR = " out "\n"))
229 "OWNER = `id -un`\n")
231 "GROUP = `id -g`\n"))
236 (number->string (parallel-job-count))
238 (inputs `(("perl" ,perl)))
239 (synopsis "Convert TrueType fonts to Postscript Type 1")
241 "TTF2PT1 provides tools to convert most TrueType fonts (or other formats
242 supported by the FreeType library) to an Adobe Type 1 @file{.pfa} or
243 @file{.pfb} file. Another use is as a hinting engine: feed it an unhinted or
244 poorly hinted Adobe Type 1 font through the FreeType library and get it back
245 with freshly generated hints. The files produced by default are in
246 human-readable form, which further needs to be encoded with t1utilities to
247 work with most software requiring Type 1 fonts.")
248 (home-page "http://ttf2pt1.sourceforge.net/")
249 (license license:bsd-3)))
252 (let ((commit "4e698b8c6c5e070d53c340db9ddf160e21070ede")
256 (version (string-append "20160306-" revision "."
257 (string-take commit 7)))
261 (url "https://github.com/google/woff2.git")
263 (file-name (string-append name "-" version ".tar.xz"))
266 "0wka0yhf0cjmd4rv2jckxpyv6lb5ckj4nj0k1ajq5hrjy7f30lcp"))
267 (patches (list (search-patch "woff2-libbrotli.patch")))))
268 (build-system gnu-build-system)
270 `(("pkg-config" ,pkg-config)))
272 `(("brotli" ,brotli)))
274 `(#:tests? #f ;no tests
275 #:phases (modify-phases %standard-phases
278 (lambda* (#:key outputs #:allow-other-keys)
279 (let* ((out (assoc-ref outputs "out"))
280 (bin (string-append out "/bin")))
281 (install-file "woff2_compress" bin)
282 (install-file "woff2_decompress" bin)
284 (synopsis "Compress TrueType fonts to WOFF2")
286 "This package provides utilities for compressing/decompressing TrueType
287 fonts to/from the WOFF2 format.")
288 (license license:asl2.0)
289 (home-page "https://github.com/google/woff2"))))
291 (define-public fontconfig
298 "https://www.freedesktop.org/software/fontconfig/release/fontconfig-"
301 "0hb700a68kk0ip51wdlnjjc682kvlrmb6q920mzajykdk0mdsmgn"))))
302 (build-system gnu-build-system)
303 ;; In Requires or Requires.private of fontconfig.pc.
304 (propagated-inputs `(("expat" ,expat)
305 ("freetype" ,freetype)
306 ("libuuid" ,util-linux)))
307 (inputs `(("gs-fonts" ,gs-fonts)))
310 ("pkg-config" ,pkg-config)))
313 (list "--with-cache-dir=/var/cache/fontconfig"
314 ;; register gs-fonts as default fonts
315 (string-append "--with-default-fonts="
316 (assoc-ref %build-inputs "gs-fonts")
319 ;; Register fonts from user and system profiles.
320 (string-append "--with-add-fonts="
321 "~/.guix-profile/share/fonts,"
322 "/run/current-system/profile/share/fonts")
324 ;; python is not actually needed
327 (modify-phases %standard-phases
330 ;; Don't try to create /var/cache/fontconfig.
331 (invoke "make" "install"
332 "fc_cachedir=$(TMPDIR)"
333 "RUN_FC_CACHE_TEST=false"))))))
334 (synopsis "Library for configuring and customizing font access")
336 "Fontconfig can discover new fonts when installed automatically;
337 perform font name substitution, so that appropriate alternative fonts can
338 be selected if fonts are missing;
339 identify the set of fonts required to completely cover a set of languages;
340 have GUI configuration tools built as it uses an XML-based configuration file;
341 efficiently and quickly find needed fonts among the set of installed fonts;
342 be used in concert with the X Render Extension and FreeType to implement
343 high quality, anti-aliased and subpixel rendered text on a display.")
344 ; The exact license is more X11-style than BSD-style.
345 (license (license:non-copyleft "file://COPYING"
346 "See COPYING in the distribution."))
347 (home-page "https://www.freedesktop.org/wiki/Software/fontconfig")))
355 (uri (list (string-append "ftp://sunsite.unc.edu/pub/Linux/libs/"
356 "graphics/" name "-" version ".tar.gz")
357 (string-append "https://fossies.org/linux/misc/old/"
358 name "-" version ".tar.gz")))
360 "0nbvjpnmcznib1nlgg8xckrmsw3haa154byds2h90y2g0nsjh4w2"))
361 (patches (search-patches
362 "t1lib-CVE-2010-2642.patch" ; 2011-0443, 2011-5244
363 "t1lib-CVE-2011-0764.patch"
364 "t1lib-CVE-2011-1552+.patch")))) ; 2011-1553, 2011-1554
365 (properties `((lint-hidden-cve . ("CVE-2011-0433"
369 (build-system gnu-build-system)
371 ;; Making the documentation requires latex, but t1lib is also an input
372 ;; for building texlive.
373 `(#:tests? #f ; no test target
376 (synopsis "Library for generating bitmaps from Type 1 fonts")
378 "T1lib is a library for generating/rasterising bitmaps from Type 1 fonts.
379 It is based on the code of the X11 rasteriser of the X11 project.
381 The bitmaps created by t1lib are returned in a data structure with type
382 GLYPH. This special GLYPH-type is also used in the X11 window system to
383 describe character bitmaps. It contains the bitmap data as well as some
384 metric information. But t1lib is in itself entirely independent of the
385 X11-system or any other graphical user interface.")
386 (license license:gpl2)
387 (home-page "http://www.t1lib.org/")))
389 (define-public teckit
392 (version "2.5.9") ;signed by key 0xC9183BEA0288CDEE
396 (uri (string-append "https://github.com/silnrsi/teckit/releases/"
397 "download/v" version "/teckit-" version ".tar.gz"))
399 (base32 "0gbxyip4wdibirdg2pvzayzyy927vxyd6dfyfiflx8zg88qzn8v8"))))
400 (build-system gnu-build-system)
405 `(("perl" ,perl))) ;for the tests
406 (synopsis "Toolkit for encoding conversions")
408 "TECkit is a low-level toolkit intended to be used by other applications
409 that need to perform encoding conversions (e.g., when importing legacy data
410 into a Unicode-based application). The primary component of the TECkit
411 package is therefore a library that performs conversions; this is the
412 \"TECkit engine\". The engine relies on mapping tables in a specific binary
413 format (for which documentation is available); there is a compiler that
414 creates such tables from a human-readable mapping description (a simple
417 To facilitate the development and testing of mapping tables for TECkit,
418 several applications are also included in the current package; these
419 include simple tools for applying conversions to plain-text and Standard
420 Format files, as well as both command-line and simple GUI versions of the
421 TECkit compiler. However, it is not intended that these tools will be the
422 primary means by which end users perform conversions, and they have not
423 been designed, tested, and debugged to the extent that general-purpose
424 applications should be.")
425 (license license:lgpl2.1+)
426 (home-page "http://scripts.sil.org/cms/scripts/page.php?cat_id=teckit")))
428 (define-public graphite2
435 (uri (string-append "https://github.com/silnrsi/graphite/releases/"
436 "download/" version "/" name "-" version ".tgz"))
439 "1l1940d8fz67jm6a0x8cjb5p2dv48cvz3wcskwa83hamd70k15fd"))))
440 (build-system cmake-build-system)
442 `(("python" ,python-2) ; because of "import imap" in tests
443 ("python-fonttools" ,python2-fonttools)))
445 `(("freetype" ,freetype)))
446 (synopsis "Reimplementation of the SIL Graphite text processing engine")
448 "Graphite2 is a reimplementation of the SIL Graphite text processing
449 engine. Graphite is a smart font technology designed to facilitate the
450 process known as shaping. This process takes an input Unicode text string
451 and returns a sequence of positioned glyphids from the font.")
452 (license license:lgpl2.1+)
453 (home-page "https://github.com/silnrsi/graphite")))
455 (define-public potrace
462 (uri (string-append "mirror://sourceforge/potrace/" version
463 "/potrace-" version ".tar.gz"))
466 "17ajildjp14shsy339xarh1lw1p0k60la08ahl638a73mh23kcx9"))
467 (patches (search-patches "potrace-tests.patch"))))
468 (build-system gnu-build-system)
469 (native-inputs `(("ghostscript" ,ghostscript))) ;for tests
470 (inputs `(("zlib" ,zlib)))
473 `("--with-libpotrace"))) ; install library and headers
474 (synopsis "Transform bitmaps into vector graphics")
476 "Potrace is a tool for tracing a bitmap, which means, transforming a
477 bitmap into a smooth, scalable image. The input is a bitmap (PBM, PGM, PPM,
478 or BMP format), and the default output is an encapsulated PostScript
479 file (EPS). A typical use is to create EPS files from scanned data, such as
480 company or university logos, handwritten notes, etc. The resulting image is
481 not \"jaggy\" like a bitmap, but smooth. It can then be rendered at any
483 (license license:gpl2+)
484 (home-page "http://potrace.sourceforge.net/")))
486 (define-public libotf
492 (uri (string-append "mirror://savannah/m17n/libotf-"
495 (base32 "0sq6g3xaxw388akws6qrllp3kp2sxgk2dv4j79k6mm52rnihrnv8"))))
496 (build-system gnu-build-system)
498 `(("pkg-config" ,pkg-config)))
500 `(("freetype" ,freetype)))
501 (home-page "https://www.nongnu.org/m17n/")
502 (synopsis "Library for handling OpenType Font")
503 (description "This library can read Open Type Layout Tables from an OTF
504 file. Currently these tables are supported; head, name, cmap, GDEF, GSUB, and
505 GPOS. It can convert a Unicode character sequence to a glyph code sequence by
506 using the above tables.")
507 (license license:lgpl2.0+)))
509 (define-public libspiro
512 (version "0.5.20150702")
516 (uri (string-append "https://github.com/fontforge/libspiro/releases"
517 "/download/" version "/libspiro-dist-" version ".tar.gz"))
520 "153ckwj6h3wwlsgcppzqj8cymv1927hi8ar8fzpchq5q89cj2kai"))))
521 (build-system gnu-build-system)
522 (synopsis "Clothoid to bezier conversion library")
524 "Raph Levien's Spiro package as a library. A mechanism for drawing
525 smooth contours with constant curvature at the spline joins.")
526 (license license:gpl2+)
527 (home-page "http://libspiro.sourceforge.net/")))
529 (define-public libuninameslist
531 (name "libuninameslist")
533 (home-page "https://github.com/fontforge/libuninameslist")
537 (uri (string-append home-page "/releases/download/" version
538 "/libuninameslist-dist-" version ".tar.gz"))
541 "1rwd2bgcyvign9agyjsr3v2fr9j1cg2wi6g0z2wwg1az32scknwq"))))
542 (build-system gnu-build-system)
543 (synopsis "Unicode names and annotation list")
545 "LibUniNamesList holds www.unicode.org Nameslist.txt data which can be
546 useful for programs that need Unicode \"Names\", \"Annotations\", and block
548 ;; COPYING specifies GPL2, but according to LICENSE it only covers the
549 ;; configure script. The actual code is BSD-3, and the Unicode data
550 ;; is governed by an X11-style license only found on the web.
551 (license (list license:bsd-3
553 "https://www.unicode.org/copyright.html#License")))))
555 (define-public fontforge
562 "https://github.com/fontforge/fontforge/releases/download/"
563 version "/fontforge-" version ".tar.gz"))
565 "1ddqbpc32cgbccdnv0lfw0qhj59hcqzb7616ph5lkvm91pnas4dp"))))
566 (build-system gnu-build-system)
568 `(("pkg-config" ,pkg-config)))
569 (inputs `(("cairo" ,cairo)
570 ("fontconfig" ,fontconfig) ;dlopen'd
571 ("freetype" ,freetype)
572 ("gettext" ,gettext-minimal)
573 ("glib" ,glib) ;needed for pango detection
581 ("libspiro" ,libspiro)
583 ("libungif" ,libungif)
584 ("libuninameslist" ,libuninameslist)
589 ;; FIXME: We use Python 2 here because there is a bug in Python
590 ;; 3.7 that is triggered when Py_Main is called after Py_Init, as
591 ;; is done by fontforge. This will be fixed in Python 3.7.1.
596 (modify-phases %standard-phases
597 (add-after 'install 'set-library-path
598 (lambda* (#:key inputs outputs #:allow-other-keys)
599 (let ((out (assoc-ref outputs "out"))
600 (potrace (string-append (assoc-ref inputs "potrace") "/bin")))
601 (wrap-program (string-append out "/bin/fontforge")
602 ;; Fontforge dynamically opens libraries.
603 `("LD_LIBRARY_PATH" ":" prefix
604 ,(map (lambda (input)
605 (string-append (assoc-ref inputs input)
607 '("libtiff" "libjpeg" "libpng" "libungif"
608 "libxml2" "zlib" "libspiro" "freetype"
609 "pango" "cairo" "fontconfig")))
610 ;; Checks for potrace program at runtime
611 `("PATH" ":" prefix (,potrace)))
613 (synopsis "Outline font editor")
615 "FontForge allows you to create and modify postscript, truetype and
616 opentype fonts. You can save fonts in many different outline formats, and
618 (license license:gpl3+)
619 (home-page "https://fontforge.github.io/en-US/")))
621 (define-public python2-ufolib
623 (name "python2-ufolib")
628 (uri (pypi-uri "ufoLib" version ".zip"))
630 (base32 "07qy6mx7z0wi9a30lc2hj5i9q1gnz1n8l40dmjz2c19mj9s6mz9l"))))
631 (build-system python-build-system)
633 `(#:python ,python-2))
635 `(("python2-fonttools" ,python2-fonttools)))
638 ("python2-pytest" ,python2-pytest)
639 ("python2-pytest-runner" ,python2-pytest-runner)))
640 (home-page "https://github.com/unified-font-object/ufoLib")
641 (synopsis "Low-level UFO reader and writer")
643 "UfoLib reads and writes Unified Font Object (UFO)
644 files. UFO is a file format that stores fonts source files.")
645 (license license:bsd-3)))
647 (define-public python2-defcon
649 (name "python2-defcon")
654 (uri (pypi-uri "defcon" version ".zip"))
657 "03jlm2gy9lvbwj68kfdm43yaddwd634jwkdg4wf0jxx2s8mwbg22"))))
658 (build-system python-build-system)
660 `(#:python ,python-2))
663 ("python2-pytest" ,python2-pytest)
664 ("python2-pytest-runner" ,python2-pytest-runner)))
666 `(("python2-fonttools" ,python2-fonttools)
667 ("python2-ufolib" ,python2-ufolib)))
668 (home-page "https://pypi.python.org/pypi/defcon")
669 (synopsis "Flexible objects for representing @acronym{UFO, unified font object} data")
671 "Defcon is a set of @acronym{UFO, unified font object} based objects
672 optimized for use in font editing applications. The objects are built to
673 be lightweight, fast and flexible. The objects are very bare-bones and
674 they are not meant to be end-all, be-all objects. Rather, they are meant
675 to provide base functionality so that you can focus on your application’s
676 behavior, not object observing or maintaining cached data. Defcon
677 implements UFO3 as described by the UFO font format.")
678 (license license:expat)))
680 (define-public nototools
687 (uri (string-append "https://github.com/googlei18n/nototools/"
688 "archive/v2017-09-25-tooling-for-phase3-"
690 (file-name (string-append name "-" version ".tar.gz"))
693 "1pvacw18cm9l4sb66pqyjc7hc74xhhfxc7kd5ald8lixf4wzg0s8"))))
694 (build-system python-build-system)
696 `(#:python ,python-2))
698 `(("python2-booleanoperations" ,python2-booleanoperations)
699 ("python2-defcon" ,python2-defcon)
700 ("python2-fonttools" ,python2-fonttools)
701 ("python2-pillow" ,python2-pillow)
702 ("python2-pyclipper" ,python2-pyclipper)
703 ("python2-ufolib" ,python2-ufolib)))
704 (home-page "https://github.com/googlei18n/nototools")
705 (synopsis "Noto fonts support tools and scripts")
707 "Nototools is a Python package containing Python scripts used to
708 maintain the Noto Fonts project.")
709 (license (list license:asl2.0
710 ;; Sample texts are attributed to UN and OHCHR.
711 ;; The permissions on the UDHR are pretty lax:
712 ;; http://www.ohchr.org/EN/UDHR/Pages/Introduction.aspx
713 ;; "If UDHR translations or materials are reproduced, users
714 ;; should make reference to this website as a source by
715 ;; providing a link."
716 license:public-domain
717 (license:non-copyleft
718 "file://sample_texts/attributions.txt"
719 "See sample_texts/attributions.txt in the distribution.")))))