Skip to content

Instantly share code, notes, and snippets.

@anekos
Created April 18, 2014 11:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anekos/11039092 to your computer and use it in GitHub Desktop.
Save anekos/11039092 to your computer and use it in GitHub Desktop.
フォントサンプルの HTML を出力する #Linux
#!/bin/bash
text="${1:-'ねこ 猫 ネコ cat CAT Cat 1234567890 + - * / λ'}"
font_size=20
OLD_IFS="$IFS"
cat <<-EOT
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<dl>
EOT
IFS='
'
for name in `fc-list | cut -d: -f2 | cut -d, -f 1 | sed 's/^ *//' | tr --delete '\\\\' | sort -u`
do
cat <<-EOT
<dt>$name</dt>
<dd><span style="font-family: '$name'; font-size: ${font_size}px">$text</span></dd>
EOT
done
cat <<-EOT
</dl>
</body>
</html>
EOT
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment