lorid

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

commit ea4d96baba83bed3e67d7e64837d52d64f4b6153
parent e69184c0f06e72039dd8a3ca32b0e105479d3019
Author: nibo <nibo@relim.de>
Date:   Wed, 25 Dec 2024 11:44:27 +0100

Clean some toc related things

Diffstat:
Mconfig.c | 2+-
Mout_pdf.c | 19++++++++++++-------
2 files changed, 13 insertions(+), 8 deletions(-)

diff --git a/config.c b/config.c @@ -35,7 +35,7 @@ static const char *g_valid_styles[] = { "comment_boxed", "tab", "label", - "toc", // TODO + "toc", "grid", "grid_margin", // TODO "empty", // TODO diff --git a/out_pdf.c b/out_pdf.c @@ -1568,16 +1568,13 @@ pdf_toc_page_count( double max_title_width ) { - int text = 0; int page = 0; - double x = MARGIN_HORIZONTAL; double y = MEDIABOX_HEIGHT - MARGIN_TOP; double width; struct TocEntry **toc; toc = entries; while (*toc) { if (y < MARGIN_BOTTOM) { - text = 0; y = MEDIABOX_HEIGHT - MARGIN_TOP; page++; } @@ -1631,7 +1628,8 @@ pdf_texts_add_toc_entry( double width, page_no_x; int index, line_count; char tmp[strlen(entry->title)+1]; - char page_no[5+1]; + // char page_no[5+1]; + char page_no[11+1]; strcpy((char *)&tmp, entry->title); width = text_width(entry->title, style); if (width == ERROR) { @@ -1721,11 +1719,10 @@ static bool pdf_toc_create( struct PDFContent **toc_content, struct PDFContent *pdf_content, - struct ChoSong **songs, struct Config *config ) { - double width, space_for_dots, max_title_width; + double max_title_width; int toc_page_count; struct PDFContext ctx; struct PDFText ***texts; @@ -1746,6 +1743,14 @@ pdf_toc_create( LOG_DEBUG("pdf_toc_page_count failed."); return false; } + /* struct ChoStyle *toc_title_style = cho_style_copy(toc_style->style); + toc_title_style->font->size = 18.0; + // toc_title_style->font->weight = FW_BOLD; + if (!pdf_texts_add_text(&ctx, config->output->toc->title, toc_title_style, A_CENTER)) { + LOG_DEBUG("pdf_texts_add_text failed."); + return false; + } + cho_style_free(toc_title_style); */ while (*toc) { if (!pdf_texts_add_toc_entry(&ctx, *toc, toc_style->style, max_title_width, toc_page_count)) { LOG_DEBUG("pdf_texts_add_toc_entry failed."); @@ -2320,7 +2325,7 @@ out_pdf_create( return NULL; } if (config->output->toc->show) { - if (!pdf_toc_create(&toc_content, pdf_content, songs, config)) { + if (!pdf_toc_create(&toc_content, pdf_content, config)) { LOG_DEBUG("pdf_toc_create failed."); return false; }