chrissimpkins / codeface

Typefaces for source code beautification
Other
6.21k stars 414 forks source link

Create diffs vs. origin typefaces with Chris Wendt's script #77

Open chrissimpkins opened 9 years ago

chrissimpkins commented 9 years ago

Script by @chrismwendt located at https://github.com/chrismwendt/bront/blob/89785af894459275c571815dd0e352d0b892e712/render.sh

input="sample.txt"
size=100
declare -a bases=("UbuntuMono" "DejaVuSansMono")

for base in "${bases[@]}"
do
   echo "Rendering $input using $base..."

   convert +antialias -density 228 -fill red -font $base.ttf -pointsize $size label:@$input $base.png
   convert +antialias -density 228 -fill green -font $base-Bront.ttf -pointsize $size label:@$input $base-Bront.png
   convert $base-Bront.png $base.png -compose multiply -composite $base-comparison-large.png
   convert -resize 25% $base-comparison-large.png $base-comparison.png
   rm $base.png $base-Bront.png $base-comparison-large.png

   echo "Rendered $input to $base-comparison.png"
done

ImageMagick docs: http://www.imagemagick.org/script/convert.php

linjer commented 9 years ago

Hey, I was going to check in on your overall progress and I saw this issue, so I wanted to point out the Google fonts repo has something that does a good job at this in the tools folder.

https://github.com/google/fonts

chrismwendt commented 9 years ago

Are you referring to https://github.com/google/fonts/blob/master/tools/compare_font.py? Correct me if I'm wrong, but that script compares things like sizes of glyphs and supported subsets, and doesn't render any images.

The script in this issue renders image diffs like https://camo.githubusercontent.com/a1621cf63d7e06d5843e3b0704d85cbe4f4a96c4/687474703a2f2f692e696d6775722e636f6d2f555143376144512e706e67.

linjer commented 9 years ago

Right. I don't mean to reference that tool as a competing item, but something you may draw from.

chrissimpkins commented 9 years ago

Thanks for the suggestion Jerry. I will check out the Google fonts repo to see what they have.