guix build: Add '--max-jobs' option.
[jackhill/guix/guix.git] / gnu / packages / fontutils.scm
index d3c10aa..a4da6df 100644 (file)
   #:use-module (gnu packages perl)
   #:use-module (gnu packages pkg-config)
   #:use-module (gnu packages autotools)
+  #:use-module (gnu packages gettext)
   #:use-module (gnu packages python)
+  #:use-module (gnu packages image)
+  #:use-module (gnu packages glib)
+  #:use-module (gnu packages xorg)
+  #:use-module (gnu packages gtk)
   #:use-module (gnu packages xml)
   #:use-module ((guix licenses) #:prefix license:)
   #:use-module (guix packages)
            (symlink (string-append include "/freetype2/freetype")
                     (string-append include "/freetype"))))
        %standard-phases)))
-   (synopsis "Freetype, a library to render fonts")
+   (synopsis "Font rendering library")
    (description
     "Freetype is a library that can be used by applications to access the
-contents of font files. It provides a uniform interface to access font files.
+contents of font files.  It provides a uniform interface to access font files.
 It supports both bitmap and scalable formats, including TrueType, OpenType,
-Type1, CID, CFF, Windows FON/FNT, X11 PCF, and others. It supports high-speed
+Type1, CID, CFF, Windows FON/FNT, X11 PCF, and others.  It supports high-speed
 anti-aliased glyph bitmap generation with 256 gray levels.")
    (license license:freetype)           ; some files have other licenses
    (home-page "http://www.freetype.org/")))
@@ -129,10 +134,10 @@ high quality, anti-aliased and subpixel rendered text on a display.")
 It is based on the code of the X11 rasteriser of the X11 project.
 
 The bitmaps created by t1lib are returned in a data structure with type
-GLYPH. This special GLYPH-type is also used in the X11 window system to
-describe character bitmaps. It contains the bitmap data as well as some
-metric information. But t1lib is in itself entirely independent of the
-X11-system or any other graphical user interface. ")
+GLYPH.  This special GLYPH-type is also used in the X11 window system to
+describe character bitmaps.  It contains the bitmap data as well as some
+metric information.  But t1lib is in itself entirely independent of the
+X11-system or any other graphical user interface.")
    (license license:gpl2)
    (home-page "http://www.t1lib.org/")))
 
@@ -151,13 +156,13 @@ X11-system or any other graphical user interface. ")
             (patches (list (search-patch "teckit-cstdio.patch")))))
    (build-system gnu-build-system)
    (inputs `(("zlib" ,zlib)))
-   (synopsis "TECkit, a toolkit for encoding conversions")
+   (synopsis "Toolkit for encoding conversions")
    (description
     "TECkit is a low-level toolkit intended to be used by other applications
 that need to perform encoding conversions (e.g., when importing legacy data
-into a Unicode-based application). The primary component of the TECkit
+into a Unicode-based application).  The primary component of the TECkit
 package is therefore a library that performs conversions; this is the
-\"TECkit engine\". The engine relies on mapping tables in a specific binary
+\"TECkit engine\".  The engine relies on mapping tables in a specific binary
 format (for which documentation is available); there is a compiler that
 creates such tables from a human-readable mapping description (a simple
 text file).
@@ -166,7 +171,7 @@ To facilitate the development and testing of mapping tables for TECkit,
 several applications are also included in the current package; these
 include simple tools for applying conversions to plain-text and Standard
 Format files, as well as both command-line and simple GUI versions of the
-TECkit compiler. However, it is not intended that these tools will be the
+TECkit compiler.  However, it is not intended that these tools will be the
 primary means by which end users perform conversions, and they have not
 been designed, tested, and debugged to the extent that general-purpose
 applications should be.")
@@ -191,7 +196,7 @@ applications should be.")
     `(("freetype" ,freetype)
       ("perl" ,perl)
       ("python" ,python-2))) ; because of "import imap" in tests
-   (synopsis "reimplementation of the SIL Graphite text processing engine")
+   (synopsis "Reimplementation of the SIL Graphite text processing engine")
    (description
     "Graphite2 is a reimplementation of the SIL Graphite text processing
 engine.  Graphite is a smart font technology designed to facilitate the
@@ -215,6 +220,9 @@ and returns a sequence of positioned glyphids from the font.")
     (build-system gnu-build-system)
     (native-inputs `(("ghostscript" ,ghostscript))) ;for tests
     (inputs `(("zlib" ,zlib)))
+    (arguments
+     `(#:configure-flags
+      `("--with-libpotrace"))) ; install library and headers
     (synopsis "Transform bitmaps into vector graphics")
     (description
      "Potrace is a tool for tracing a bitmap, which means, transforming a
@@ -257,6 +265,7 @@ smooth contours with constant curvature at the spline joins.")
        (method url-fetch)
        (uri (string-append "https://github.com/fontforge/libuninameslist/"
                            "archive/" version ".tar.gz"))
+       (file-name (string-append name "-" version ".tar.gz"))
        (sha256
         (base32
          "016zxffpc8iwpxxmnjkdirn6dsbcvdb2wjdrp123sf79f4nsynyj"))))
@@ -278,3 +287,79 @@ useful for programs that need Unicode \"Names\", \"Annotations\", and block
 definitions.")
     (license license:gpl2)
     (home-page "https://github.com/fontforge/libuninameslist")))
+
+(define-public fontforge
+  (package
+   (name "fontforge")
+   (version "20120731-b")               ;aka 1.0
+   (source (origin
+            (method url-fetch)
+            (uri (string-append "mirror://sourceforge/fontforge/fontforge_full-"
+                                version ".tar.bz2"))
+            (sha256 (base32
+                     "1dhg0i2pf76j40cb9g1wzpag21fgarpjaad0hdbk27i1zz588q8v"))))
+   (build-system gnu-build-system)
+   ;; TODO: Add python for scripting support.
+   (inputs `(("gettext"         ,gnu-gettext)
+             ("libtiff"         ,libtiff)
+             ("libjpeg"         ,libjpeg)
+             ("libpng"          ,libpng)
+             ("giflib"          ,giflib) ;needs giflib 4.*
+             ("libxml2"         ,libxml2)
+             ("libX11"          ,libx11)
+             ("libXi"           ,libxi)
+             ("libICE"          ,libice)
+             ("libSM"           ,libsm)
+             ("freetype"        ,freetype)
+             ("potrace"         ,potrace)
+             ("libspiro"        ,libspiro)
+             ("zlib"            ,zlib)
+             ("cairo"           ,cairo)
+             ("fontconfig"      ,fontconfig) ;dlopen'd
+             ("libuninameslist" ,libuninameslist)
+             ("pango"           ,pango)
+             ("glib"            ,glib))) ;needed for pango detection
+   (arguments
+    '(#:configure-flags `("--enable-double")
+      #:tests? #f
+      #:phases
+      (alist-cons-before
+       'configure 'patch-configure
+       (lambda* (#:key inputs #:allow-other-keys)
+         (let ((libxml2 (assoc-ref inputs "libxml2"))
+               (cairo   (assoc-ref inputs "cairo"))
+               (pango   (assoc-ref inputs "pango")))
+           (substitute* "configure"
+             ;; configure looks for a directory to be present to determine
+             ;; whether libxml2 is available, rather than checking for the
+             ;; library or headers.  Point it to the correct directory.
+             (("/usr/include/libxml2")
+              (string-append libxml2 "/include/libxml2"))
+             ;; Similary, the search directories for cairo and pango are
+             ;; hard-coded.
+             (("gww_prefix in.*") (string-append "gww_prefix in "
+                                                 cairo " " pango "\n")))))
+       (alist-cons-after
+        'install 'set-library-path
+        (lambda* (#:key inputs outputs #:allow-other-keys)
+          (let ((out (assoc-ref outputs "out"))
+                (potrace (string-append (assoc-ref inputs "potrace") "/bin")))
+            (wrap-program (string-append out "/bin/fontforge")
+                          ;; Fontforge dynamically opens libraries.
+                          `("LD_LIBRARY_PATH" ":" prefix
+                            ,(map (lambda (input)
+                                    (string-append (assoc-ref inputs input)
+                                                   "/lib"))
+                                  '("libtiff" "libjpeg" "libpng" "giflib"
+                                    "libxml2" "zlib" "libspiro" "freetype"
+                                    "pango" "cairo" "fontconfig")))
+                          ;; Checks for potrace program at runtime
+                          `("PATH" ":" prefix (,potrace)))))
+        %standard-phases))))
+   (synopsis "Outline font editor")
+   (description
+    "FontForge allows you to create and modify postscript, truetype and
+opentype fonts.  You can save fonts in many different outline formats, and
+generate bitmaps.")
+   (license license:bsd-3)
+   (home-page "http://fontforge.org/")))