sp-font-face.cpp revision f5d57c26ee63ac2bd5417a6bcc19d90b227ae797
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#ifdef ENABLE_SVG_FONTS
#define __SP_FONTFACE_C__
/*
* SVG <font-face> element implementation
*
* Section 20.8.3 of the W3C SVG 1.1 spec
* available at:
* http://www.w3.org/TR/SVG/fonts.html#FontFaceElement
*
* Author:
* Felipe C. da S. Sanches <felipe.sanches@gmail.com>
*
* Copyright (C) 2008, Felipe C. da S. Sanches
*
* Released under GNU GPL, read the file 'COPYING' for more information
*/
#include "attributes.h"
#include "sp-font-face.h"
#include "document.h"
#include "helper-fns.h"
//TODO: apparently unused. Maybe should be removed.
class ObjectContainer
{
public:
ObjectContainer(double def){
this->isset = false;
this->default_value = def;
}
double get(){
if (this->isset)
return this->obj;
else
return this->default_value;
}
this->isset = true;
}
void unset(){
this->isset = false;
}
private:
double obj;
double default_value;
bool isset;
};
if (!value){
return v;
}
value += 3;
value++;
return v;
}
while(value[0]!='\0'){
switch(value[0]){
case 'n':
value += 6;
}
break;
case 'i':
value += 6;
}
break;
case 'o':
value += 7;
}
break;
}
value++;
}
return v;
}
if (!value){
return v;
}
while(value[0]!='\0'){
switch(value[0]){
case 'n':
value += 6;
}
break;
case 's':
value += 10;
}
break;
}
value++;
}
return v;
}
if (!value){
return v;
}
value += 3;
value++;
return v;
}
while(value[0]!='\0'){
switch(value[0]){
case 'n':
value += 6;
}
break;
case 'b':
value += 4;
}
break;
case '1':
value += 3;
}
break;
case '2':
value += 3;
}
break;
case '3':
value += 3;
}
break;
case '4':
value += 3;
}
break;
case '5':
value += 3;
}
break;
case '6':
value += 3;
}
break;
case '7':
value += 3;
}
break;
case '8':
value += 3;
}
break;
case '9':
value += 3;
}
break;
}
value++;
}
return v;
}
if (!value){
return v;
}
value += 3;
value++;
return v;
}
while(value[0]!='\0'){
switch(value[0]){
case 'n':
value += 6;
}
break;
case 'u':
value += 15;
}
value += 14;
}
break;
case 'e':
value += 8;
}
value += 15;
}
value += 14;
}
break;
case 'c':
value += 9;
}
break;
case 's':
value += 14;
}
value += 13;
}
break;
}
value++;
}
return v;
}
static Inkscape::XML::Node *sp_fontface_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags);
static void sp_fontface_child_added(SPObject *object, Inkscape::XML::Node *child, Inkscape::XML::Node *ref);
static SPObjectClass *parent_class;
GType sp_fontface_get_type(void)
{
if (!type) {
sizeof(SPFontFaceClass),
NULL, /* base_init */
NULL, /* base_finalize */
NULL, /* class_finalize */
NULL, /* class_data */
sizeof(SPFontFace),
16, /* n_preallocs */
NULL, /* value_table */
};
}
return type;
}
{
}
{
/*
//face->font_style = ;
//face->font_variant = ;
//face->font_weight = ;
//face->font_stretch = ;
face->font_size = NULL;
//face->unicode_range = ;
face->units_per_em = 1000;
//face->panose_1 = ;
face->stem_v = ;
face->stem_h = ;
face->slope = 0;
face->cap_height = ;
face->x_height = ;
face->accent_height = ;
face->ascent = ;
face->descent = ;
face->widths = NULL;
face->bbox = NULL;
face->ideographic = ;
face->alphabetic = ;
face->mathematical = ;
face->hanging = ;
face->v_ideographic = ;
face->v_alphabetic = ;
face->v_mathematical = ;
face->v_hanging = ;
face->underline_position = ;
face->underline_thickness = ;
face->strikethrough_position = ;
face->strikethrough_thickness = ;
face->overline_position = ;
face->overline_thickness = ;
*/
}
{
}
}
{
}
/**
* Callback for child_added event.
*/
static void
{
}
/**
* Callback for remove_child event.
*/
static void
{
}
{
//SPFontFace *font = SP_FONTFACE(object);
}
}
{
double number;
switch (key) {
case SP_PROP_FONT_FAMILY:
break;
case SP_PROP_FONT_STYLE:
} else {
break;
}
}
}
break;
case SP_PROP_FONT_VARIANT:
} else {
break;
}
}
}
break;
case SP_PROP_FONT_WEIGHT:
} else {
break;
}
}
}
break;
case SP_PROP_FONT_STRETCH:
} else {
break;
}
}
}
break;
case SP_ATTR_UNITS_PER_EM:
}
break;
case SP_ATTR_STEMV:
}
break;
case SP_ATTR_STEMH:
}
break;
case SP_ATTR_SLOPE:
}
break;
case SP_ATTR_CAP_HEIGHT:
}
break;
case SP_ATTR_X_HEIGHT:
}
break;
case SP_ATTR_ACCENT_HEIGHT:
}
break;
case SP_ATTR_ASCENT:
}
break;
case SP_ATTR_DESCENT:
}
break;
case SP_ATTR_IDEOGRAPHIC:
}
break;
case SP_ATTR_ALPHABETIC:
}
break;
case SP_ATTR_MATHEMATICAL:
}
break;
case SP_ATTR_HANGING:
}
break;
case SP_ATTR_V_IDEOGRAPHIC:
}
break;
case SP_ATTR_V_ALPHABETIC:
}
break;
case SP_ATTR_V_MATHEMATICAL:
}
break;
case SP_ATTR_V_HANGING:
}
break;
}
break;
}
break;
}
break;
}
break;
}
break;
}
break;
default:
}
break;
}
}
/**
* Receives update notifications.
*/
static void
{
if (flags & (SP_OBJECT_MODIFIED_FLAG)) {
}
}
}
static Inkscape::XML::Node *sp_fontface_write(SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags)
{
}
//TODO:
//sp_repr_set_svg_double(repr, "font-family", face->font_family);
//sp_repr_set_svg_double(repr, "font-style", face->font_style);
//sp_repr_set_svg_double(repr, "font-variant", face->font_variant);
//sp_repr_set_svg_double(repr, "font-weight", face->font_weight);
//sp_repr_set_svg_double(repr, "font-stretch", face->font_stretch);
//sp_repr_set_svg_double(repr, "font-size", face->font_size);
//sp_repr_set_svg_double(repr, "unicode-range", face->unicode_range);
//sp_repr_set_svg_double(repr, "panose-1", face->panose_1);
//sp_repr_set_svg_double(repr, "widths", face->widths);
//sp_repr_set_svg_double(repr, "bbox", face->bbox);
}
}
return repr;
}
#endif //#ifdef ENABLE_SVG_FONTS
/*
Local Variables:
mode:c++
c-file-style:"stroustrup"
c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
indent-tabs-mode:nil
fill-column:99
End:
*/
// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :