Next: , Up: File formats   [Contents][Index]


B.1 Font files

Starting from v.1.6 the MathGL library uses new font files. The font is defined in 4 files with suffixes ‘*.vfm’, ‘*_b.vfm’, ‘*_i.vfm’, ‘*_bi.vfm’. These files are text files containing the data for roman font, bold font, italic font and bold italic font. The files (or some symbols in the files) for bold, italic or bold italic fonts can be absent. In this case the roman glyph will be used for them. By analogy, if the bold italic font is absent but the bold font is present then bold glyph will be used for bold italic. You may create these font files by yourself from *.ttf, *.otf files with the help of program font_tools. This program can be found at MathGL home site.

The format of font files (*.vfm – vector font for MathGL) is the following.

  1. First string contains human readable comment and is always ignored.
  2. Second string contains 3 numbers, delimited by space or tabulation. The order of numbers is the following: numg – the number of glyphs in the file (integer), fact – the factor for glyph sizing (mreal), size – the size of buffer for glyph description (integer).
  3. After it numg-th strings with glyphs description are placed. Each string contains 6 positive numbers, delimited by space of tabulation. The order of numbers is the following: Unicode glyph ID, glyph width, number of lines in glyph, position of lines coordinates in the buffer (length is 2*number of lines), number of triangles in glyph, position of triangles coordinates in the buffer (length is 6*number of triangles).
  4. The end of file contains the buffer with point coordinates at lines or triangles vertexes. The size of buffer (the number of integer) is size.

Each font file can be compressed by gzip.

Note: the closing contour line is done automatically (so the last segment may be absent). For starting new contour use a point with coordinates {0x3fff, 0x3fff}.





Next: , Up: File formats   [Contents][Index]