nr-svgfonts.cpp revision fdab393307601fbda47db903f77e4db1f8e941d3
#include "config.h"
#ifdef ENABLE_SVG_FONTS
/*
* SVGFonts rendering implementation
*
* Authors:
* Felipe C. da S. Sanches <felipe.sanches@gmail.com>
*
* Copyright (C) 2008 Felipe C. da S. Sanches
*
* Released under GNU GPL version 2 or later.
* Read the file 'COPYING' for more information.
*/
#include <libnr/n-art-bpath.h>
#include "../style.h"
#include <cairo.h>
#include <vector>
#include "inkscape-cairo.h"
#include "nr-svgfonts.h"
//***********************************//
// SvgFontDrawingArea Implementation //
//***********************************//
public:
}
private:
cr->set_font_face( Cairo::RefPtr<Cairo::FontFace>(new Cairo::FontFace(this->svgfont->get_font_face(), false /* does not have reference */)) );
return TRUE;
}
};//class SvgFontDrawingArea
//*************************//
// UserFont Implementation //
//*************************//
static cairo_user_data_key_t key;
}
unsigned long unicode,
unsigned long *glyph){
}
unsigned long glyph,
}
this->face = cairo_user_font_face_create ();
}
//******************************//
// SvgFont class Implementation //
//******************************//
this->missingglyph = NULL;
font_da = new SvgFontDrawingArea(this);
}
{
//TODO
// metrics->ascent = .75;
// metrics->descent = .25;
return CAIRO_STATUS_SUCCESS;
}
unsigned long unicode,
unsigned long *glyph)
{
//g_warning("scaled_font_unicode_to_glyph CALL. unicode=%c", (char)unicode);
unsigned long i;
//TODO: compare unicode strings for ligadure glyphs (i.e. scaled_font_text_to_glyph)
*glyph = i;
return CAIRO_STATUS_SUCCESS;
}
}
*glyph = i;
return CAIRO_STATUS_SUCCESS;
}
unsigned long glyph,
{
//g_warning("scaled_font_render_glyph CALL. glyph=%d", (int)glyph);
if (!this->missingglyph) return CAIRO_STATUS_SUCCESS;
g_warning("RENDER MISSING-GLYPH");
} else {
}
if (SP_IS_MISSING_GLYPH(node) && ((SPMissingGlyph*)node)->d) bpath = sp_svg_read_path(((SPMissingGlyph*)node)->d);
if (!bpath) return CAIRO_STATUS_SUCCESS;
cairo_fill(cr);
return CAIRO_STATUS_SUCCESS;
}
SvgFont::get_font_face(){
if (!this->userfont) {
if (SP_IS_GLYPH(node)){
g_warning("glyphs.push_back((SPGlyph*)node); (node->unicode[0]='%c')", ((SPGlyph*)node)->unicode[0]);
}
if (SP_IS_MISSING_GLYPH(node)){
g_warning("missingglyph=(SPMissingGlyph*)node;");
}
}
}
}
#endif //#ifdef ENABLE_SVG_FONTS