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 Efraim Flashner <efraim@flashner.co.il>
7 ;;; This file is part of GNU Guix.
9 ;;; GNU Guix is free software; you can redistribute it and/or modify it
10 ;;; under the terms of the GNU General Public License as published by
11 ;;; the Free Software Foundation; either version 3 of the License, or (at
12 ;;; your option) any later version.
14 ;;; GNU Guix is distributed in the hope that it will be useful, but
15 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
16 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 ;;; GNU General Public License for more details.
19 ;;; You should have received a copy of the GNU General Public License
20 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
22 (define-module (gnu packages fontutils)
23 #:use-module (gnu packages)
24 #:use-module (gnu packages compression)
25 #:use-module (gnu packages ghostscript)
26 #:use-module (gnu packages perl)
27 #:use-module (gnu packages pkg-config)
28 #:use-module (gnu packages autotools)
29 #:use-module (gnu packages gettext)
30 #:use-module (gnu packages python)
31 #:use-module (gnu packages image)
32 #:use-module (gnu packages bison)
33 #:use-module (gnu packages flex)
34 #:use-module (gnu packages glib)
35 #:use-module (gnu packages xorg)
36 #:use-module (gnu packages gtk)
37 #:use-module (gnu packages xml)
38 #:use-module ((guix licenses) #:prefix license:)
39 #:use-module (guix packages)
40 #:use-module (guix download)
41 #:use-module (guix svn-download)
42 #:use-module (guix git-download)
43 #:use-module (guix build-system cmake)
44 #:use-module (guix build-system gnu))
46 (define-public freetype
52 (uri (string-append "mirror://savannah/freetype/freetype-"
55 "18k3b026762lmyrxfil5xv8qwnvj7hc12gz9bjqzbb12lmx707ip"))))
56 (build-system gnu-build-system)
58 `(("pkg-config" ,pkg-config)))
60 ;; These are all in the Requires.private field of freetype2.pc.
64 (synopsis "Font rendering library")
66 "Freetype is a library that can be used by applications to access the
67 contents of font files. It provides a uniform interface to access font files.
68 It supports both bitmap and scalable formats, including TrueType, OpenType,
69 Type1, CID, CFF, Windows FON/FNT, X11 PCF, and others. It supports high-speed
70 anti-aliased glyph bitmap generation with 256 gray levels.")
71 (license license:freetype) ; some files have other licenses
72 (home-page "http://www.freetype.org/")))
74 (define-public ttfautohint
81 (uri (string-append "mirror://savannah/freetype/ttfautohint-"
85 "1lgghck46p33z3hg8dnl76jryig4fh6d8rhzms837zp7x4hyfkv4"))
86 (patches (list (search-patch "ttfautohint-source-date-epoch.patch")))))
87 (build-system gnu-build-system)
91 ("pkg-config" ,pkg-config)))
93 `(("freetype" ,freetype)
94 ("harfbuzz" ,harfbuzz)))
96 `(#:configure-flags '("--with-qt=no"))) ;no gui
97 (synopsis "Automated font hinting")
99 "ttfautohint provides a 99% automated hinting process and a platform for
100 finely hand-hinting the last 1%. It is ideal for web fonts and supports many
102 (license (list license:gpl2+ license:freetype)) ;choose one or the other
103 (home-page "http://www.freetype.org/ttfautohint/")))
105 (define-public woff-tools
108 (version "2009.10.04")
112 ;; Upstream source is unversioned, so use Debian's versioned tarball
113 (uri (string-append "mirror://debian/pool/main/w/woff-tools/"
114 "woff-tools_" version ".orig.tar.gz"))
115 (file-name (string-append name "-" version ".tar.gz"))
118 "1i97gkqa6jfzlslsngqf556kx60knlgf7yc9pzsq2pizc6f0d4zl"))))
119 (build-system gnu-build-system)
123 `(#:make-flags '("CC=gcc")
124 #:tests? #f ;no tests
126 (modify-phases %standard-phases
127 (delete 'configure) ;no configuration
129 (lambda* (#:key outputs #:allow-other-keys)
130 (let* ((out (assoc-ref outputs "out"))
131 (bin (string-append out "/bin")))
132 (install-file "sfnt2woff" bin)
133 (install-file "woff2sfnt" bin)))))))
134 (synopsis "Convert between OpenType and WOFF fonts")
136 "This package provides two tools:
139 Converts OpenType fonts to WOFF fonts
141 Converts WOFF fonts to OpenType fonts
143 (license (list license:mpl1.1 license:gpl2+ license:lgpl2.1+))
144 (home-page "https://people.mozilla.com/~jkew/woff/")))
146 (define-public ttf2eot
153 (uri (string-append "https://storage.googleapis.com/"
154 "google-code-archive-downloads/v2/"
155 "code.google.com/ttf2eot/"
156 "ttf2eot-" version ".tar.gz"))
159 "1f4dzzmhn0208dvbm3ia5ar6ls9apwc6ampy5blmfxkigi6z0g02"))
160 (patches (list (search-patch "ttf2eot-cstddef.patch")))))
161 (build-system gnu-build-system)
163 `(#:tests? #f ;no tests
165 (modify-phases %standard-phases
166 (delete 'configure) ;no configuration
168 (lambda* (#:key outputs #:allow-other-keys)
169 (let* ((out (assoc-ref outputs "out"))
170 (bin (string-append out "/bin")))
171 (install-file "ttf2eot" bin)))))))
172 (synopsis "Convert from TrueType to Embeddable Open Type")
174 "This package contains a commandline wrapper around OpenTypeUtilities.cpp
175 from Chromium, used to make EOT (Embeddable Open Type) files from
176 TTF (TrueType/OpenType Font) files.")
177 ;; While the README states "License: Derived from WebKit, so BSD/LGPL
178 ;; 2/LGPL 2.1", the single derived source file includes only BSD in its
179 ;; license header, and the wrapper source contains no license header.
180 (license license:bsd-2)
181 (home-page "https://code.google.com/archive/p/ttf2eot/")))
184 (let ((commit "4e698b8c6c5e070d53c340db9ddf160e21070ede")
188 (version (string-append "20160306-" revision "."
189 (string-take commit 7)))
193 (url "https://github.com/google/woff2.git")
195 (file-name (string-append name "-" version ".tar.xz"))
198 "0wka0yhf0cjmd4rv2jckxpyv6lb5ckj4nj0k1ajq5hrjy7f30lcp"))
199 (patches (list (search-patch "woff2-libbrotli.patch")))))
200 (build-system gnu-build-system)
202 `(("pkg-config" ,pkg-config)))
204 `(("brotli" ,brotli)))
206 `(#:tests? #f ;no tests
207 #:phases (modify-phases %standard-phases
210 (lambda* (#:key outputs #:allow-other-keys)
211 (let* ((out (assoc-ref outputs "out"))
212 (bin (string-append out "/bin")))
213 (install-file "woff2_compress" bin)
214 (install-file "woff2_decompress" bin)
216 (synopsis "Compress TrueType fonts to WOFF2")
218 "This package provides utilities for compressing/decompressing TrueType
219 fonts to/from the WOFF2 format.")
220 (license license:asl2.0)
221 (home-page "https://github.com/google/woff2"))))
223 (define-public fontconfig
230 "https://www.freedesktop.org/software/fontconfig/release/fontconfig-"
233 "1psrl4b4gi4wmbvwwh43lk491wsl8lgvqj146prlcha3vwjc0qyp"))))
234 (build-system gnu-build-system)
235 (propagated-inputs `(("expat" ,expat)
236 ("freetype" ,freetype)))
237 (inputs `(("gs-fonts" ,gs-fonts)))
239 `(("pkg-config" ,pkg-config)))
242 (list "--with-cache-dir=/var/cache/fontconfig"
243 ;; register gs-fonts as default fonts
244 (string-append "--with-default-fonts="
245 (assoc-ref %build-inputs "gs-fonts")
248 ;; Register fonts from user and system profiles.
249 (string-append "--with-add-fonts="
250 "~/.guix-profile/share/fonts,"
251 "/run/current-system/profile/share/fonts")
253 ;; python is not actually needed
256 (modify-phases %standard-phases
259 ;; Don't try to create /var/cache/fontconfig.
260 (zero? (system* "make" "install"
261 "fc_cachedir=$(TMPDIR)"
262 "RUN_FC_CACHE_TEST=false")))))))
263 (synopsis "Library for configuring and customizing font access")
265 "Fontconfig can discover new fonts when installed automatically;
266 perform font name substitution, so that appropriate alternative fonts can
267 be selected if fonts are missing;
268 identify the set of fonts required to completely cover a set of languages;
269 have GUI configuration tools built as it uses an XML-based configuration file;
270 efficiently and quickly find needed fonts among the set of installed fonts;
271 be used in concert with the X Render Extension and FreeType to implement
272 high quality, anti-aliased and subpixel rendered text on a display.")
273 ; The exact license is more X11-style than BSD-style.
274 (license (license:non-copyleft "file://COPYING"
275 "See COPYING in the distribution."))
276 (home-page "http://www.freedesktop.org/wiki/Software/fontconfig")))
284 (uri "ftp://sunsite.unc.edu/pub/Linux/libs/graphics/t1lib-5.1.2.tar.gz")
286 "0nbvjpnmcznib1nlgg8xckrmsw3haa154byds2h90y2g0nsjh4w2"))))
287 (build-system gnu-build-system)
289 ;; Making the documentation requires latex, but t1lib is also an input
290 ;; for building texlive.
291 `(#:tests? #f ; no test target
294 (synopsis "Library for generating bitmaps from Type 1 fonts")
296 "T1lib is a library for generating/rasterising bitmaps from Type 1 fonts.
297 It is based on the code of the X11 rasteriser of the X11 project.
299 The bitmaps created by t1lib are returned in a data structure with type
300 GLYPH. This special GLYPH-type is also used in the X11 window system to
301 describe character bitmaps. It contains the bitmap data as well as some
302 metric information. But t1lib is in itself entirely independent of the
303 X11-system or any other graphical user interface.")
304 (license license:gpl2)
305 (home-page "http://www.t1lib.org/")))
307 (define-public teckit
312 ;; Downloaded tarballs vary with each download, so we use an
313 ;; svn snapshot. The 2.5.4 release seems to be made in r128,
314 ;; but r132 updates additional files to contain the correct
315 ;; version number (r129 to r131 do not concern TRUNK).
318 (url "https://scripts.sil.org/svn-public/teckit/TRUNK")
320 (file-name (string-append name "-" version))
323 "1xqkqgw30pb24snh46srmjs2j4zhz2dfi5pf7znia0k34mrpwivz"))))
324 (build-system gnu-build-system)
325 (inputs `(("zlib" ,zlib)))
327 `(("autoconf" ,autoconf)
328 ("automake" ,automake)
330 ("perl" ,perl))) ; for the tests
333 (modify-phases %standard-phases
334 (add-after 'unpack 'autogen
336 (zero? (system* "sh" "autogen.sh")))))))
337 (synopsis "Toolkit for encoding conversions")
339 "TECkit is a low-level toolkit intended to be used by other applications
340 that need to perform encoding conversions (e.g., when importing legacy data
341 into a Unicode-based application). The primary component of the TECkit
342 package is therefore a library that performs conversions; this is the
343 \"TECkit engine\". The engine relies on mapping tables in a specific binary
344 format (for which documentation is available); there is a compiler that
345 creates such tables from a human-readable mapping description (a simple
348 To facilitate the development and testing of mapping tables for TECkit,
349 several applications are also included in the current package; these
350 include simple tools for applying conversions to plain-text and Standard
351 Format files, as well as both command-line and simple GUI versions of the
352 TECkit compiler. However, it is not intended that these tools will be the
353 primary means by which end users perform conversions, and they have not
354 been designed, tested, and debugged to the extent that general-purpose
355 applications should be.")
356 (license license:lgpl2.1+)
357 (home-page "http://scripts.sil.org/cms/scripts/page.php?cat_id=teckit")))
359 (define-public graphite2
366 (uri (string-append "https://github.com/silnrsi/graphite/releases/"
367 "download/" version "/" name "-" version ".tgz"))
370 "1hlc9j7w7gihy6gvzfa7902pr6yxq1sr1xkp5rwf0p29m2rjagwz"))))
371 (build-system cmake-build-system)
373 `(("python" ,python-2) ; because of "import imap" in tests
374 ("python-fonttools" ,python2-fonttools)))
376 `(("freetype" ,freetype)))
377 (synopsis "Reimplementation of the SIL Graphite text processing engine")
379 "Graphite2 is a reimplementation of the SIL Graphite text processing
380 engine. Graphite is a smart font technology designed to facilitate the
381 process known as shaping. This process takes an input Unicode text string
382 and returns a sequence of positioned glyphids from the font.")
383 (license license:lgpl2.1+)
384 (home-page "https://github.com/silnrsi/graphite")))
386 (define-public potrace
393 (uri (string-append "mirror://sourceforge/potrace/potrace-"
397 "1bbyl7jgigawmwc8r14znv8lb6lrcxh8zpvynrl6s800dr4yp9as"))))
398 (build-system gnu-build-system)
399 (native-inputs `(("ghostscript" ,ghostscript))) ;for tests
400 (inputs `(("zlib" ,zlib)))
403 `("--with-libpotrace"))) ; install library and headers
404 (synopsis "Transform bitmaps into vector graphics")
406 "Potrace is a tool for tracing a bitmap, which means, transforming a
407 bitmap into a smooth, scalable image. The input is a bitmap (PBM, PGM, PPM,
408 or BMP format), and the default output is an encapsulated PostScript
409 file (EPS). A typical use is to create EPS files from scanned data, such as
410 company or university logos, handwritten notes, etc. The resulting image is
411 not \"jaggy\" like a bitmap, but smooth. It can then be rendered at any
413 (license license:gpl2+)
414 (home-page "http://potrace.sourceforge.net/")))
416 (define-public libotf
423 "mirror://savannah/releases/m17n/libotf-"
426 (base32 "0239zvfan56w7vrppriwy77fzb10ag9llaz15nsraps2a2x6di3v"))))
427 (build-system gnu-build-system)
429 `(("freetype" ,freetype)))
430 (home-page "http://www.nongnu.org/m17n/")
431 (synopsis "Library for handling OpenType Font")
432 (description "This library can read Open Type Layout Tables from an OTF
433 file. Currently these tables are supported; head, name, cmap, GDEF, GSUB, and
434 GPOS. It can convert a Unicode character sequence to a glyph code sequence by
435 using the above tables.")
436 (license license:lgpl2.0+)))
438 (define-public libspiro
445 (uri (string-append "mirror://sourceforge/libspiro/libspiro/"
446 version "/libspiro_src-" version ".tar.bz2"))
449 "1kylz8pvwnb85yya150r9i6mhbpzx38f32qy523qg3ylgd9b3zhy"))))
450 (build-system gnu-build-system)
451 (arguments `(#:tests? #f)) ;no tests
452 (synopsis "Clothoid to bezier conversion library")
454 "Raph Levien's Spiro package as a library. A mechanism for drawing
455 smooth contours with constant curvature at the spline joins.")
456 (license license:gpl2+)
457 (home-page "http://libspiro.sourceforge.net/")))
459 (define-public libuninameslist
461 (name "libuninameslist")
462 (version "0.5.20150701")
466 (uri (string-append "https://github.com/fontforge/libuninameslist/"
467 "archive/" version ".tar.gz"))
468 (file-name (string-append name "-" version ".tar.gz"))
471 "1j6147l100rppw7axlrkdx0p35fax6bz2zh1xgpg7a3b4pmqaj3v"))))
472 (build-system gnu-build-system)
473 (native-inputs `(("autoconf" ,autoconf)
474 ("automake" ,automake)
475 ("libtool" ,libtool)))
477 `(#:phases (alist-cons-after
480 (zero? (system* "autoreconf" "-vi")))
482 (synopsis "Unicode names and annotation list")
484 "LibUniNamesList holds www.unicode.org Nameslist.txt data which can be
485 useful for programs that need Unicode \"Names\", \"Annotations\", and block
487 (license license:gpl2)
488 (home-page "https://github.com/fontforge/libuninameslist")))
490 (define-public fontforge
497 "https://github.com/fontforge/fontforge/releases/download/"
498 version "/fontforge-dist-" version ".tar.gz"))
500 "1kavnhbkzc1hk6f39fynq9s0haama81ddrbld4b5x60d0dbaawvc"))
501 (modules '((guix build utils)))
504 ;; Make builds bit-reproducible by using fixed date strings.
505 (substitute* "configure"
506 (("^FONTFORGE_MODTIME=.*$")
507 "FONTFORGE_MODTIME=\"1459819518L\"\n")
508 (("^FONTFORGE_MODTIME_STR=.*$")
509 "FONTFORGE_MODTIME_STR=\"20:25 CDT 4-Apr-2016\"\n")
510 (("^FONTFORGE_VERSIONDATE=.*$")
511 "FONTFORGE_VERSIONDATE=\"20160404\"\n"))))
512 (patches (list (search-patch "fontforge-svg-modtime.patch")))))
513 (build-system gnu-build-system)
515 `(("pkg-config" ,pkg-config)))
516 (inputs `(("cairo" ,cairo)
517 ("fontconfig" ,fontconfig) ;dlopen'd
518 ("freetype" ,freetype)
519 ("gettext" ,gnu-gettext)
520 ("glib" ,glib) ;needed for pango detection
528 ("libspiro" ,libspiro)
530 ("libungif" ,libungif)
531 ("libuninameslist" ,libuninameslist)
541 (modify-phases %standard-phases
542 (add-after 'build 'build-contrib
543 (lambda* (#:key outputs #:allow-other-keys)
544 (let* ((out (assoc-ref outputs "out"))
545 (bin (string-append out "/bin")))
546 (and (zero? (system* "make" "-Ccontrib/fonttools"
548 (begin (install-file "contrib/fonttools/showttf" bin)
550 (add-after 'install 'set-library-path
551 (lambda* (#:key inputs outputs #:allow-other-keys)
552 (let ((out (assoc-ref outputs "out"))
553 (potrace (string-append (assoc-ref inputs "potrace") "/bin")))
554 (wrap-program (string-append out "/bin/fontforge")
555 ;; Fontforge dynamically opens libraries.
556 `("LD_LIBRARY_PATH" ":" prefix
557 ,(map (lambda (input)
558 (string-append (assoc-ref inputs input)
560 '("libtiff" "libjpeg" "libpng" "libungif"
561 "libxml2" "zlib" "libspiro" "freetype"
562 "pango" "cairo" "fontconfig")))
563 ;; Checks for potrace program at runtime
564 `("PATH" ":" prefix (,potrace)))))))))
565 (synopsis "Outline font editor")
567 "FontForge allows you to create and modify postscript, truetype and
568 opentype fonts. You can save fonts in many different outline formats, and
570 (license license:gpl3+)
571 (home-page "http://fontforge.org/")))