Drawing an arbitrary shaded shape with pic

2024-09-12 Thread Philippe PITTOLI via
Hello,

I've been trying to do something as simple as drawing a triangle
filled with some color with gpic and so far I spectacularly failed.

I don't see any way to draw an arbitrary (shaded) polygon with gpic,
but it's do-able with groff directly: \D'P x1 y1 x2 y2'. So, I did
a groff macro… that I called from a pic macro.

.de triangle
\D'P \\$1 \\$2 \\$3 \\$4'
..

.PS 7 9
define triangle {
.gcolor $1
.fcolor $1
command ".triangle " $2 " " $3 " " $4 " " $5
.gcolor
.fcolor
}

x1 = 3
y1 = 3
x2 = -6
y2 = 0

triangle(green, x1, y1, x2, y2)
triangle(red,   x1, y1, x2, y2)
triangle(pink,  x1, y1, x2, y2)
.PE

It works great, but now I don't know how to position my triangles.
Is there a simple way to do it?

My next attempt will be to pass the position of where I want to
start drawing from pic to groff, passing the values to the "command"
instruction… but it's already overly convoluted for something as
simple as drawing a triangle, tbf. There has to be a simpler solution,
right?

Thanks a lot,
Have a great day,
-- 
Philippe



drawing requests following the line

2024-09-04 Thread Philippe PITTOLI via
Hello,

I've a question regarding drawing requests.

I would like for example to underline or highlight some text even
when it is spanning over multiple lines (or pages).  Thus, I suppose
the best way would be to perform a drawing request that somewhat
"follows the line".

As far as I understand, some macros actually prevent hyphenation
to avoid dealing with the (yet very common) "corner case" of a
carriage return (or a page change).

Any tips or alternative solutions?

Thanks and have a great day!
-- 
Philippe



Re: Is there a Groff showcase?

2023-12-07 Thread Philippe PITTOLI via
Le Thu, Dec 07, 2023 at 05:35:25PM +, Mike a écrit :
> Hello, 
> 
> I'd like to know if a showcase of Groff typeset documents exists
> anywhere on the internet?


It's not much, but I did some kind of a template for different stuff with groff
that you can find here : https://t.karchnu.fr/doc/grofftut.pdf

Not sure it's what you're looking for.