lorid

convert chordpro to pdf
git clone git://git.relim.de/lorid.git
Log | Files | Refs | README | LICENSE

commit ed7dcbe7bad163ef2dc76deb9cbd8f6e404a0bf4
parent b7780b26192cf95943aa85d736ea24af73197ab3
Author: nibo <nibo@relim.de>
Date:   Sun, 27 Oct 2024 18:04:22 +0100

WIP: new out_pdf engine

Diffstat:
Mlorid.c | 2+-
Mout_pdf.c | 8+++++++-
Mout_pdf.h | 29+++++++++++++++++++++++++++--
3 files changed, 35 insertions(+), 4 deletions(-)

diff --git a/lorid.c b/lorid.c @@ -70,7 +70,7 @@ main(int argc, char *argv[]) LOG_DEBUG("cho_songs_parse failed."); return 1; } - char *pdf_filename = out_pdf_new(argc == optind+1 ? argv[argc-1] : NULL, output ? output : NULL, songs, config); + char *pdf_filename = out_pdf_create(argc == optind+1 ? argv[argc-1] : NULL, output ? output : NULL, songs, config); if (!pdf_filename) { LOG_DEBUG("out_pdf_new failed."); return 1; diff --git a/out_pdf.c b/out_pdf.c @@ -1319,8 +1319,14 @@ out_pdf_page_create(pdfio_file_t *pdf, pdfio_array_t *annots, int page_no) return page_stream; } +/* static bool +pdf_content_create(struct PDFContent *out, struct ChoSong **songs, struct Config *config) +{ + return true; +} */ + char * -out_pdf_new(const char *cho_filepath, const char *output_folder_or_file, struct ChoSong **songs, struct Config *config) +out_pdf_create(const char *cho_filepath, const char *output_folder_or_file, struct ChoSong **songs, struct Config *config) { memset(&g_current_font_name, 0, sizeof(g_current_font_name)); char *pdf_filename = out_pdf_filename_create(songs, cho_filepath, output_folder_or_file); diff --git a/out_pdf.h b/out_pdf.h @@ -28,7 +28,7 @@ struct SpaceNeeded { double amount; }; -struct TextLineItem { +/* struct TextLineItem { char *text; struct Style *style; double x; @@ -49,6 +49,31 @@ struct TextLine { struct Text { struct TextLine **lines; +}; */ + +struct Image { + double x; + double y; + double width; + double height; + char *name; + pdfio_obj_t *obj; +}; + +struct Text { + char *text; + struct Style *style; + double x; + double y; +}; + +struct PDFPage { + struct Text **texts; + struct Image **images; +}; + +struct PDFContent { + struct PDFPage **pages; }; enum LineLocation { @@ -57,4 +82,4 @@ enum LineLocation { LL_UNDER }; -char *out_pdf_new(const char *cho_filename, const char *output_folder_or_file, struct ChoSong **songs, struct Config *config); +char *out_pdf_create(const char *cho_filename, const char *output_folder_or_file, struct ChoSong **songs, struct Config *config);