Skip to content

Commit

Permalink
enable $(NL) in watermark text
Browse files Browse the repository at this point in the history
This permits multiline text in the 'simple-text', 'simple-text-shadow',
and 'fixed-size-text' standard watermarks.
  • Loading branch information
ralfbrown committed Apr 28, 2024
1 parent 5fa5735 commit 79f490c
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/common/variables.c
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,12 @@ static char *_get_base_value(dt_variables_params_t *params, char **variable)
else if(_has_prefix(variable, "EXIF.ISO") || _has_prefix(variable, "EXIF_ISO"))
result = g_strdup_printf("%d", params->data->exif_iso);
else if(_has_prefix(variable, "NL") && g_strcmp0(params->jobcode, "infos") == 0)
result = g_strdup_printf("\n");
{
if (params->use_html_newline)
result = g_strdup_printf("
");
else
result = g_strdup_printf("\n");
}
else if(_has_prefix(variable, "EXIF.EXPOSURE.BIAS")
|| _has_prefix(variable, "EXIF_EXPOSURE_BIAS"))
{
Expand Down Expand Up @@ -1300,6 +1305,7 @@ char *dt_variables_expand(dt_variables_params_t *params,

_cleanup_expansion(params);

fprintf(stderr,"varexp: %s\n",result);
return result;
}

Expand Down
3 changes: 3 additions & 0 deletions src/common/variables.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ typedef struct dt_variables_params_t
/** do we need to escape variables text for markup ? */
gboolean escape_markup;

/** do we need to use an HTML entity for new lines instead of a newline character? */
gboolean use_html_newline;

/** img cache already controlled */
void *img;

Expand Down
1 change: 1 addition & 0 deletions src/iop/watermark.c
Original file line number Diff line number Diff line change
Expand Up @@ -560,6 +560,7 @@ static gchar *_watermark_get_svgdoc(dt_iop_module_t *self, dt_iop_watermark_data
dt_image_full_path(image->id, image_path, sizeof(image_path), &from_cache);
params->filename = image_path;
params->jobcode = "infos";
params->use_html_newline = TRUE;
params->sequence = 0;
params->imgid = image->id;
dt_variables_set_tags_flags(params, flags);
Expand Down

0 comments on commit 79f490c

Please sign in to comment.