28.06.2014 Views

GAViewer 0.43 manual (.pdf)

GAViewer 0.43 manual (.pdf)

GAViewer 0.43 manual (.pdf)

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Chapter 5<br />

Typesetting labels.<br />

<strong>GAViewer</strong> features a simple typesetting language which resembles Latex. It<br />

was implemented by the author as an introduction to parsing and interpreting<br />

languages, and of course because of its functionality. Here is a list of some of<br />

the features the the typesetting system provides:<br />

• text and equation modes,<br />

• sub- and superscripts,<br />

• four scalable fonts (regular, italic, bold, greek),<br />

• some special ’GA’-symbols,<br />

• tabulars,<br />

• left, right, center, and justifyable alignment,<br />

• hats,<br />

• scalable parenthesis,<br />

• (square) roots,<br />

• fractions,<br />

• custom commands (macros), and<br />

• (custom) colors.<br />

The implementation of the typesetting system was kept simple, which makes<br />

it unsuitable for typesetting large amounts of text. The input is parsed, checked<br />

for syntax errors, and converted to a parse tree. After the parse pass have<br />

been completed, the parse tree is interpreted an turned into drawing commands.<br />

Then the parse tree can be released, and the drawing commands sent<br />

to OpenGL (or some other graphics API). Because parsing, interpreting and<br />

drawing do not occur in one pass, large amounts of memory will be required<br />

in large amounts of text are supplied as input. As a side note, lex and yacc (cite<br />

XXX todo) are used for parsing the input.<br />

The font for the typesetting is a 1024 × 1024 pixel ’GL ALPHA’ texture. It<br />

is included directly in the source code, in fontdata.cpp. The font is antialiased<br />

49

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!