lorid

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

commit c07e927f82f28e776e0ebe159a0669ce80839ac0
parent c1276b3a52cf3c46b6a6efcf7e8dead5bb721890
Author: nibo <nibo@relim.de>
Date:   Sat,  8 Mar 2025 20:04:21 +0100

Add {label*} directives and edit docs

Diffstat:
Mlorid_config.5 | 5+++++
Msrc/chordpro.c | 29+++++++++++++++++++++++++----
Msrc/config.c | 1+
3 files changed, 31 insertions(+), 4 deletions(-)

diff --git a/lorid_config.5 b/lorid_config.5 @@ -9,6 +9,11 @@ Run .RB ` lorid .BR --print-default-config ` for an example config. + +metadata_separator = String + +=> default value: "; " + .SS [notation_systems] In this section you can define custom notation systems beside the predefined notation systems which are: diff --git a/src/chordpro.c b/src/chordpro.c @@ -63,6 +63,9 @@ struct StyleProperty default_style_properties[] = { { TT_TOC, SPT_FONT, { .font_name = NULL } }, { TT_TOC, SPT_SIZE, { .font_size = EMPTY_DOUBLE } }, { TT_TOC, SPT_COLOR, { .foreground_color = NULL } }, + { TT_LABEL, SPT_FONT, { .font_name = NULL } }, + { TT_LABEL, SPT_SIZE, { .font_size = EMPTY_DOUBLE } }, + { TT_LABEL, SPT_COLOR, { .foreground_color = NULL } }, }; static const char *chord_extensions_major[] = { @@ -4400,21 +4403,36 @@ cho_directive_parse(struct ChoContext *ctx, const char *name) directive->dtype = DT_FONT; directive->sprop = SPT_FONT; directive->ttype = TT_TOC; + return directive; } else if (!strcmp(name, "tocsize")) { directive->dtype = DT_FONT; directive->sprop = SPT_SIZE; directive->ttype = TT_TOC; + return directive; } else if (!strcmp(name, "toccolour")) { directive->dtype = DT_FONT; directive->sprop = SPT_COLOR; directive->ttype = TT_TOC; - } /* else if (!strcmp(name, "footerfont")) { + return directive; + /* } else if (!strcmp(name, "footerfont")) { } else if (!strcmp(name, "footersize")) { - } else if (!strcmp(name, "footercolour")) { + } else if (!strcmp(name, "footercolour")) { */ } else if (!strcmp(name, "labelfont")) { + directive->dtype = DT_FONT; + directive->sprop = SPT_FONT; + directive->ttype = TT_LABEL; + return directive; } else if (!strcmp(name, "labelsize")) { + directive->dtype = DT_FONT; + directive->sprop = SPT_SIZE; + directive->ttype = TT_LABEL; + return directive; } else if (!strcmp(name, "labelcolour")) { - } */ + directive->dtype = DT_FONT; + directive->sprop = SPT_COLOR; + directive->ttype = TT_LABEL; + return directive; + } if (!strcmp(name, "transpose")) { directive->dtype = DT_CHORD; directive->ctype = TRANSPOSE; @@ -5091,7 +5109,10 @@ cho_songs_parse(const char *str, const char *chordpro_filepath, struct Config *c } else { ctx.songs[ctx.so]->sections[ctx.se]->label->text = strdup(stripped_directive_value); } - ctx.songs[ctx.so]->sections[ctx.se]->label->style = cho_style_new_from_config(&ctx, TT_LABEL); + ctx.prev_ttype = ctx.current_ttype; + ctx.current_ttype = TT_LABEL; + ctx.songs[ctx.so]->sections[ctx.se]->label->style = cho_style_new_default(&ctx); + ctx.current_ttype = ctx.prev_ttype; if (ctx.directive_has_tag) { cho_style_complement(ctx.songs[ctx.so]->sections[ctx.se]->label->style, ctx.tags[ctx.ta]->style, &ctx.tags[ctx.ta]->style_presence); ctx.directive_has_tag = false; diff --git a/src/config.c b/src/config.c @@ -476,6 +476,7 @@ config_load_default(void) config->output->styles[TT_CHORUS] = cho_style_new(); config->output->styles[TT_CHORUS]->font->name = strdup(DEFAULT_FONT); config->output->styles[TT_FOOTER] = cho_style_new(); + config->output->styles[TT_FOOTER]->font->name = strdup(DEFAULT_FONT); config->output->styles[TT_GRID] = cho_style_new(); config->output->styles[TT_GRID]->font->name = strdup(DEFAULT_FONT); config->output->styles[TT_GRID]->font->weight = FW_BOLD;