[NTG-context] text flowing around images
Henning Hraban Ramm
texml at fiee.net
Wed Feb 6 10:03:13 CET 2019
Am 2019-02-06 um 00:19 schrieb Aditya Mahajan <adityam at umich.edu>:
> On Tue, 5 Feb 2019, Wolfgang Schuster wrote:
>>>> Am 2019-02-04 um 11:10 schrieb Henning Hraban Ramm <texml at fiee.net>:
>>>>> in my current project I must include a bunch of illustrations in my
>> layout, and the text should flow around their irregular shapes (side placement in single text column only).
>>>>> I got the pictures as TIFFs with alpha channel, but of course I can
>> change that.
>>>>> I’m quite sure I remember that it was possible to let text flow around
>> shapes somehow, but I can’t find documentation or a sample.
>>>>> I’d be thankful for hints.
>> The metafun manual should have a few examples.
> See https://tex.stackexchange.com/a/32308/323 which is based on an example in the metafun manual.
Thank you all!
I guess I can reduce the flow cases to <10 and use \parshape directly; thinking in lines looks a bit easier than the MetaPost way.
Calculating the MP path from the TIFF alpha channel would be interesting, but is way above my head.
I guess it would work like:
- find the outer contour of the image (after some threshold value of color value or alpha channel)
- simplify and vectorize that (I remember there were different OS tools/libraries used with FontForge or Inkscape)
- convert this outline (SVG or EPS I guess) into MP
* within the ConTeXt run:
- place the (scaled) picture
- preliminary page/paragraph breaking to find where there might be overlaps
- calculate the fitting paragraph shape (rectangle minus overlapping part of the scaled outline)
- probably some new line/paragraph breaking?
GPG Key ID 1C9B22FD
More information about the ntg-context