diff --git a/src/sp-font-face.cpp b/src/sp-font-face.cpp
index f4eb8be4cc3e42033104e95deac157b228a34a85..93e2eeac82ea178191b3c006b50d3ed1303640c9 100644 (file)
--- a/src/sp-font-face.cpp
+++ b/src/sp-font-face.cpp
-#define __SP_FONTFACE_C__
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#ifdef ENABLE_SVG_FONTS
/*
* SVG <font-face> element implementation
*
* Section 20.8.3 of the W3C SVG 1.1 spec
- * available at:
+ * available at:
* http://www.w3.org/TR/SVG/fonts.html#FontFaceElement
*
* Author:
- * Felipe C. da S. Sanches <felipe.sanches@gmail.com>
+ * Felipe C. da S. Sanches <juca@members.fsf.org>
+ * Abhishek Sharma
*
* Copyright (C) 2008, Felipe C. da S. Sanches
*
#include "attributes.h"
#include "sp-font-face.h"
#include "document.h"
-#include "helper-fns.h"
+//TODO: apparently unused. Maybe should be removed.
class ObjectContainer
{
v.push_back(SP_FONTFACE_STYLE_ALL);
return v;
}
-
+
if (strncmp(value, "all", 3) == 0){
value += 3;
while(value[0]==',' || value[0]==' ')
@@ -131,7 +136,7 @@ static std::vector<FontFaceWeightType> sp_read_fontFaceWeightType(gchar const *v
v.push_back(SP_FONTFACE_WEIGHT_ALL);
return v;
}
-
+
if (strncmp(value, "all", 3) == 0){
value += 3;
while(value[0]==',' || value[0]==' ')
v.push_back(SP_FONTFACE_STRETCH_NORMAL);
return v;
}
-
+
if (strncmp(value, "all", 3) == 0){
value += 3;
while(value[0]==',' || value[0]==' ')
static void sp_fontface_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr);
static void sp_fontface_release(SPObject *object);
static void sp_fontface_set(SPObject *object, unsigned int key, const gchar *value);
-static Inkscape::XML::Node *sp_fontface_write(SPObject *object, Inkscape::XML::Node *repr, guint flags);
+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 void sp_fontface_remove_child(SPObject *object, Inkscape::XML::Node *child);
if (!type) {
GTypeInfo info = {
sizeof(SPFontFaceClass),
- NULL, /* base_init */
- NULL, /* base_finalize */
+ NULL, /* base_init */
+ NULL, /* base_finalize */
(GClassInitFunc) sp_fontface_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
+ NULL, /* class_finalize */
+ NULL, /* class_data */
sizeof(SPFontFace),
- 16, /* n_preallocs */
+ 16, /* n_preallocs */
(GInstanceInitFunc) sp_fontface_init,
- NULL, /* value_table */
+ NULL, /* value_table */
};
type = g_type_register_static(SP_TYPE_OBJECT, "SPFontFace", &info, (GTypeFlags) 0);
}
std::vector<FontFaceStretchType> stretch;
stretch.push_back(SP_FONTFACE_STRETCH_NORMAL);
face->font_stretch = stretch;
-/*
face->font_family = NULL;
+ /*
//face->font_style = ;
//face->font_variant = ;
//face->font_weight = ;
@@ -398,42 +403,42 @@ static void sp_fontface_build(SPObject *object, SPDocument *document, Inkscape::
((SPObjectClass *) (parent_class))->build(object, document, repr);
}
- sp_object_read_attr(object, "font-family");
- sp_object_read_attr(object, "font-style");
- sp_object_read_attr(object, "font-variant");
- sp_object_read_attr(object, "font-weight");
- sp_object_read_attr(object, "font-stretch");
- sp_object_read_attr(object, "font-size");
- sp_object_read_attr(object, "unicode-range");
- sp_object_read_attr(object, "units-per-em");
- sp_object_read_attr(object, "panose-1");
- sp_object_read_attr(object, "stem-v");
- sp_object_read_attr(object, "stem-h");
- sp_object_read_attr(object, "slope");
- sp_object_read_attr(object, "cap-height");
- sp_object_read_attr(object, "x-height");
- sp_object_read_attr(object, "accent-height");
- sp_object_read_attr(object, "ascent");
- sp_object_read_attr(object, "descent");
- sp_object_read_attr(object, "widths");
- sp_object_read_attr(object, "bbox");
- sp_object_read_attr(object, "ideographic");
- sp_object_read_attr(object, "alphabetic");
- sp_object_read_attr(object, "mathematical");
- sp_object_read_attr(object, "ranging");
- sp_object_read_attr(object, "v-ideogaphic");
- sp_object_read_attr(object, "v-alphabetic");
- sp_object_read_attr(object, "v-mathematical");
- sp_object_read_attr(object, "v-hanging");
- sp_object_read_attr(object, "underline-position");
- sp_object_read_attr(object, "underline-thickness");
- sp_object_read_attr(object, "strikethrough-position");
- sp_object_read_attr(object, "strikethrough-thickness");
- sp_object_read_attr(object, "overline-position");
- sp_object_read_attr(object, "overline-thickness");
+ object->readAttr( "font-family" );
+ object->readAttr( "font-style" );
+ object->readAttr( "font-variant" );
+ object->readAttr( "font-weight" );
+ object->readAttr( "font-stretch" );
+ object->readAttr( "font-size" );
+ object->readAttr( "unicode-range" );
+ object->readAttr( "units-per-em" );
+ object->readAttr( "panose-1" );
+ object->readAttr( "stem-v" );
+ object->readAttr( "stem-h" );
+ object->readAttr( "slope" );
+ object->readAttr( "cap-height" );
+ object->readAttr( "x-height" );
+ object->readAttr( "accent-height" );
+ object->readAttr( "ascent" );
+ object->readAttr( "descent" );
+ object->readAttr( "widths" );
+ object->readAttr( "bbox" );
+ object->readAttr( "ideographic" );
+ object->readAttr( "alphabetic" );
+ object->readAttr( "mathematical" );
+ object->readAttr( "ranging" );
+ object->readAttr( "v-ideogaphic" );
+ object->readAttr( "v-alphabetic" );
+ object->readAttr( "v-mathematical" );
+ object->readAttr( "v-hanging" );
+ object->readAttr( "underline-position" );
+ object->readAttr( "underline-thickness" );
+ object->readAttr( "strikethrough-position" );
+ object->readAttr( "strikethrough-thickness" );
+ object->readAttr( "overline-position" );
+ object->readAttr( "overline-thickness" );
}
-static void sp_fontface_children_modified(SPFontFace *sp_fontface)
+static void sp_fontface_children_modified(SPFontFace */*sp_fontface*/)
{
}
static void sp_fontface_set(SPObject *object, unsigned int key, const gchar *value)
{
SPFontFace *face = SP_FONTFACE(object);
- double number;
std::vector<FontFaceStyleType> style;
std::vector<FontFaceVariantType> variant;
std::vector<FontFaceWeightType> weight;
std::vector<FontFaceStretchType> stretch;
switch (key) {
- case SP_PROP_FONT_STYLE:
+ case SP_PROP_FONT_FAMILY:
+ if (face->font_family) {
+ g_free(face->font_family);
+ }
+ face->font_family = g_strdup(value);
+ object->requestModified(SP_OBJECT_MODIFIED_FLAG);
+ break;
+ case SP_PROP_FONT_STYLE:
style = sp_read_fontFaceStyleType(value);
if (face->font_style.size() != style.size()){
face->font_style = style;
-g_warning("<font-face>: SP_ATTR_FONT_STYLE:");
- for (unsigned int i=0;i<style.size();i++){
- g_warning("enum value: %d", style[i]);
- }
object->requestModified(SP_OBJECT_MODIFIED_FLAG);
} else {
for (unsigned int i=0;i<style.size();i++){
- if(style[i] != face->font_style[i]){
+ if (style[i] != face->font_style[i]){
face->font_style = style;
-g_warning("<font-face>: SP_ATTR_FONT_STYLE:");
- for (unsigned int i=0;i<style.size();i++){
- g_warning("enum value: %d", style[i]);
- }
object->requestModified(SP_OBJECT_MODIFIED_FLAG);
break;
}
}
}
break;
- case SP_PROP_FONT_VARIANT:
+ case SP_PROP_FONT_VARIANT:
variant = sp_read_fontFaceVariantType(value);
if (face->font_variant.size() != variant.size()){
face->font_variant = variant;
-g_warning("<font-face>: SP_ATTR_FONT_VARIANT:");
- for (unsigned int i=0;i<variant.size();i++){
- g_warning("enum value: %d", variant[i]);
- }
object->requestModified(SP_OBJECT_MODIFIED_FLAG);
} else {
for (unsigned int i=0;i<variant.size();i++){
- if(variant[i] != face->font_variant[i]){
+ if (variant[i] != face->font_variant[i]){
face->font_variant = variant;
-g_warning("<font-face>: SP_ATTR_FONT_VARIANT:");
- for (unsigned int i=0;i<variant.size();i++){
- g_warning("- %d", variant[i]);
- }
object->requestModified(SP_OBJECT_MODIFIED_FLAG);
break;
}
}
}
break;
- case SP_PROP_FONT_WEIGHT:
+ case SP_PROP_FONT_WEIGHT:
weight = sp_read_fontFaceWeightType(value);
if (face->font_weight.size() != weight.size()){
face->font_weight = weight;
-g_warning("<font-face>: SP_ATTR_FONT_WEIGHT:");
- for (unsigned int i=0;i<weight.size();i++){
- g_warning("enum value: %d", weight[i]);
- }
object->requestModified(SP_OBJECT_MODIFIED_FLAG);
} else {
for (unsigned int i=0;i<weight.size();i++){
- if(weight[i] != face->font_weight[i]){
+ if (weight[i] != face->font_weight[i]){
face->font_weight = weight;
-g_warning("<font-face>: SP_ATTR_FONT_WEIGHT:");
- for (unsigned int i=0;i<weight.size();i++){
- g_warning("enum value: %d", weight[i]);
- }
object->requestModified(SP_OBJECT_MODIFIED_FLAG);
break;
}
}
}
break;
- case SP_PROP_FONT_STRETCH:
+ case SP_PROP_FONT_STRETCH:
stretch = sp_read_fontFaceStretchType(value);
if (face->font_stretch.size() != stretch.size()){
face->font_stretch = stretch;
-g_warning("<font-face>: SP_ATTR_FONT_STRETCH:");
- for (unsigned int i=0;i<stretch.size();i++){
- g_warning("enum value: %d", stretch[i]);
- }
object->requestModified(SP_OBJECT_MODIFIED_FLAG);
} else {
for (unsigned int i=0;i<stretch.size();i++){
- if(stretch[i] != face->font_stretch[i]){
+ if (stretch[i] != face->font_stretch[i]){
face->font_stretch = stretch;
-g_warning("<font-face>: SP_ATTR_FONT_STRETCH:");
- for (unsigned int i=0;i<stretch.size();i++){
- g_warning("enum value: %d", stretch[i]);
- }
object->requestModified(SP_OBJECT_MODIFIED_FLAG);
break;
}
}
}
break;
- case SP_ATTR_UNITS_PER_EM:
- number = helperfns_read_number(value);
+ case SP_ATTR_UNITS_PER_EM:
+ {
+ double number = value ? g_ascii_strtod(value, 0) : 0;
if (number != face->units_per_em){
face->units_per_em = number;
-g_warning("<font-face>: SP_ATTR_UNITS_PER_EM: %f", number);
object->requestModified(SP_OBJECT_MODIFIED_FLAG);
}
break;
- case SP_ATTR_STEMV:
- number = helperfns_read_number(value);
+ }
+ case SP_ATTR_STEMV:
+ {
+ double number = value ? g_ascii_strtod(value, 0) : 0;
if (number != face->stemv){
face->stemv = number;
-g_warning("<font-face>: SP_ATTR_STEMV: %f", number);
object->requestModified(SP_OBJECT_MODIFIED_FLAG);
}
break;
- case SP_ATTR_STEMH:
- number = helperfns_read_number(value);
+ }
+ case SP_ATTR_STEMH:
+ {
+ double number = value ? g_ascii_strtod(value, 0) : 0;
if (number != face->stemh){
face->stemh = number;
-g_warning("<font-face>: SP_ATTR_STEMH: %f", number);
object->requestModified(SP_OBJECT_MODIFIED_FLAG);
}
break;
- case SP_ATTR_SLOPE:
- number = helperfns_read_number(value);
+ }
+ case SP_ATTR_SLOPE:
+ {
+ double number = value ? g_ascii_strtod(value, 0) : 0;
if (number != face->slope){
face->slope = number;
-g_warning("<font-face>: SP_ATTR_SLOPE: %f", number);
object->requestModified(SP_OBJECT_MODIFIED_FLAG);
}
break;
- case SP_ATTR_CAP_HEIGHT:
- number = helperfns_read_number(value);
+ }
+ case SP_ATTR_CAP_HEIGHT:
+ {
+ double number = value ? g_ascii_strtod(value, 0) : 0;
if (number != face->cap_height){
face->cap_height = number;
-g_warning("<font-face>: SP_ATTR_CAP_HEIGHT: %f", number);
object->requestModified(SP_OBJECT_MODIFIED_FLAG);
}
break;
- case SP_ATTR_X_HEIGHT:
- number = helperfns_read_number(value);
+ }
+ case SP_ATTR_X_HEIGHT:
+ {
+ double number = value ? g_ascii_strtod(value, 0) : 0;
if (number != face->x_height){
face->x_height = number;
-g_warning("<font-face>: SP_ATTR_X_HEIGHT: %f", number);
object->requestModified(SP_OBJECT_MODIFIED_FLAG);
}
break;
- case SP_ATTR_ACCENT_HEIGHT:
- number = helperfns_read_number(value);
+ }
+ case SP_ATTR_ACCENT_HEIGHT:
+ {
+ double number = value ? g_ascii_strtod(value, 0) : 0;
if (number != face->accent_height){
face->accent_height = number;
-g_warning("<font-face>: SP_ATTR_ACCENT_HEIGHT: %f", number);
object->requestModified(SP_OBJECT_MODIFIED_FLAG);
}
break;
- case SP_ATTR_ASCENT:
- number = helperfns_read_number(value);
+ }
+ case SP_ATTR_ASCENT:
+ {
+ double number = value ? g_ascii_strtod(value, 0) : 0;
if (number != face->ascent){
face->ascent = number;
-g_warning("<font-face>: SP_ATTR_ASCENT: %f", number);
object->requestModified(SP_OBJECT_MODIFIED_FLAG);
}
break;
- case SP_ATTR_DESCENT:
- number = helperfns_read_number(value);
+ }
+ case SP_ATTR_DESCENT:
+ {
+ double number = value ? g_ascii_strtod(value, 0) : 0;
if (number != face->descent){
face->descent = number;
-g_warning("<font-face>: SP_ATTR_DESCENT: %f", number);
object->requestModified(SP_OBJECT_MODIFIED_FLAG);
}
break;
- case SP_ATTR_IDEOGRAPHIC:
- number = helperfns_read_number(value);
+ }
+ case SP_ATTR_IDEOGRAPHIC:
+ {
+ double number = value ? g_ascii_strtod(value, 0) : 0;
if (number != face->ideographic){
face->ideographic = number;
-g_warning("<font-face>: SP_ATTR_IDEOGRAPHIC: %f", number);
object->requestModified(SP_OBJECT_MODIFIED_FLAG);
}
break;
- case SP_ATTR_ALPHABETIC:
- number = helperfns_read_number(value);
+ }
+ case SP_ATTR_ALPHABETIC:
+ {
+ double number = value ? g_ascii_strtod(value, 0) : 0;
if (number != face->alphabetic){
face->alphabetic = number;
-g_warning("<font-face>: SP_ATTR_ALPHABETIC: %f", number);
object->requestModified(SP_OBJECT_MODIFIED_FLAG);
}
break;
- case SP_ATTR_MATHEMATICAL:
- number = helperfns_read_number(value);
+ }
+ case SP_ATTR_MATHEMATICAL:
+ {
+ double number = value ? g_ascii_strtod(value, 0) : 0;
if (number != face->mathematical){
face->mathematical = number;
-g_warning("<font-face>: SP_ATTR_MATHEMATICAL: %f", number);
object->requestModified(SP_OBJECT_MODIFIED_FLAG);
}
break;
- case SP_ATTR_HANGING:
- number = helperfns_read_number(value);
+ }
+ case SP_ATTR_HANGING:
+ {
+ double number = value ? g_ascii_strtod(value, 0) : 0;
if (number != face->hanging){
face->hanging = number;
-g_warning("<font-face>: SP_ATTR_HANGING: %f", number);
object->requestModified(SP_OBJECT_MODIFIED_FLAG);
}
break;
- case SP_ATTR_V_IDEOGRAPHIC:
- number = helperfns_read_number(value);
+ }
+ case SP_ATTR_V_IDEOGRAPHIC:
+ {
+ double number = value ? g_ascii_strtod(value, 0) : 0;
if (number != face->v_ideographic){
face->v_ideographic = number;
-g_warning("<font-face>: SP_ATTR_V_IDEOGRAPHIC: %f", number);
object->requestModified(SP_OBJECT_MODIFIED_FLAG);
}
break;
- case SP_ATTR_V_ALPHABETIC:
- number = helperfns_read_number(value);
+ }
+ case SP_ATTR_V_ALPHABETIC:
+ {
+ double number = value ? g_ascii_strtod(value, 0) : 0;
if (number != face->v_alphabetic){
face->v_alphabetic = number;
-g_warning("<font-face>: SP_ATTR_V_ALPHABETIC: %f", number);
object->requestModified(SP_OBJECT_MODIFIED_FLAG);
}
break;
- case SP_ATTR_V_MATHEMATICAL:
- number = helperfns_read_number(value);
+ }
+ case SP_ATTR_V_MATHEMATICAL:
+ {
+ double number = value ? g_ascii_strtod(value, 0) : 0;
if (number != face->v_mathematical){
face->v_mathematical = number;
-g_warning("<font-face>: SP_ATTR_V_MATHEMATICAL: %f", number);
object->requestModified(SP_OBJECT_MODIFIED_FLAG);
}
break;
- case SP_ATTR_V_HANGING:
- number = helperfns_read_number(value);
+ }
+ case SP_ATTR_V_HANGING:
+ {
+ double number = value ? g_ascii_strtod(value, 0) : 0;
if (number != face->v_hanging){
face->v_hanging = number;
-g_warning("<font-face>: SP_ATTR_V_HANGING: %f", number);
object->requestModified(SP_OBJECT_MODIFIED_FLAG);
}
break;
- case SP_ATTR_UNDERLINE_POSITION:
- number = helperfns_read_number(value);
+ }
+ case SP_ATTR_UNDERLINE_POSITION:
+ {
+ double number = value ? g_ascii_strtod(value, 0) : 0;
if (number != face->underline_position){
face->underline_position = number;
-g_warning("<font-face>: SP_ATTR_UNDERLINE_POSITION: %f", number);
object->requestModified(SP_OBJECT_MODIFIED_FLAG);
}
break;
- case SP_ATTR_UNDERLINE_THICKNESS:
- number = helperfns_read_number(value);
+ }
+ case SP_ATTR_UNDERLINE_THICKNESS:
+ {
+ double number = value ? g_ascii_strtod(value, 0) : 0;
if (number != face->underline_thickness){
face->underline_thickness = number;
-g_warning("<font-face>: SP_ATTR_UNDERLINE_THICKNESS: %f", number);
object->requestModified(SP_OBJECT_MODIFIED_FLAG);
}
break;
- case SP_ATTR_STRIKETHROUGH_POSITION:
- number = helperfns_read_number(value);
+ }
+ case SP_ATTR_STRIKETHROUGH_POSITION:
+ {
+ double number = value ? g_ascii_strtod(value, 0) : 0;
if (number != face->strikethrough_position){
face->strikethrough_position = number;
-g_warning("<font-face>: SP_ATTR_STRIKETHROUGH_POSITION: %f", number);
object->requestModified(SP_OBJECT_MODIFIED_FLAG);
}
break;
- case SP_ATTR_STRIKETHROUGH_THICKNESS:
- number = helperfns_read_number(value);
+ }
+ case SP_ATTR_STRIKETHROUGH_THICKNESS:
+ {
+ double number = value ? g_ascii_strtod(value, 0) : 0;
if (number != face->strikethrough_thickness){
face->strikethrough_thickness = number;
-g_warning("<font-face>: SP_ATTR_STRIKETHROUGH_THICKNESS: %f", number);
object->requestModified(SP_OBJECT_MODIFIED_FLAG);
}
break;
- case SP_ATTR_OVERLINE_POSITION:
- number = helperfns_read_number(value);
+ }
+ case SP_ATTR_OVERLINE_POSITION:
+ {
+ double number = value ? g_ascii_strtod(value, 0) : 0;
if (number != face->overline_position){
face->overline_position = number;
-g_warning("<font-face>: SP_ATTR_OVERLINE_POSITION: %f", number);
object->requestModified(SP_OBJECT_MODIFIED_FLAG);
}
break;
- case SP_ATTR_OVERLINE_THICKNESS:
- number = helperfns_read_number(value);
+ }
+ case SP_ATTR_OVERLINE_THICKNESS:
+ {
+ double number = value ? g_ascii_strtod(value, 0) : 0;
if (number != face->overline_thickness){
face->overline_thickness = number;
-g_warning("<font-face>: SP_ATTR_OVERLINE_THICKNESS: %f", number);
object->requestModified(SP_OBJECT_MODIFIED_FLAG);
}
break;
- default:
+ }
+ default:
if (((SPObjectClass *) (parent_class))->set) {
((SPObjectClass *) (parent_class))->set(object, key, value);
}
sp_fontface_update(SPObject *object, SPCtx *ctx, guint flags)
{
if (flags & (SP_OBJECT_MODIFIED_FLAG)) {
- sp_object_read_attr(object, "font-family");
- sp_object_read_attr(object, "font-style");
- sp_object_read_attr(object, "font-variant");
- sp_object_read_attr(object, "font-weight");
- sp_object_read_attr(object, "font-stretch");
- sp_object_read_attr(object, "font-size");
- sp_object_read_attr(object, "unicode-range");
- sp_object_read_attr(object, "units-per-em");
- sp_object_read_attr(object, "panose-1");
- sp_object_read_attr(object, "stemv");
- sp_object_read_attr(object, "stemh");
- sp_object_read_attr(object, "slope");
- sp_object_read_attr(object, "cap-height");
- sp_object_read_attr(object, "x-height");
- sp_object_read_attr(object, "accent-height");
- sp_object_read_attr(object, "ascent");
- sp_object_read_attr(object, "descent");
- sp_object_read_attr(object, "widths");
- sp_object_read_attr(object, "bbox");
- sp_object_read_attr(object, "ideographic");
- sp_object_read_attr(object, "alphabetic");
- sp_object_read_attr(object, "mathematical");
- sp_object_read_attr(object, "hanging");
- sp_object_read_attr(object, "v-ideographic");
- sp_object_read_attr(object, "v-alphabetic");
- sp_object_read_attr(object, "v-mathematical");
- sp_object_read_attr(object, "v-hanging");
- sp_object_read_attr(object, "underline-position");
- sp_object_read_attr(object, "underline-thickness");
- sp_object_read_attr(object, "strikethrough-position");
- sp_object_read_attr(object, "strikethrough-thickness");
- sp_object_read_attr(object, "overline-position");
- sp_object_read_attr(object, "overline-thickness");
+ object->readAttr( "font-family" );
+ object->readAttr( "font-style" );
+ object->readAttr( "font-variant" );
+ object->readAttr( "font-weight" );
+ object->readAttr( "font-stretch" );
+ object->readAttr( "font-size" );
+ object->readAttr( "unicode-range" );
+ object->readAttr( "units-per-em" );
+ object->readAttr( "panose-1" );
+ object->readAttr( "stemv" );
+ object->readAttr( "stemh" );
+ object->readAttr( "slope" );
+ object->readAttr( "cap-height" );
+ object->readAttr( "x-height" );
+ object->readAttr( "accent-height" );
+ object->readAttr( "ascent" );
+ object->readAttr( "descent" );
+ object->readAttr( "widths" );
+ object->readAttr( "bbox" );
+ object->readAttr( "ideographic" );
+ object->readAttr( "alphabetic" );
+ object->readAttr( "mathematical" );
+ object->readAttr( "hanging" );
+ object->readAttr( "v-ideographic" );
+ object->readAttr( "v-alphabetic" );
+ object->readAttr( "v-mathematical" );
+ object->readAttr( "v-hanging" );
+ object->readAttr( "underline-position" );
+ object->readAttr( "underline-thickness" );
+ object->readAttr( "strikethrough-position" );
+ object->readAttr( "strikethrough-thickness" );
+ object->readAttr( "overline-position" );
+ object->readAttr( "overline-thickness" );
}
if (((SPObjectClass *) parent_class)->update) {
#define COPY_ATTR(rd,rs,key) (rd)->setAttribute((key), rs->attribute(key));
-static Inkscape::XML::Node *sp_fontface_write(SPObject *object, Inkscape::XML::Node *repr, guint flags)
+static Inkscape::XML::Node *sp_fontface_write(SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags)
{
SPFontFace *face = SP_FONTFACE(object);
if ((flags & SP_OBJECT_WRITE_BUILD) && !repr) {
- Inkscape::XML::Document *xml_doc = sp_document_repr_doc(SP_OBJECT_DOCUMENT(object));
repr = xml_doc->createElement("svg:font-face");
}
@@ -865,48 +866,50 @@ static Inkscape::XML::Node *sp_fontface_write(SPObject *object, Inkscape::XML::N
sp_repr_set_svg_double(repr, "overline-thickness", face->overline_thickness);
if (repr != SP_OBJECT_REPR(object)) {
- COPY_ATTR(repr, object->repr, "font-family");
- COPY_ATTR(repr, object->repr, "font-style");
- COPY_ATTR(repr, object->repr, "font-variant");
- COPY_ATTR(repr, object->repr, "font-weight");
- COPY_ATTR(repr, object->repr, "font-stretch");
- COPY_ATTR(repr, object->repr, "font-size");
- COPY_ATTR(repr, object->repr, "unicode-range");
- COPY_ATTR(repr, object->repr, "units-per-em");
- COPY_ATTR(repr, object->repr, "panose-1");
- COPY_ATTR(repr, object->repr, "stemv");
- COPY_ATTR(repr, object->repr, "stemh");
- COPY_ATTR(repr, object->repr, "slope");
- COPY_ATTR(repr, object->repr, "cap-height");
- COPY_ATTR(repr, object->repr, "x-height");
- COPY_ATTR(repr, object->repr, "accent-height");
- COPY_ATTR(repr, object->repr, "ascent");
- COPY_ATTR(repr, object->repr, "descent");
- COPY_ATTR(repr, object->repr, "widths");
- COPY_ATTR(repr, object->repr, "bbox");
- COPY_ATTR(repr, object->repr, "ideographic");
- COPY_ATTR(repr, object->repr, "alphabetic");
- COPY_ATTR(repr, object->repr, "mathematical");
- COPY_ATTR(repr, object->repr, "hanging");
- COPY_ATTR(repr, object->repr, "v-ideographic");
- COPY_ATTR(repr, object->repr, "v-alphabetic");
- COPY_ATTR(repr, object->repr, "v-mathematical");
- COPY_ATTR(repr, object->repr, "v-hanging");
- COPY_ATTR(repr, object->repr, "underline-position");
- COPY_ATTR(repr, object->repr, "underline-thickness");
- COPY_ATTR(repr, object->repr, "strikethrough-position");
- COPY_ATTR(repr, object->repr, "strikethrough-thickness");
- COPY_ATTR(repr, object->repr, "overline-position");
- COPY_ATTR(repr, object->repr, "overline-thickness");
+ // In all COPY_ATTR given below the XML tree is
+ // being used directly while it shouldn't be.
+ COPY_ATTR(repr, object->getRepr(), "font-family");
+ COPY_ATTR(repr, object->getRepr(), "font-style");
+ COPY_ATTR(repr, object->getRepr(), "font-variant");
+ COPY_ATTR(repr, object->getRepr(), "font-weight");
+ COPY_ATTR(repr, object->getRepr(), "font-stretch");
+ COPY_ATTR(repr, object->getRepr(), "font-size");
+ COPY_ATTR(repr, object->getRepr(), "unicode-range");
+ COPY_ATTR(repr, object->getRepr(), "units-per-em");
+ COPY_ATTR(repr, object->getRepr(), "panose-1");
+ COPY_ATTR(repr, object->getRepr(), "stemv");
+ COPY_ATTR(repr, object->getRepr(), "stemh");
+ COPY_ATTR(repr, object->getRepr(), "slope");
+ COPY_ATTR(repr, object->getRepr(), "cap-height");
+ COPY_ATTR(repr, object->getRepr(), "x-height");
+ COPY_ATTR(repr, object->getRepr(), "accent-height");
+ COPY_ATTR(repr, object->getRepr(), "ascent");
+ COPY_ATTR(repr, object->getRepr(), "descent");
+ COPY_ATTR(repr, object->getRepr(), "widths");
+ COPY_ATTR(repr, object->getRepr(), "bbox");
+ COPY_ATTR(repr, object->getRepr(), "ideographic");
+ COPY_ATTR(repr, object->getRepr(), "alphabetic");
+ COPY_ATTR(repr, object->getRepr(), "mathematical");
+ COPY_ATTR(repr, object->getRepr(), "hanging");
+ COPY_ATTR(repr, object->getRepr(), "v-ideographic");
+ COPY_ATTR(repr, object->getRepr(), "v-alphabetic");
+ COPY_ATTR(repr, object->getRepr(), "v-mathematical");
+ COPY_ATTR(repr, object->getRepr(), "v-hanging");
+ COPY_ATTR(repr, object->getRepr(), "underline-position");
+ COPY_ATTR(repr, object->getRepr(), "underline-thickness");
+ COPY_ATTR(repr, object->getRepr(), "strikethrough-position");
+ COPY_ATTR(repr, object->getRepr(), "strikethrough-thickness");
+ COPY_ATTR(repr, object->getRepr(), "overline-position");
+ COPY_ATTR(repr, object->getRepr(), "overline-thickness");
}
if (((SPObjectClass *) (parent_class))->write) {
- ((SPObjectClass *) (parent_class))->write(object, repr, flags);
+ ((SPObjectClass *) (parent_class))->write(object, xml_doc, repr, flags);
}
return repr;
}
-
+#endif //#ifdef ENABLE_SVG_FONTS
/*
Local Variables:
mode:c++