libvips / php-vips-ext

Low-level libvips binding for PHP
MIT License
101 stars 11 forks source link

Calling `vips_call` Text with an `&` Errors #53

Closed panVag closed 2 years ago

panVag commented 2 years ago

Hello.

The following calls will return -1 for no apparent reason:

vips_call('text', null, '&');
vips_call('text', null, 'M&M');

Seems like the & breaks something.

jcupitt commented 2 years ago

Hi @panVag,

The string uses pango markup, so you need eg.: "M&M", just like HTML. See:

https://docs.gtk.org/Pango/pango_markup.html

But ... please don't use vips_call()! It's an internal API, it's never been documented or supported, and it's going away very soon. Please use php-vips instead.

https://github.com/libvips/php-vips

panVag commented 2 years ago

Hi @jcupitt and thanks for your prompt answer.

I do use php-vips, I just tracked the issue to vips_call that's why I though I should open an issue to this repo.

I managed to include ampersands using the HTML entity representation of the character, but it's funny it doesn't work for all HTML entities. For example,   will still throw an error.

jcupitt commented 2 years ago

Ah, OK, that's good.

The main API docs for vips_text() have some more information.

https://www.libvips.org/API/current/libvips-create.html#vips-text