Omikhleia / ptable.sile

Paragraph boxes, framed boxes and table packages for the SILE typesetting system
MIT License
10 stars 2 forks source link

make border and fill colors optional for framebox #9

Closed mahmadzaid closed 1 year ago

mahmadzaid commented 1 year ago

So this looks to be possible according to PathRenderer:draw but isn't reflected in the \framebox and \roundbox commands.

Omikhleia commented 1 year ago

Indeed, because we call PathRenderer:draw with values that were always initialized with a color, e.g. here:

https://github.com/Omikhleia/ptable.sile/blob/9b9ec3bbb5539acb8938fb094a50915facfb4f25/packages/framebox/init.lua#L121-L123

One of the issue was the shadow color, though. We don't compute the exclusion, but just draw two boxes on top of each other. So if the fill color is made optional and a shadow is enabled, it might not lead to the expected result ;)

mahmadzaid commented 1 year ago

Ha, I guess it's not much of a compromise :)

Omikhleia commented 1 year ago

Ha, I guess it's not much of a compromise :)

It seems it is possible in PDF Graphics to implement a "clipping path". That could be a potential way to only draw the relevant part of the shadow.

Omikhleia commented 1 year ago

It seems it is possible in PDF Graphics to implement a "clipping path".

Confirming a clipping path works. I'll work on making a clean implementation now that I have the basics.