Wednesday, July 3, 2013

Form string to image

As you might notice, good part of my project presents converting string with LaTeX markup into bitmap image. As this can't be done directly form string we use some additional programs. Here is little sketch, focusing on how this part is working together. 
----------------------------------------------------------------------------------------------------------------------------------
string --> Adapter --> .tex --> LaTeX system --> .dvi --> dvips --> .eps --> Ghostscript --> .png                                                                                                      +--> bounding box                                     
----------------------------------------------------------------------------------------------------------------------------------

Adapter is transferring string with integrated markup to LaTeX file, with everything set for further use. File is predefined within code, Adapter just adds string into right place. Working further and additional testing will invoke changing of how exactly this code works but for now it's working great. 

LaTeX system isn't part of Octave. So it needs to be additionally installed on platform. It takes a file with structured markup code and convert it to device independent file format. 

dvips program can convert this file into encapsulated post script. It does this to get vector image and for boundary box (part of this file is line with coordinates of boundary box). 

Ghostscript is part of Octave installation. It takes previous file and convert it to bitmap image. We as user can control image quality with resolution. 

Bitmap image and boundary box will be used in next few steps for adding image to OpenGL buffer. This micro system is tested with all kinds of formula markup and for now everything is working okay. With every new step in development, there will be additional testing. There will be added code for controlling image quality, depending of size on plot and fontsize (LaTeX support only 10/11/12 point size of font directly). 

No comments:

Post a Comment