On Fri, 5 Sept 2025 at 04:04, cfr <[email protected]> wrote:
> thanks for looking at the luigi, but I'm a bit confused by your reply.
>
> As far as I can tell, the file look up succeeds for both the img Lua
> functions and the primitive commands.
>
> If the lua functions are used, the image is also found for inclusion in
> the pdf.
>
> But if the commands are used, the image is not found. That is,
>
> \saveimageresource{example-delwedd-a.pdf}
> \useimageresource\lastsavedimageresourceindex
>
> fails.
>
> Are you saying that the behaviour is not expected to be consistent between
> the lua functions and the primitives? And that they are not expected to
> behave as \pdfximage etc. did?
>
> The manual is not very specific about the correspondence, but it at least
> suggests consistency might be expected for the defunct versions:
>
>
hm from read_img:
void read_img(image_dict * idict)
{
char *filepath = NULL;
int callback_id;
if (img_filename(idict) == NULL) {
normal_error("pdf backend","image file name missing");
}
callback_id = callback_defined(find_image_file_callback);
if (img_filepath(idict) == NULL) {
if (callback_id > 0) {
/*tex We always callback, also for a mem stream. */
if (run_callback(callback_id, "S->S",
img_filename(idict),&filepath)) {
if (filepath && (strlen(filepath) > 0)) {
img_filepath(idict) = strdup(filepath);
}
}
}
if (img_filepath(idict) == NULL &&
(strstr(img_filename(idict),"data:application/pdf,") != NULL)) {
/*tex We need to check here for a pdf memstream. */
img_filepath(idict) = strdup(img_filename(idict));
} else if (callback_id == 0) {
/*tex Otherwise we use kpse but only when we don't callback. */
img_filepath(idict) = kpse_find_file(img_filename(idict),
kpse_tex_format, true);
}
if (img_filepath(idict) == NULL) {
/*tex In any case we need a name. */
formatted_error("pdf backend","cannot find image file '%s'",
img_filename(idict));
}
}
:
one can use a callback,
or prepend the value of the -output-directory from
status.list().output_directory or from
os.getenv('TEXMF_OUTPUT_DIRECTORY') to the filename ,
otherwise
/*tex Otherwise we use kpse but only when we don't callback. */
img_filepath(idict) = kpse_find_file(img_filename(idict),
kpse_tex_format, true);
i.e without first trying the output_directory.
If there is general consensus, I can change this behavior to be consistent
with pdftex.
--
luigi
_______________________________________________
dev-luatex mailing list -- [email protected]
To unsubscribe send an email to [email protected]