MicroTeX
MicroTeX copied to clipboard
Generate canvas instructions when no direct access to a canvas
I just discovered that the programming language to which I was hoping to link this library does not support callbacks, which means I cannot directly have the library draw on my program's canvas. In other words, I can only pull data from the library, not have the library pull data from my program.
I was thinking of trying to get around this by implementing the interfaces in graphics.h
as outputting text, that I could then interpret and lay out in my program's canvas. So I would pull text like
setColor(red)
setFont(...)
drawText(...)
Do you think this is at all feasible? I am a little bit worried about data that the library might need, that it pulls from elsewhere while it is layout out. For example, does the need for TextLayout.getBounds()
break the above idea?
This is an excellent idea! The first design is for Android and iOS, and no drawing callbacks were taking into account. Your idea is definitely feasible, I'm going to refactor the graphical interface to support callbacks. Any PR is very appreciate!
Refactoring for drawing callbacks would be excellent! I'm only learning about this now, so I probably can't create a PR, but I'll be very happy to test.