Commit Graph

130 Commits

Author SHA1 Message Date
John Cupitt d21ee5aa2b remove double space 2021-07-19 07:51:44 +01:00
John Cupitt 2cebec9a80 stop text output getting too large
see https://github.com/libvips/libvips/issues/2300
2021-07-18 18:53:47 +01:00
John Cupitt 757d031005 always check the return of vips_image_pipeline()
For consistency. Although I don't think it can meaningfully fail.
2021-06-29 16:12:17 +01:00
John Cupitt 98d35dda28 vips_text() was missing a couple of unlocks 2021-05-25 14:07:28 +01:00
John Cupitt ee2255da00 only warn if fontfile load fails
since it can fail for things like adding the same font twice from
different files

thanks molfar

see https://github.com/libvips/libvips/issues/2220
2021-04-22 15:27:18 +01:00
Kleis Auke Wolthuizen 4af8b9b265 Add fontconfig as dependency
pangocairo does not list fontconfig as a dependency.
2021-04-21 14:20:51 +02:00
John Cupitt 31fe274626 fix mono rendering
always render RGBA, then in mono mode just use the alpha
2021-04-12 17:29:54 +01:00
John Cupitt 985a3e2282 reenable fontfile 2021-04-12 15:46:56 +01:00
John Cupitt f53959b824 switch font rendering to pangocairo
to make colour font rendering work
2021-04-12 15:11:18 +01:00
John Cupitt 8412b8233c start adding colour text rendering
try eg.

	vips text x.png 😀 --rgba --dpi 300

But it's not working :( need to tyweak something else?
2021-04-12 10:59:50 +01:00
John Cupitt 2772ecbb9e add "seed" param to perlin, worley and gaussnoise
see https://github.com/libvips/libvips/issues/1884
2020-11-16 09:14:06 +00:00
Kleis Auke Wolthuizen 6155b6d093 Fix test failure on ARM-based Windows
The optional parameters of vips_gaussnoise were incorrectly
passed within vips_fractsurf. This was discovered when running
the libvips testsuite on Windows 10 IoT (ARM32).
2020-09-25 12:52:31 +02:00
John Cupitt 285ab2e6cc better mask sizing for gaussmat
We were calculating the mask size incorrectly for small masks.

Thanks johntrunc

see https://github.com/libvips/libvips/issues/1793
2020-08-31 13:37:08 +01:00
John Cupitt e7988f88ac move matrixinvert init to mosaicing
and regen potfiles
2020-06-28 14:01:43 +01:00
John Cupitt 5540fa97f4 small cleanups for disable deprecated
- move matrixinvert to mosaicing, fix a leak
- add note to changelog
- small fixes

see https://github.com/libvips/libvips/pull/1593
2020-06-28 12:14:13 +01:00
Kleis Auke Wolthuizen 45f9999e7e Add vips_matrixinvert for inverting matrices
From im_matinv
2020-06-18 14:34:43 +02:00
John Cupitt 951540f4fe revise text docs
To clarify the meaning of VipsAlign in this context.

See https://github.com/libvips/libvips/issues/1654#issuecomment-629671463
2020-05-16 17:57:31 +01:00
John Cupitt 63649629e0 fix doc error
Hopefully clearer, see https://github.com/libvips/libvips/issues/1654
2020-05-16 12:37:20 +01:00
John Cupitt 9cdbf3ee07 don't add fontfiles repeatedly in text
It seems fontconfig will let you add a file repeatedly. This patch adds a
table which is used to block repeated additions and prevents memory growth
and slowdown.

see https://github.com/libvips/libvips/issues/1655
2020-05-16 12:28:12 +01:00
John Cupitt c84a43f277 fix memleak in vips_text()
We were not unreffing PangoLayout. Thank you uint128!

See https://github.com/libvips/libvips/issues/1508
2019-12-21 12:56:09 +00:00
John Cupitt a50405c1f7 fix some run-time errors from clang
Travis is now running with some amount of run-time checking enabled and
it spotted a couple of harmless things.
2019-12-05 14:14:27 +00:00
John Cupitt f01023e222 fix a compiler warning
gcc could warn (incorrectly) about used before set in text.c
2019-09-17 13:32:37 +01:00
John Cupitt 01a92679b5 oop left some DEBUG turned on 2019-06-27 17:34:07 +01:00
John Cupitt 80648c2d2f text autofit could sometimes underfit
The autofit loop would terminate if either width or height fitted exactly,
but this could happen very early by chance. This patch makes it keep
looping until it finds a dpi which just fits.

See https://github.com/libvips/libvips/issues/1352
2019-06-27 17:19:53 +01:00
John Cupitt da15285bf9 add support for justified text
And set xoffset/yoffset to the top line of text output.

https://github.com/libvips/libvips/issues/1258
2019-03-16 11:53:09 +00:00
John Cupitt 65a259a025 prevent /0 in freq mask for very small masks
see https://github.com/libvips/libvips/issues/1236
2019-02-20 15:15:50 +00:00
John Cupitt 2fb81b8ed6 prevent /0 in eye for width/height 1
see https://github.com/libvips/libvips/issues/1236
2019-02-20 15:00:00 +00:00
John Cupitt 2835948070 fix typo in docs 2019-01-25 05:04:24 +00:00
John Cupitt 0d5eced964 break on dpi too high as well 2018-12-07 13:09:22 +00:00
John Cupitt da31d0f31a fix autofit loop on non-scaleable fonts
see https://github.com/libvips/libvips/issues/1178
2018-12-07 12:57:44 +00:00
John Cupitt ac4897abee Fix up vips_text()
Fixes two issues:

1. vips_text() in autofit mode could set the wrong DPI, since it set the
DPI in its own copy of the variable, but did not do a final update on
the DPI setting that FT uses for rendering.

2. vips_text() in autofit mode allocated a new context each time, rather
than reusing the context for that call. This caused a small memory leak.

See https://github.com/libvips/libvips/issues/1174
2018-12-05 14:24:26 +00:00
Angel Sánchez 256cf494a3 use VIPS_PI instead of M_PI as the former is already defined, added missing includes with their macro protection 2018-05-31 13:50:50 +02:00
John Cupitt 4d683559aa add a fontfile option to text
use @fontfile to give a font to load ... note that this just loads the
font, you'll need to set it with @font as well

see https://github.com/jcupitt/libvips/issues/950
2018-04-26 21:03:40 +01:00
John Cupitt aebb8af803 create funcs always make MULTIBAND
Before, they could make B_W for one-band output. This caused problems
with (for example) two black image bandjoined: the second band then
looked like an alpha to hasalpha() and enabled premultiply/unpremultiply
for operations like affine.

Now, it's always MULTIBAND. This is the generic multiband image type, so
you don't get any unexpected alpha handling.
2018-04-04 09:22:57 +01:00
John Cupitt 754a1e5419 Merge branch 'master' into add-canny 2018-03-14 14:18:39 +00:00
John Cupitt 878c77a035 better handling of some fonts
fonts with very large overlapping edges copuld clip in `text`, see
https://stackoverflow.com/a/49169747/894763
2018-03-12 18:11:25 +00:00
John Cupitt 4a59fa652c make vips_sobel()
cut out of vips_canny()
2018-02-26 18:33:20 +00:00
John Cupitt bc6fa2452b layout tweak 2017-12-07 08:00:19 +00:00
Lovell Fuller f0949fbfcb Allow -DDEBUG build to compile 2017-12-06 22:04:11 +00:00
John Cupitt f9f717a843 add VIPS_ONCE and use it everywhere
Lovell's idea: save the function call in the most common case
2017-11-23 08:43:08 +00:00
John Cupitt 99f02aeff1 allow approx gaussmat
works with gaussblur now
2017-10-16 17:10:16 +01:00
John Cupitt 9e0ff87dd5 add docs for autofit_dpi 2017-10-10 13:10:17 +01:00
John Cupitt 40f20e5e0a Merge branch 'master' into gargsms-text-autofit 2017-10-10 13:04:31 +01:00
Alistair Thomas 103452c3ee Correct typo in comment for out parameter of inverlut() and remove some trailing whitespace 2017-10-02 21:28:46 +01:00
Alistair Thomas 0563330b43 Update GObject introspection annotations for libvips/create directory 2017-09-30 20:47:39 +01:00
John Cupitt 393e2cd766 typo 2017-09-21 10:58:30 +01:00
John Cupitt 18d25cfa08 add autofit_dpi output property 2017-09-21 10:46:17 +01:00
John Cupitt 809f523274 text autosize could overflow 2017-09-21 10:39:37 +01:00
John Cupitt 64be1d89b5 add gravity 2017-09-20 00:43:17 +01:00
John Cupitt e07a1d83fb fix up autofit again
A bit cleaner and simpler now, stops earlier if it can.

I experimented with other ways of picking the next guess, but none were
significantly better than picking the half-way point. The problem is
that autosize can be very non-linear. Line breaks appear and disappear
as you adjust DPI and it's possible to construct cases where it never
tries the correct solution.
2017-09-19 23:02:26 +01:00