sidenote

Az előbb írtam egy rövid shell scriptet, ami nem csinál mást, mint egy könyvtáron belül (és annak az alkönyvtárain belül) levő fontokról a FontForge program fontimage appjával screenshotokat készít. Vagyis az összes betűtípusról egyszerűen és gyorsan lehet screenshotot csinálni.

Egyelőre csak a TrueType és az OpenType fontokról készít screenshotot, de gondolom a FontForge elboldogul mással is, a scriptben pedig csak egy regexpet kell átírni, hogy mást is támogasson. Hát nem csodás?! :) A forráskód alatti linken letölthető a cucc, de nyugodtan lehet kopipésztelni is.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/bin/bash

which fontimage > /dev/null

if [[ $? != 0 ]]
then
    echo "The fontimage program is needed to generate screenshots from fonts.
fontimage can be found either in the fontforge or in the fontforge-nox packages.
Or fontimage is not contained by your PATH enviroment variable."

    exit 1
fi

# fontscreenshot < directory >
function fontscreenshot()
{
   
    local DEFAULT_DIRECTORY="/usr/share/fonts/"
   
    local DIRECTORY=${1:-$DEFAULT_DIRECTORY}
   
    local FILE=""
   
    if [[ "$DIRECTORY" != */ ]]
    then
        DIRECTORY="${DIRECTORY}/"
    fi
   
    find "$DIRECTORY" -regex ".*\(otf\|ttf\)$" | while read FILE;
    do
        fontimage $FILE 2> /dev/null # error messages redirected to the void
    done
}

fontscreenshot $1

„Forráskód” targéza: fontscreenshot.

Konstruktív véleményeteket a hozzászólásoknál várom, és ha netán elrontottam volna valamit, akkor is toljatok egy kommentet, vagy bombázhattok emailekkel is (elérhetőség a Rólunk oldalon).

Megosztás, like stb.