I'd like to render equations in a Compose Desktop application.
I thought this library might give me a path to doing that, but it looks like I have basically two options:
(a) I render everything to a BufferedImage and then paint the image.
(b) I implement a Graphics2D on top of Compose's Canvas API.
Rendering to an image certainly can work and may be a reasonable short term solution. The only thing that I'm not fond of is that when I select text in the application I sort of want it to select through equations, ideally even inline ones.
Writing a CanvasGraphics2D is something I took a shot at for most of today. It should work in theory, but font handling and metrics are handled quite differently between the two libraries, so I haven't been able to get an acceptable result yet.
So I took a look at TeXIcon to see whether there might be a simpler option of walking the layout like a DOM and just emitting a Text component for each node, but it looks like Box doesn't make the list of children public, so it's difficult.
So I think I'd like either
(a) some way of walking the tree of layout info after it's built, or
(b) some API simpler than Graphics2D that I can implement to render to a different graphics context.
I'd like to render equations in a Compose Desktop application.
I thought this library might give me a path to doing that, but it looks like I have basically two options: (a) I render everything to a BufferedImage and then paint the image. (b) I implement a
Graphics2D
on top of Compose'sCanvas
API.Rendering to an image certainly can work and may be a reasonable short term solution. The only thing that I'm not fond of is that when I select text in the application I sort of want it to select through equations, ideally even inline ones.
Writing a
CanvasGraphics2D
is something I took a shot at for most of today. It should work in theory, but font handling and metrics are handled quite differently between the two libraries, so I haven't been able to get an acceptable result yet.So I took a look at
TeXIcon
to see whether there might be a simpler option of walking the layout like a DOM and just emitting aText
component for each node, but it looks likeBox
doesn't make the list of children public, so it's difficult.So I think I'd like either (a) some way of walking the tree of layout info after it's built, or (b) some API simpler than
Graphics2D
that I can implement to render to a different graphics context.