http://www.perlmonks.org?node_id=1200243


in reply to Re: Tiny font
in thread Tiny font

Thanks you so much vr, Unifont requires a too big font size, i was hoping to stay between 8 to 12 pixels I found PixelOperator8.ttf as a very good compromise, so let me share my findings in case someone else need it:
use strict; use warnings; use utf8; use Imager; use Data::Dumper; my $img = Imager->new(xsize=>128, ysize=>8); my $small = Imager::Font->new(file => 'PixelOperator/PixelOperator8.tt +f') or die; $small->align(string => "Færevåg Øst", size => 8, x => 0, y => 0, valign => 'top', image => $img); for (my $y=0; $y<8; $y++) { for (my $x=0; $x<128; $x++) { my $col = $img->getpixel(x=>$x, y=>$y); print [$col->rgba()]->[0] ? "O" : " "; } print "\n"; }
OOOOO OOO OOO O + O O O O O + O O OOO OOO O OO OOO O O OOO OOOO O OO OOO + OOOO OOO O O O O O O O O O O O O O O O + O O OOOOOOOO OO OOOOO O O OOOO O O OO O OOO + O O O O O O O O O O OOOO O O O + O O OOO OOO O OOO O OOOO O O OOO OOOO + OOO OOO
It is a very limited subset of unicode, but good enough for my case and i can fall back to unifont with bigger size conditionally. HTH

Replies are listed 'Best First'.
Re^3: Tiny font
by vr (Curate) on Sep 28, 2017 at 15:23 UTC

    Thanks for sharing your results, oha. Author of "PixelOperator8.ttf" has clearly put some effort into his font, so that at 8 px height text looks as good as it possibly ever can, probably. (See some comparisons below.) I just hope these 8 px are not modern display pixels, but something larger.

    Your link is to outdated (and named differently) version, which produces "somewhat" inferior result. Here is better link.

    Below is "screenshot" (produced in a way similar to what you did:

    say $im-> getscanline( y => $_, type => 'index' ) =~ tr/\0\1/O /r for 0 .. $im-> getheight - 1;

    , for "paletted" image 80x60, similar to what I did :) ), for these test subjects:

    '10714/8bitOperatorPlus8-Regular.ttf', # Abomination from wrong link 'pixel_operator/PixelOperator8.ttf', # Correct version 'ucs-fonts/6x12.bdf', # 'Fixed', from my answer above + 'uw-ttyp0-1.3/genbdf/t0-12-uni.bdf', # http://people.mpi-inf.mpg.de/ +~uwe/misc/uw-ttyp0/ 'gohufont-2.1/gohufont-uni-11.pcf', # http://font.gohu.org/

      thank you so much vr, I didn't know about those other fonts and they look way better than the one I found, so great you found the time for this!