My goal is the following: Isabelle/jEdit is an extension of jEdit for the Isabelle theorem prover. I would like to get the typeset, syntax-highlighted version of my theory files to an image file programmatically, using a shell command, as they appear on the screen.
This is a follow-up to Calling into jEdit to get a bitmap of the rendered text where an author wrote a BeanShell script to translate a JTextArea into an image file. This is the script:
import java.awt.image.BufferedImage;
import javax.imageio.ImageIO;
img = new BufferedImage(textArea.getWidth(), textArea.getHeight(), BufferedImage.TYPE_INT_ARGB);
g = img.getGraphics();
textArea.paint(g);
g.dispose();
ImageIO.write(img, "png", new File(".../textArea.png"));
and I called that from the command line
$ isabelle jedit -j "-run=textarea-snapshot.bsh" MyTheory.thy
but the BeanShell script's textArea
is undefined so I got an error.
So I should get the main JTextArea
of jEdit
to make this work.
As far as I understand it is created at
https://github.com/albfan/jEdit/blob/master/org/gjt/sp/jedit/gui/RegisterViewer.java#L78
contentTextArea = new JTextArea(10,20);
but it is not clear whether I can access it from a BeanShell script without modifying jEdit's code.
Could someone with jEdit experience answer how I could name this contentTextArea from my BeanShell script? Or, how could I solve my Original Goal?