SliTaz SliTaz Forum

#1 2012-05-06 22:40:32

babaorum
Moderator
Inscrit(e): 2011-03-29
Messages: 109

Font viewer

Busybox shell script:

#!/bin/sh
SCRIPT=${0##*/}
DIR='/usr/share/fonts'
OUTFILE=$HOME/fontview.html
cat <<EOT -- >$OUTFILE
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="content-type" value="text/html" />
        <charset="UTF-8" />
        <style type="text/css">
            div {
                border-bottom: 1px dotted silver;
            }
            div > span:nth-child(1) {
                display: inline-block;
                width: 15em;
            }
        </style>
    </head>
    <body>
        <div></div>
EOT
OIFS=$IFS
IFS=$'\n'
fc-list | cut -d: -f1 | sort | uniq | while read font; do
    echo -e "\t\t<div><span>$font</span><span style=\"font-family: $font\">$font</span></div>\n" >>$OUTFILE
done
IFS=$OIFS
cat <<EOT -- >>$OUTFILE
    </body>
</html>
EOT
browser file://$OUTFILE
echo "Output file is: $OUTFILE"

Hors ligne

#2 2012-05-06 23:26:19

lexeii
Administrator
Inscrit(e): 2012-03-21
Messages: 1 853

Re: Font viewer

Brilliant solution! Thank you

Hors ligne

#3 2012-11-04 17:46:35

lexeii
Administrator
Inscrit(e): 2012-03-21
Messages: 1 853

Re: Font viewer

Make text file, save it with name inf_fonts.desktop to folder ~/.local/share/applications (note this folder is hidden):

[c][Desktop Entry]
Version=1.0
Type=Application
Name=‪Font testing page
Comment=Infinality Project's Font testing page
Exec=tazweb http://www.infinality.net/files/font.html
TryExec=tazweb
Icon=fonts
Categories=Utility;[/c]
Now click: favicon.icoMenu → Utility → Font testing page

You can choose between your installed fonts & various sizes & different unicode pages.

Note: Font list is generated by little (1 KB) SWF applet, if you haven't Flash plugin, you need to input font family names manually (tested with SliTaz Rolling).

Hors ligne

#4 2012-11-04 20:13:32

totoetsasoeur
Moderator
Inscrit(e): 2011-03-29
Messages: 247

Re: Font viewer

Great idea!

Thx for sharing.

:-)

Hors ligne

Utilisateurs enregistrés en ligne dans ce sujet: 0, Invité(s): 1
[Bot] ClaudeBot

Pied de page

Propulsé par FluxBB
Modifié par Visman Traduit par N-Studio18

[ Généré en 0.016 secondes, 7 requêtes exécutées - Utilisation de la mémoire: 1.53 MiO (Pic : 1.77 MiO) ]