#!/usr/bin/perl

use PDF::API2;

$pdf=PDF::API2->new;

%opts=(
	'-widths' => [ 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 387, 383, 299, 769, 772, 798, 824, 154, 331, 331, 500, 833, 331, 330, 331, 277, 772, 772, 772, 772, 772, 772, 772, 772, 772, 772, 331, 331, 833, 833, 833, 662, 1000, 770, 793, 800, 847, 754, 670, 854, 879, 383, 666, 793, 683, 925, 869, 877, 743, 877, 801, 809, 625, 846, 681, 925, 717, 671, 682, 331, 277, 331, 1000, 500, 500, 645, 657, 644, 693, 607, 549, 691, 717, 291, 560, 620, 551, 767, 711, 714, 627, 714, 649, 663, 589, 688, 631, 789, 638, 592, 616, 500, 500, 500, 833, 600, 772, 600, 331, 772, 579, 1000, 500, 500, 500, 1160, 809, 331, 1104, 600, 682, 600, 600, 331, 331, 579, 579, 589, 500, 1000, 500, 833, 663, 331, 907, 600, 616, 671, 772, 383, 772, 772, 772, 772, 500, 500, 500, 833, 425, 562, 833, 330, 833, 500, 329, 833, 509, 509, 500, 562, 500, 331, 500, 509, 472, 562, 1141, 1141, 1141, 662, 770, 770, 770, 770, 770, 770, 1068, 800, 754, 754, 754, 754, 383, 383, 383, 383, 847, 869, 877, 877, 877, 877, 877, 833, 877, 846, 846, 846, 846, 671, 743, 1326, 645, 645, 645, 645, 645, 645, 897, 644, 607, 607, 607, 607, 291, 291, 291, 291, 693, 711, 714, 714, 714, 714, 714, 833, 714, 688, 688, 688, 688, 592, 627, 592 ],
	'-firstchar' => 1,
	'-descent' => -235,
	'-fontname' => 'BankGothicMediumBT',
	'-capheight' => 516,
	'-italicangle' => '0',
	'-flags' => 40,
	'-ascent' => 811,
	'-xheight' => 422,
	'-lastchar' => 255,
	'-type' => 'TrueType',
	'-altname' => 'BankGothicMdBT,Medium',
	'-fontbbox' => [ -166, -235, 1289, 811 ]
);


$f1=$pdf->corefont('Helvetica',1);

	$font=$pdf->xfont(%opts);
	
	$page = $pdf->page;
	$page->mediabox(595,842);
	$txt=$page->text;
	$txt->compress;
	$txt->translate(100,700);
	$txt->font($font,50);
	$txt->lead(50);
	$txt->text('Hello World !');
	$txt->cr;
	$txt->font($f1,20);
	$txt->text("This is font: BankGothicMediumBT ?");

	$txt->font($font,20);

	foreach $x (0..15) {
		foreach $y (0..15) {
			$txt->translate(50+(33*$x),50+(33*$y));
			$txt->text(chr($y*16+$x));
		}
	}

%opts=(
	'-widths' => [ 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 387, 383, 299, 769, 772, 798, 824, 154, 331, 331, 500, 833, 331, 330, 331, 277, 772, 772, 772, 772, 772, 772, 772, 772, 772, 772, 331, 331, 833, 833, 833, 662, 1000, 770, 793, 800, 847, 754, 670, 854, 879, 383, 666, 793, 683, 925, 869, 877, 743, 877, 801, 809, 625, 846, 681, 925, 717, 671, 682, 331, 277, 331, 1000, 500, 500, 645, 657, 644, 693, 607, 549, 691, 717, 291, 560, 620, 551, 767, 711, 714, 627, 714, 649, 663, 589, 688, 631, 789, 638, 592, 616, 500, 500, 500, 833, 600, 772, 600, 331, 772, 579, 1000, 500, 500, 500, 1160, 809, 331, 1104, 600, 682, 600, 600, 331, 331, 579, 579, 589, 500, 1000, 500, 833, 663, 331, 907, 600, 616, 671, 772, 383, 772, 772, 772, 772, 500, 500, 500, 833, 425, 562, 833, 330, 833, 500, 329, 833, 509, 509, 500, 562, 500, 331, 500, 509, 472, 562, 1141, 1141, 1141, 662, 770, 770, 770, 770, 770, 770, 1068, 800, 754, 754, 754, 754, 383, 383, 383, 383, 847, 869, 877, 877, 877, 877, 877, 833, 877, 846, 846, 846, 846, 671, 743, 1326, 645, 645, 645, 645, 645, 645, 897, 644, 607, 607, 607, 607, 291, 291, 291, 291, 693, 711, 714, 714, 714, 714, 714, 833, 714, 688, 688, 688, 688, 592, 627, 592 ],
	'-firstchar' => 1,
	'-descent' => -235,
	'-fontname' => 'BankGothicMediumBT,BoldItalic',
	'-capheight' => 516,
	'-italicangle' => '-11',
	'-flags' => 40,
	'-ascent' => 811,
	'-xheight' => 422,
	'-lastchar' => 255,
	'-type' => 'TrueType',
	'-altname' => 'BankGothicMdBT,Medium',
	'-fontbbox' => [ -166, -235, 1289, 811 ]
);


$f1=$pdf->corefont('Helvetica',1);

	$font=$pdf->xfont(%opts);
	
	$page = $pdf->page;
	$page->mediabox(595,842);
	$txt=$page->text;
	$txt->compress;
	$txt->translate(100,700);
	$txt->font($font,50);
	$txt->lead(50);
	$txt->text('Hello World !');
	$txt->cr;
	$txt->font($f1,20);
	$txt->text("This is font: BankGothicMediumBT ?");

	$txt->font($font,20);

	foreach $x (0..15) {
		foreach $y (0..15) {
			$txt->translate(50+(33*$x),50+(33*$y));
			$txt->text(chr($y*16+$x));
		}
	}

print " ----\n";

foreach $t (PDF::API2::xFont::listwinfonts()) {
	print "$t\n";

	$font=$pdf->ttfont($t,2);
	
	$page = $pdf->page;
	$page->mediabox(595,842);
	$txt=$page->text;
	## $txt->compress;
	$txt->translate(100,700);
	$txt->font($font,50);
	$txt->lead(50);
	$txt->text('Hello World !');
	$txt->cr;
	$txt->font($f1,10);
	$txt->text("This is font: $t ?");

	$txt->font($font,20);

	foreach $x (0..15) {
		foreach $y (0..15) {
			$txt->translate(50+(33*$x),50+(33*$y));
			$txt->text(chr($y*16+$x));
		}
	}
}

$pdf->saveas("$0.pdf");

exit;

__END__

