Hershey Vector Fonts 0.1.0
A C++ library for working with the Hershey vector fonts
|
#include <fstream>
#include <iostream>
#include "font.hpp"
#include "glyph.hpp"
#include "string.hpp"
Go to the source code of this file.
Functions | |
void | write_header (std::ofstream &svg_file, int width, int height, int scale) |
Write the svg file header. | |
void | write_footer (std::ofstream &svg_file) |
Write the svg file header. | |
void | draw_glyph (std::ofstream &svg_file, Hershey::Glyph glyph, int x0, int y0, int scale) |
Draw a glyph. | |
void | draw_glyphs (std::ofstream &svg_file, Hershey::String string, int x0, int y0, int scale) |
Draw a string of glyphs. | |
void | draw_font (std::ofstream &svg_file, Hershey::Font font, int width, int height) |
Draw the glyphs in a font. | |
float | position (float fraction, float x, float X) |
Calculate a fractional position. | |
This header file contains the declaration of the functions for the svg interface.
void draw_font | ( | std::ofstream & | svg_file, |
Hershey::Font | font, | ||
int | width, | ||
int | height | ||
) |
Draw the glyphs in a font.
svg_file | The file to draw to |
font | The font to draw |
width | The width of the image |
height | The height of the image |
void draw_glyph | ( | std::ofstream & | svg_file, |
Hershey::Glyph | glyph, | ||
int | x0, | ||
int | y0, | ||
int | scale | ||
) |
Draw a glyph.
svg_file | The file to draw to |
glyph | The glyph to draw |
x0 | The starting x position |
y0 | The starting x position |
scale | The amount to scale the glyph by |
void draw_glyphs | ( | std::ofstream & | svg_file, |
Hershey::String | string, | ||
int | x0, | ||
int | y0, | ||
int | scale | ||
) |
Draw a string of glyphs.
svg_file | The file to draw to |
string | The string of glyphs to draw |
x0 | The starting x position |
y0 | The starting x position |
scale | The amount to scale the glyphs by |
float position | ( | float | fraction, |
float | x, | ||
float | X | ||
) |
Calculate a fractional position.
fraction | The fraction to use |
x | The object's size |
X | The total size |
void write_footer | ( | std::ofstream & | svg_file | ) |
Write the svg file header.
svg_file | The file to draw to |
void write_header | ( | std::ofstream & | svg_file, |
int | width, | ||
int | height, | ||
int | scale | ||
) |
Write the svg file header.
svg_file | The file to draw to |
width | The width of the image |
height | The height of the image |
scale | The amount to scale the image by |