Hershey Vector Fonts 0.1.0
A C++ library for working with the Hershey vector fonts
Loading...
Searching...
No Matches
hershey_cairo.hpp File Reference
#include <cairo-pdf.h>
#include "font.hpp"
#include "glyph.hpp"
#include "string.hpp"

Go to the source code of this file.

Macros

#define A4_P_WIDTH   595.275590551
 
#define A4_P_HEIGHT   841.88976378
 
#define A5_P_WIDTH   420.94488189
 
#define A5_P_HEIGHT   595.275590551
 

Functions

void draw_glyph (cairo_t *cr, Hershey::Glyph glyph, int x0, int y0, int scale)
 Draw a glyph.
 
void draw_glyphs (cairo_t *cr, Hershey::String string, int x0, int y0, int scale)
 Draw a string of glyphs.
 
void draw_font (cairo_t *cr, 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.
 

Detailed Description

This header file contains the declaration of the functions for the Cairo interface.

Function Documentation

◆ draw_font()

void draw_font ( cairo_t *  cr,
Hershey::Font  font,
int  width,
int  height 
)

Draw the glyphs in a font.

Parameters
crThe Cairo context
fontThe font to draw

◆ draw_glyph()

void draw_glyph ( cairo_t *  cr,
Hershey::Glyph  glyph,
int  x0,
int  y0,
int  scale 
)

Draw a glyph.

Parameters
crThe Cairo context
glyphThe glyph to draw
x0The starting x position
y0The starting x position
scaleThe amount to scale the glyph by

◆ draw_glyphs()

void draw_glyphs ( cairo_t *  cr,
Hershey::String  string,
int  x0,
int  y0,
int  scale 
)

Draw a string of glyphs.

Parameters
crThe Cairo context
glyphThe string of glyphs to draw
x0The starting x position
y0The starting x position
scaleThe amount to scale the glyphs by

◆ position()

float position ( float  fraction,
float  x,
float  X 
)

Calculate a fractional position.

Parameters
fractionThe fraction to use
xThe object's size
XThe total size