PDF::AP...:CJKFont(3)

πŸ’– PDF::API2::Resource::CIDFont::CJKFont β€” the man page, but make it make sense πŸ’–

okay bestie, welcome to the PDF::API2::Resource::CIDFont::CJKFont(3) page ✨ (yes the header shortens it to PDF::AP...:CJKFont(3), she's shy, we don't talk about it). Sit down, grab a strawberry πŸ“, because this one is mostly a ✨ gentle intervention ✨.


🌸 NAME 🌸

PDF::API2::Resource::CIDFont::CJKFont β€” the deprecated base class for CJK fonts 🫢


πŸ¦‹ DESCRIPTION πŸ¦‹

ngl bestie, this is not the CJK font support you are looking for πŸ’€. This class dates alllll the way back to the days when Unicode was young and poorly supported, and the PDFs you make with it are not portable. it's giving legacy. it's giving "please don't".

Instead?? use a regular TrueType or OpenType font that includes Unicode support and just make your PDF normally, like the main character you are πŸ‘‘:

use PDF::API2;
use utf8;

my $pdf = PDF::API2->new();
my $font = $pdf->font('/path/to/font.ttf');
my $page = $pdf->page();
my $content = $page->text();
$content->font($font, 24);

# Chinese
$content->translate(72, 72 * 9);
$content->text('δ½ ε₯½');

# Japanese
$content->distance(0, -72);
$content->text('こんにけは');

# Korean
$content->distance(0, -72);
$content->text('μ•ˆλ…•ν•˜μ„Έμš”');

$pdf->save('hello.pdf');

look at her. multilingual. flawless. no deprecated nonsense. slay πŸ’…

Note: the maintainer is not familiar with CJK languages and deprecated this class based on his current understanding of Unicode and from reading many bug reports 😭. If you are successfully using the CJK support from this class and think it should not be deprecated, please contact him to discuss β€” he genuinely wants to hear it, no cap 🫢.

πŸ’€ DEPRECATED METHODS πŸ’€

  • $font = $class->new($pdf, $cjk_font_name, %options) β€” returns a CJK font object ✨. The requested font will not be embedded in the PDF, so it will only be readable on computers that have the font installed 🫠 (yes, that's the vibe, and yes, that's why portability is a whole thing).

Available fonts:

  • Chinese (Traditional)
    • Ming, Ming-Bold, Ming-Italic, and Ming-BoldItalic
  • Chinese (Simplified)
    • Song, Song-Bold, Song-Italic, and Song-BoldItalic
  • Korean
    • MyungJo, MyungJo-Bold, MyungJo-Italic, and MyungJo-BoldItalic
  • Japanese (Mincho Serif)
    • KozMin, KozMin-Bold, KozMin-Italic, and KozMin-BoldItalic
  • Japanese (Gothic Sans Serif)
    • KozGo, KozGo-Bold, KozGo-Italic, KozGo-BoldItalic

If the text isn't UTF-8, include an "-encode" option with the encoding to be used πŸŽ€.


and that's the whole page, bestie πŸ’– this one came to you from perl v5.42.0, dated 2025-09-01 β€” thanks for reading, go use a real Unicode font, ily, bye πŸ¦‹βœ¨

πŸ“¦ where this page comes from
  • fedora 43: perl-PDF-API2 2.048-1.fc43 Β· LGPL-2.1-or-later AND (GPL-1.0-or-later OR Artistic-1.0-Perl) AND (MIT OR Artistic-1.0-Perl)
  • πŸ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms