Start working on Remind -> PDF converter using Pango and Cairo

This commit is contained in:
Dianne Skoll
2022-01-26 16:38:49 -05:00
parent a1d884ec3f
commit 7290bccfd7
6 changed files with 97 additions and 2 deletions

6
.gitignore vendored
View File

@@ -15,3 +15,9 @@ src/remind
src/version.h
tests/test.out
www/Makefile
rem2pdf/Makefile.PL
MYMETA.json
MYMETA.yml
Makefile
blib/
pm_to_blib

3
configure vendored
View File

@@ -4005,7 +4005,7 @@ done
VERSION=03.03.12
ac_config_files="$ac_config_files src/Makefile www/Makefile src/version.h rem2html/Makefile"
ac_config_files="$ac_config_files src/Makefile www/Makefile src/version.h rem2html/Makefile rem2pdf/Makefile.PL"
cat >confcache <<\_ACEOF
# This file is a shell script that caches the results of configure
@@ -4702,6 +4702,7 @@ do
"www/Makefile") CONFIG_FILES="$CONFIG_FILES www/Makefile" ;;
"src/version.h") CONFIG_FILES="$CONFIG_FILES src/version.h" ;;
"rem2html/Makefile") CONFIG_FILES="$CONFIG_FILES rem2html/Makefile" ;;
"rem2pdf/Makefile.PL") CONFIG_FILES="$CONFIG_FILES rem2pdf/Makefile.PL" ;;
*) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
esac

View File

@@ -49,4 +49,4 @@ AC_CHECK_FUNCS(setenv unsetenv glob mbstowcs setlocale initgroups)
VERSION=03.03.12
AC_SUBST(VERSION)
AC_SUBST(PERL)
AC_OUTPUT(src/Makefile www/Makefile src/version.h rem2html/Makefile)
AC_OUTPUT(src/Makefile www/Makefile src/version.h rem2html/Makefile rem2pdf/Makefile.PL)

12
rem2pdf/Makefile.PL.in Normal file
View File

@@ -0,0 +1,12 @@
use ExtUtils::MakeMaker;
WriteMakefile(
NAME => 'Remind::PDF',
AUTHOR => q{Dianne Skoll <dianne@skoll.ca>},
VERSION => '@VERSION@',
PREREQ_PM => {
'Getopt::Long' => 0,
'Cairo' => 0,
'Pango' => 0,
},
EXE_FILES => [ 'bin/rem2pdf' ]
);

76
rem2pdf/bin/rem2pdf Executable file
View File

@@ -0,0 +1,76 @@
#!/bin/env perl
use strict;
use warnings;
use Encode;
use Cairo;
use Pango;
use Getopt::Long;
my $media_to_size = {
"Letter" => [ 612, 792],
"Tabloid" => [ 792, 1224],
"Ledger" => [1224, 792],
"Legal" => [ 612, 1008],
"Statement" => [ 396, 612],
"Executive" => [ 540, 720],
"A3" => [ 842, 1190],
"A4" => [ 595, 842],
"A5" => [ 420, 595],
"B4" => [ 729, 1032],
"B5" => [ 519, 729],
"Folio" => [ 612, 936],
"Quarto" => [ 612, 780],
"10x14" => [ 720, 1008],
};
my $landscape = 0;
my $numbers_on_left = 0;
my $small_calendars = 0;
my $fill_entire_page = 0;
my $media = 'Letter';
my $title_font = 'Sans 14';
my $small_cal_font = 'Sans';
my $header_font = 'Sans 14';
my $entry_font = 'Sans 8';
my $daynum_font = 'Sans Bold Oblique 14';
my $border_size = 6;
my $line_thickness = 1;
my $margin_top = 36;
my $margin_bottom = 36;
my $margin_left = 36;
my $margin_right = 36;
sub read_one_month
{
}
__END__
my $surface = Cairo::PdfSurface->create('/tmp/x.pdf', 612, 792);
my $cr = Cairo::Context->create($surface);
$cr->set_line_width($line_thickness);
for (my $x=36; $x < 612-36; $x += 72) {
$cr->move_to($x, 0);
$cr->line_to($x, 792);
$cr->stroke;
}
$cr->set_source_rgb(0,0.5,0);
$cr->arc(612/2, 792/2, 36, 0, 2*3.1415926535);
$cr->stroke_preserve;
$cr->fill;
$cr->move_to(612/2, 792/2);
$cr->set_source_rgb(0,0,0);
$cr->set_font_size(36);
$cr->show_text(Encode::decode('UTF-8', "מֵם סוֹפִיתçédo"));
$surface->finish();

View File