{"by":"chearon","descendants":137,"id":39778570,"kids":[39779862,39783598,39780282,39778922,39786270,39778996,39788573,39780322,39778886,39779323,39787417,39779509,39794526,39780841,39781383,39779719,39792398,39782766,39780056,39779635,39783613,39786472,39779703,39781420,39779602,39779902,39783769,39779477,39781284,39781441,39780458,39779801,39779301,39782168,39789170,39782225,39781994,39781981,39781583],"score":404,"text":"For the last 5 years I&#x27;ve been working on a layout engine that targets CSS2 and some more modern properties.<p>Live demo: <a href=\"https:&#x2F;&#x2F;chearon.github.io&#x2F;dropflow&#x2F;\" rel=\"nofollow\">https:&#x2F;&#x2F;chearon.github.io&#x2F;dropflow&#x2F;</a><p>It matches browsers in all cases I can find where they agree, and it&#x27;s fast. It supports `position`, `inline-block`, `z-index`, and complex properties like `float` and `vertical-align`. It doesn&#x27;t support high-level layout like flexbox or grid yet, but you can get intrinsics to easily divide space yourself and paint multiple layout trees. It has a great text layout implementation, and supporting non-Latin scripts is a top priority.<p>I&#x27;ve wanted this to exist as far back as 2013, and the desire kept coming up: for a way to get detailed intrinsics, for high quality rich text layout to canvas and SVG, and for server-side rich text. We currently use it in CellEngine for our new canvas-based spreadsheet library to layout text in hundreds of thousands of cells, and will be using it soon to render PDFs with thousands of pages in a few seconds.","time":1711029511,"title":"Show HN: Dropflow, a CSS layout engine for node or <canvas>","type":"story","url":"https://github.com/chearon/dropflow"}