#!/usr/bin/perl -n # list codepoints that are in a font, based on list of codes # output format is suitable for codepoints="" in Wesnoth fonts.cfg #push @n, hex; chomp; push @n, $_; END { foreach (sort { $a <=> $b } @n) { if ($_ == $last + 1) { $last = $_; } else { push @r, ($first == $last) ? "$first" : "$first-$last"; $first = $last = $_; } } push @r, ($first == $last) ? "$first" : "$first-$last"; shift @r; # get rid of blank first element print join(",", @r), "\n"; }