net-vips icon indicating copy to clipboard operation
net-vips copied to clipboard

Loading multiple font file with Image.Text does not load any fonts after the first one

Open Sreini opened this issue 2 years ago • 4 comments

I have encountered an issue where calling Image.Text sequentially with different fontfiles will not load any font file after the initial font is loaded.

Minimal repository illustrating the bug: https://github.com/Sreini/netvipsbug

Running the program as is will create 3 images. Image test3.png is going to be in the correct Kremlin 2 pro font. Images test2.png and test.png are going to be in a default font.

If you comment out the assigment and saving of test3.png you will notice test2.png now has the correct font but test.png has a default font again. If you now also comment out the creation and saving of test2.png, test.png will have the font its supposed to have.

This is not really expected behavior from my perspective. Intuitively this is some kind of bug, and I wonder if it can be fixed.

I am on windows 11. The rest of the versions are visible in the repository I linked.

Sreini avatar Jun 07 '22 20:06 Sreini

Confirmed, I just opened PR https://github.com/libvips/libvips/pull/2847 that fixes this. This will probably be available in libvips 8.13 (RSN).

kleisauke avatar Jun 08 '22 10:06 kleisauke

Thanks for the effort put into it. Is it known when the new libvips version is coming out?

Alternatively, is there a possibility of a backport to an older version?

Alternatively, is there some way I can force pango to clear the cache inside code? Id rather not build libvips myself as I want to use this in an azure function.

Sreini avatar Jun 08 '22 12:06 Sreini

Sorry, I missed your last questions.

Is it known when the new libvips version is coming out?

libvips 8.13.0 was released 4 days ago with this fix incorporated. I'll try to update NetVips.Native to 8.13.0 sometime today.

Alternatively, is there a possibility of a backport to an older version?

It will not be back-ported to the 8.12.x series.

Alternatively, is there some way I can force pango to clear the cache inside code?

AFAIK, this is not possible without recompiling libvips.

kleisauke avatar Jul 25 '22 11:07 kleisauke

NetVips v2.2.0 and NetVips.Native v8.13.0 is now available.

kleisauke avatar Jul 25 '22 13:07 kleisauke