diff options
author | B. Watson <yalhcru@gmail.com> | 2020-06-26 14:22:10 +0100 |
---|---|---|
committer | Willy Sudiarto Raharjo <willysr@slackbuilds.org> | 2020-06-28 08:16:54 +0700 |
commit | fb65ac6ee013220bdab6d48ff9b9493955bf7650 (patch) | |
tree | a00171ad9e22d32f25ff4ef80e248f1577e01269 | |
parent | d48943afb0027332e26afecc418b20e92a526fc5 (diff) | |
download | slackbuilds-fb65ac6ee013220bdab6d48ff9b9493955bf7650.tar.gz |
system/bitmapfont2ttf: Added (convert BDF fonts to vector TTF)
Signed-off-by: Dave Woodfall <dave@slackbuilds.org>
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
-rw-r--r-- | system/bitmapfont2ttf/README | 17 | ||||
-rw-r--r-- | system/bitmapfont2ttf/bitmapfont2ttf.SlackBuild | 82 | ||||
-rw-r--r-- | system/bitmapfont2ttf/bitmapfont2ttf.info | 10 | ||||
-rw-r--r-- | system/bitmapfont2ttf/derive_pixel_size.diff | 13 | ||||
-rw-r--r-- | system/bitmapfont2ttf/slack-desc | 19 |
5 files changed, 141 insertions, 0 deletions
diff --git a/system/bitmapfont2ttf/README b/system/bitmapfont2ttf/README new file mode 100644 index 0000000000..1c9b9a50e0 --- /dev/null +++ b/system/bitmapfont2ttf/README @@ -0,0 +1,17 @@ +bitmapfont2ttf (convert bitmap BDF fonts to vector TTF) + +bitmapfont2ttf is a fontforge Python script which autotraces the glyphs +in a bitmap font and converts it to a vector (outline) TrueType font. +The resulting font retains its "pixelated" look when scaled up to any +size. + +bitmapfont2ttf is a bit picky about the BDF fonts it will accept as +input. This build includes a patch that allows it to work with fonts +produced by psf2bdf (from psftools). The patch is applied by default, +but you can export PRISTINE=yes in the environment if you really don't +want it. + +If you're trying to convert a PCF font, use pcf2bdf to turn it into a +BDF first. + +If you're looking for exact-autotrace, it's included in this build. diff --git a/system/bitmapfont2ttf/bitmapfont2ttf.SlackBuild b/system/bitmapfont2ttf/bitmapfont2ttf.SlackBuild new file mode 100644 index 0000000000..683b4abfce --- /dev/null +++ b/system/bitmapfont2ttf/bitmapfont2ttf.SlackBuild @@ -0,0 +1,82 @@ +#!/bin/sh + +# Slackware build script for bitmapfont2ttf + +# Written by B. Watson (yalhcru@gmail.com) + +# Licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/ for details. + +# The source tarball contains code from 3 git repositories: +# https://github.com/dse/bitmapfont2ttf +# https://github.com/dse/exact-autotrace +# https://github.com/wernsey/bitmap.git +# ...plus some minor fixes by me to get exact-autotrace to compile. + +PRGNAM=bitmapfont2ttf +VERSION=${VERSION:-20200215_03529d2} +BUILD=${BUILD:-1} +TAG=${TAG:-_SBo} + +if [ -z "$ARCH" ]; then + case "$( uname -m )" in + i?86) ARCH=i586 ;; + arm*) ARCH=arm ;; + *) ARCH=$( uname -m ) ;; + esac +fi + +CWD=$(pwd) +TMP=${TMP:-/tmp/SBo} +PKG=$TMP/package-$PRGNAM +OUTPUT=${OUTPUT:-/tmp} + +if [ "$ARCH" = "i586" ]; then + SLKCFLAGS="-O2 -march=i586 -mtune=i686" + LIBDIRSUFFIX="" +elif [ "$ARCH" = "i686" ]; then + SLKCFLAGS="-O2 -march=i686 -mtune=i686" + LIBDIRSUFFIX="" +elif [ "$ARCH" = "x86_64" ]; then + SLKCFLAGS="-O2 -fPIC" + LIBDIRSUFFIX="64" +else + SLKCFLAGS="-O2" + LIBDIRSUFFIX="" +fi + +set -e + +rm -rf $PKG +mkdir -p $TMP $PKG $OUTPUT +cd $TMP +rm -rf $PRGNAM-$VERSION +tar xvf $CWD/$PRGNAM-$VERSION.tar.xz +cd $PRGNAM-$VERSION +chown -R root:root . +find -L . -perm /111 -a \! -perm 755 -a -exec chmod 755 {} \+ -o \ + \! -perm /111 -a \! -perm 644 -a -exec chmod 644 {} \+ + +# 20200621 bkw: the fonts produced by some tools (notably psf2bdf) +# are missing the PIXEL_SIZE property. Patched code derives it from the +# ascent and descent properties, if necessary. This isn't always correct, +# but for the 670 fonts in /usr/share/fonts/misc (converted to BDF), +# it's correct for 654 (98%) of them. +if [ "${PRISTINE:-no}" != "yes" ]; then + patch -p1 < $CWD/derive_pixel_size.diff + PATCHDESC=" This package includes a patch for fonts without PIXEL_SIZE." +fi + +make -C exact-autotrace CFLAGS="$SLKCFLAGS" +strip exact-autotrace/bin/exact-autotrace-c +mkdir -p $PKG/usr/bin +install -m0755 exact-autotrace/bin/* bin/$PRGNAM $PKG/usr/bin + +mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION +cp -a README.md exact-autotrace/LICENSE $PKG/usr/doc/$PRGNAM-$VERSION +cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild + +mkdir -p $PKG/install +sed "16s/$/$PATCHDESC/" $CWD/slack-desc > $PKG/install/slack-desc + +cd $PKG +/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz} diff --git a/system/bitmapfont2ttf/bitmapfont2ttf.info b/system/bitmapfont2ttf/bitmapfont2ttf.info new file mode 100644 index 0000000000..194565ca53 --- /dev/null +++ b/system/bitmapfont2ttf/bitmapfont2ttf.info @@ -0,0 +1,10 @@ +PRGNAM="bitmapfont2ttf" +VERSION="20200215_03529d2" +HOMEPAGE="https://github.com/dse/bitmapfont2ttf" +DOWNLOAD="http://urchlay.naptime.net/~urchlay/src/bitmapfont2ttf-20200215_03529d2.tar.xz" +MD5SUM="5f4ab36a5d56c79e28ce38841f063bdc" +DOWNLOAD_x86_64="" +MD5SUM_x86_64="" +REQUIRES="" +MAINTAINER="B. Watson" +EMAIL="yalhcru@gmail.com" diff --git a/system/bitmapfont2ttf/derive_pixel_size.diff b/system/bitmapfont2ttf/derive_pixel_size.diff new file mode 100644 index 0000000000..60afe3242c --- /dev/null +++ b/system/bitmapfont2ttf/derive_pixel_size.diff @@ -0,0 +1,13 @@ +diff -Naur bitmapfont2ttf-20200215_03529d2/bin/bitmapfont2ttf bitmapfont2ttf-20200215_03529d2.patched/bin/bitmapfont2ttf +--- bitmapfont2ttf-20200215_03529d2/bin/bitmapfont2ttf 2020-06-08 17:30:53.000000000 -0400 ++++ bitmapfont2ttf-20200215_03529d2.patched/bin/bitmapfont2ttf 2020-06-21 04:06:26.622171278 -0400 +@@ -122,6 +122,9 @@ + continue + (cmd, args) = (args[0].upper(), args[1:]) + if cmd == 'ENDPROPERTIES': ++ if self.pixelSize == None: ++ self.pixelSize = int(self.ascent + self.descent) ++ sys.stderr.write('*** missing PIXEL_SIZE property, derived from FONT_ASCENT + FONT_DESCENT: %d\n' % self.pixelSize); + return + if cmd == 'PIXEL_SIZE' and len(args) >= 1: + self.pixelSize = float(args[0]) diff --git a/system/bitmapfont2ttf/slack-desc b/system/bitmapfont2ttf/slack-desc new file mode 100644 index 0000000000..dd948af0b8 --- /dev/null +++ b/system/bitmapfont2ttf/slack-desc @@ -0,0 +1,19 @@ +# HOW TO EDIT THIS FILE: +# The "handy ruler" below makes it easier to edit a package description. +# Line up the first '|' above the ':' following the base package name, and +# the '|' on the right side marks the last column you can put a character in. +# You must make exactly 11 lines for the formatting to be correct. It's also +# customary to leave one space after the ':' except on otherwise blank lines. + + |-----handy-ruler------------------------------------------------------| +bitmapfont2ttf: bitmapfont2ttf (convert bitmap BDF fonts to vector TTF) +bitmapfont2ttf: +bitmapfont2ttf: bitmapfont2ttf is a fontforge Python script which autotraces the +bitmapfont2ttf: glyphs in a bitmap font and converts it to a vector (outline) +bitmapfont2ttf: TrueType font. The resulting font retains its "pixelated" look +bitmapfont2ttf: when scaled up to any size. +bitmapfont2ttf: +bitmapfont2ttf: +bitmapfont2ttf: +bitmapfont2ttf: +bitmapfont2ttf: |