ssimms / pdfapi2

Create, modify, and examine PDF files in Perl
Other
15 stars 20 forks source link

Feature: Flexible font handling #46

Open sciurius opened 2 years ago

sciurius commented 2 years ago

With 2.042, it is possible to create a font using a single method, font, instead of having to choose the right method for built-in and TT fonts.

I like to suggest to carry this one step further. I would like to use a font name or filename everywhere currently a font object is required. For example, assuming $tc is a text content:

$tc->font( "Times-Roman", 12 );
$tc->text( "Hello, World!" );

A trivial cache suffices to reuse font objects.

In a later stadium, integration with fontconfig would allow state of the art font selection, e.g.

$tc->font( "Serif 14 bold" );

What do you think?