Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
use strict; use warnings; use utf8; use Imager; my $im = Imager -> new( xsize => 400, ysize => 200 ) -> box( filled => 1, color => 'white' ) -> to_paletted( make_colors => 'mono' ); my $text = 'JORDBÆR PÅ FLØDE (jordbær på fløde)'; my $y = 50; $im-> string( x => 50, y => $y += 25, string => $text, font => $_, color => 'black', size => 16 ) for map { Imager::Font-> new( file => $_, type => 'ft2' ) or die Imager-> errstr } ( 'unifont-10.0.06.ttf', 'ucs-fonts/6x9.bdf', 'ucs-fonts/6x12.bdf', 'ucs-fonts/8x13.bdf', ); $im-> write( file => 'test.png' );

Wikipedia says, the original Unifont was bitmapped font 16 px high. Looks like vectorized to TTF with pixels literally becoming squares (united to rectangles where possible). So rendering, without AA, to any size other than 16, 32, 48, ... will not likely be pretty, especially to smaller sizes (try changing size, above).

You can experiment with other TTF fonts and check if all required (now and in the future ;-) ) glyphs render w/o AA without ugly artifacts at chosen height. It's not totally impossible.

Maybe better go with bitmapped fonts. Note: these are monospaced, + different sizes differ in Unicode coverage. 'Size' parameter appears to be ignored by Imager. + Complex glyphs are also not very beautiful at small sizes.


In reply to Re: Tiny font by vr
in thread Tiny font by oha

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (7)
As of 2022-05-20 08:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you prefer to work remotely?



    Results (73 votes). Check out past polls.

    Notices?