in reply to Re: Ho to produce Unicode text with PDF::Report?
in thread Ho to produce Unicode text with PDF::Report?

Thank you. I was really hoping to take advantage of the ::Report's simplicity. I guess I'll have to learn the hard way to do it.
  • Comment on Re^2: Ho to produce Unicode text with PDF::Report?

Replies are listed 'Best First'.
Re^3: Ho to produce Unicode text with PDF::Report?
by AppleFritter (Vicar) on Jun 29, 2014 at 13:47 UTC

    You're welcome. Perhaps you could ask the author of PDF::Report to add support for using external (TTF) fonts? Another method like the following would likely be all that's needed:

    sub setTTFont { my ( $self, $fontfile, $size )= @_; if (exists $self->{__font_cache}->{$fontfile}) { $self->{font} = $self->{__font_cache}->{$fontfile}; } else { $self->{font} = $self->{pdf}->ttfont($fontfile); $self->{__font_cache}->{$fontfile} = $self->{font}; } $self->{fontname} = $fontfile; }

    In other words, pretty much exactly the same as ->setFont(), but calling ->ttfont() rather than ->corefont() on the underlying PDF::API2 object.

    (Notes - a) this'd go into PDF::Report, of course, not your script; b) completely untested; c) uses the same fontcache as ->setFont(), which may or may not be a good design choice; d) could be refactored to avoid code duplication (e.g. have this and ->setFont() call an internal helper routine).)