#include <cairomm/cairomm.h>
const double HEIGHT = 200.0;
const double WIDTH = 400.0;
const double FONT_SIZE = 64.0;
const double TEXT_ORIGIN_Y = (HEIGHT / 2.0) + (FONT_SIZE / 2.0);
const double TEXT_ORIGIN_X = 50.0;  
const double GLYPH_SPACING = 0.1;
struct GlyphBounds
{
  unsigned long glyph;
  double width;
  double height;
};
static const GlyphBounds glyphs[] =
{
  { 'c', 0.45, 0.5 },
  { 'a', 0.45, 0.5 },
  { 'i', 0.2, 0.75 },
  { 'r', 0.4, 0.5 },
  { 'o', 0.44, 0.5 },
  { 'm', 0.75, 0.5 },
  { '!', 0.2, 0.75 }
};
{
public:
  
  
  {
  }
  Cairo::ErrorStatus
  {
    for (unsigned int i = 0; i < sizeof (glyphs) / sizeof (GlyphBounds); ++i) {
      if (glyphs[i].width > 
max)
     }
    
    extents.max_x_advance = 
max;
    return CAIRO_STATUS_SUCCESS;
  }
  Cairo::ErrorStatus
                    unsigned long unicode, unsigned long& glyph) override
  {
    glyph = 0;
    
    
    for (unsigned int i = 0; i < sizeof (glyphs) / sizeof (GlyphBounds); ++i) {
      if (glyphs[i].glyph == unicode) {
        
        glyph = i+1;
        break;
      }
    }
    return CAIRO_STATUS_SUCCESS;
  }
  Cairo::ErrorStatus
               unsigned long glyph,
  {
    
    if (glyph >= 1 && glyph <= sizeof(glyphs)/sizeof(GlyphBounds)) {
      
      
      cr->
rectangle(0.0, 0.0, glyphs[glyph-1].width, -glyphs[glyph-1].height);
      metrics.x_advance = glyphs[glyph-1].width + GLYPH_SPACING;
    }
    return CAIRO_STATUS_SUCCESS;
  }
protected:
  
  
  BoxFontFace() : UserFontFace() { }
};
int main(int, char**)
{
  auto surface =
  
  
  cr->
arc(TEXT_ORIGIN_X, TEXT_ORIGIN_Y, FONT_SIZE / 4.0, 0, 2*M_PI);
  
  cr->
move_to(TEXT_ORIGIN_X, TEXT_ORIGIN_Y);
  auto font = BoxFontFace::create();
  
  cr->
move_to(TEXT_ORIGIN_X, TEXT_ORIGIN_Y);
  auto toy_font =
  const char* filename = "user-font.png";
  try {
    surface->write_to_png(filename);
    return 0;
  {
    return 1;
  }
}