Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ImportedProjects
SVG
Commits
67946913
Commit
67946913
authored
Jul 21, 2015
by
Tebjan Halm
Browse files
Merge pull request #147 from JoshMcCullough/fix-attributes
Fixed attributes/enums.
parents
3a2c7983
6b08837f
Changes
29
Hide whitespace changes
Inline
Side-by-side
Source/Painting/SvgStrokeLineJoin.cs
View file @
67946913
...
...
@@ -5,11 +5,20 @@ using System.ComponentModel;
namespace
Svg
{
/// <summary>Specifies the shape to be used at the corners of paths or basic shapes when they are stroked.</summary>
[
TypeConverter
(
typeof
(
SvgStrokeLineJoinConverter
))]
public
enum
SvgStrokeLineJoin
{
/// <summary>The value is inherited from the parent element.</summary>
Inherit
,
/// <summary>The corners of the paths are joined sharply.</summary>
Miter
,
/// <summary>The corners of the paths are rounded off.</summary>
Round
,
/// <summary>The corners of the paths are "flattened".</summary>
Bevel
}
}
Source/SvgAttributeCollection.cs
View file @
67946913
...
...
@@ -85,13 +85,12 @@ namespace Svg
private
bool
IsInheritValue
(
object
value
)
{
return
(
value
==
null
||
(
value
is
SvgFontStyle
&&
(
SvgFontStyle
)
value
==
SvgFontStyle
.
inherit
)
||
(
value
is
SvgFontWeight
&&
(
SvgFontWeight
)
value
==
SvgFontWeight
.
inherit
)
||
(
value
is
SvgTextAnchor
&&
(
SvgTextAnchor
)
value
==
SvgTextAnchor
.
inherit
)
||
(
value
is
SvgFontVariant
&&
(
SvgFontVariant
)
value
==
SvgFontVariant
.
inherit
)
||
(
value
is
SvgTextDecoration
&&
(
SvgTextDecoration
)
value
==
SvgTextDecoration
.
inherit
)
||
(
value
is
SvgFontWeight
&&
(
SvgFontWeight
)
value
==
SvgFontWeight
.
Inherit
)
||
(
value
is
SvgTextAnchor
&&
(
SvgTextAnchor
)
value
==
SvgTextAnchor
.
Inherit
)
||
(
value
is
SvgFontVariant
&&
(
SvgFontVariant
)
value
==
SvgFontVariant
.
Inherit
)
||
(
value
is
SvgTextDecoration
&&
(
SvgTextDecoration
)
value
==
SvgTextDecoration
.
Inherit
)
||
(
value
is
XmlSpaceHandling
&&
(
XmlSpaceHandling
)
value
==
XmlSpaceHandling
.
inherit
)
||
(
value
is
SvgOverflow
&&
(
SvgOverflow
)
value
==
SvgOverflow
.
i
nherit
)
||
(
value
is
SvgOverflow
&&
(
SvgOverflow
)
value
==
SvgOverflow
.
I
nherit
)
||
(
value
==
SvgColourServer
.
Inherit
)
||
(
value
is
string
&&
(
string
)
value
==
"inherit"
)
);
...
...
Source/SvgDocument.cs
View file @
67946913
...
...
@@ -475,7 +475,7 @@ namespace Svg
renderer
.
ScaleTransform
(
bitmap
.
Width
/
size
.
Width
,
bitmap
.
Height
/
size
.
Height
);
//EO, 2014-12-05: Requested to ensure proper zooming out (reduce size). Otherwise it clip the image.
this
.
Overflow
=
SvgOverflow
.
a
uto
;
this
.
Overflow
=
SvgOverflow
.
A
uto
;
this
.
Render
(
renderer
);
}
...
...
Source/SvgElement.cs
View file @
67946913
...
...
@@ -572,9 +572,11 @@ namespace Svg
(!
attr
.
Attribute
.
InAttributeDictionary
||
_attributes
.
ContainsKey
(
attr
.
Attribute
.
Name
)))
{
object
propertyValue
=
attr
.
Property
.
GetValue
(
this
);
string
value
=
(
string
)
attr
.
Property
.
Converter
.
ConvertTo
(
propertyValue
,
typeof
(
string
));
forceWrite
=
false
;
writeStyle
=
(
attr
.
Attribute
.
Name
==
"fill"
);
if
((
attr
.
Attribute
.
Name
==
"fill"
)
&&
(
Parent
!=
null
))
{
if
(
propertyValue
==
SvgColourServer
.
NotSet
)
continue
;
...
...
@@ -593,9 +595,9 @@ namespace Svg
if
(
propertyValue
!=
null
)
{
var
type
=
propertyValue
.
GetType
();
string
value
=
(
string
)
attr
.
Property
.
Converter
.
ConvertTo
(
propertyValue
,
typeof
(
string
));
if
(!
SvgDefaults
.
IsDefault
(
attr
.
Attribute
.
Name
,
value
)
||
forceWrite
)
//Only write the attribute's value if it is not the default value, not null/empty, or we're forcing the write.
if
(
(!
string
.
IsNullOrEmpty
(
value
)
&&
!
SvgDefaults
.
IsDefault
(
attr
.
Attribute
.
Name
,
value
)
)
||
forceWrite
)
{
if
(
writeStyle
)
{
...
...
@@ -609,7 +611,6 @@ namespace Svg
}
else
if
(
attr
.
Attribute
.
Name
==
"fill"
)
//if fill equals null, write 'none'
{
string
value
=
(
string
)
attr
.
Property
.
Converter
.
ConvertTo
(
propertyValue
,
typeof
(
string
));
if
(
writeStyle
)
{
styles
[
attr
.
Attribute
.
Name
]
=
value
;
...
...
Source/SvgElementStyle.cs
View file @
67946913
...
...
@@ -173,7 +173,7 @@ namespace Svg
[
SvgAttribute
(
"font-style"
,
true
)]
public
virtual
SvgFontStyle
FontStyle
{
get
{
return
(
this
.
Attributes
[
"font-style"
]
==
null
)
?
SvgFontStyle
.
inherit
:
(
SvgFontStyle
)
this
.
Attributes
[
"font-style"
];
}
get
{
return
(
this
.
Attributes
[
"font-style"
]
==
null
)
?
SvgFontStyle
.
All
:
(
SvgFontStyle
)
this
.
Attributes
[
"font-style"
];
}
set
{
this
.
Attributes
[
"font-style"
]
=
value
;
this
.
IsPathDirty
=
true
;
}
}
...
...
@@ -183,7 +183,7 @@ namespace Svg
[
SvgAttribute
(
"font-variant"
,
true
)]
public
virtual
SvgFontVariant
FontVariant
{
get
{
return
(
this
.
Attributes
[
"font-variant"
]
==
null
)
?
SvgFontVariant
.
i
nherit
:
(
SvgFontVariant
)
this
.
Attributes
[
"font-variant"
];
}
get
{
return
(
this
.
Attributes
[
"font-variant"
]
==
null
)
?
SvgFontVariant
.
I
nherit
:
(
SvgFontVariant
)
this
.
Attributes
[
"font-variant"
];
}
set
{
this
.
Attributes
[
"font-variant"
]
=
value
;
this
.
IsPathDirty
=
true
;
}
}
...
...
@@ -193,7 +193,7 @@ namespace Svg
[
SvgAttribute
(
"text-decoration"
,
true
)]
public
virtual
SvgTextDecoration
TextDecoration
{
get
{
return
(
this
.
Attributes
[
"text-decoration"
]
==
null
)
?
SvgTextDecoration
.
i
nherit
:
(
SvgTextDecoration
)
this
.
Attributes
[
"text-decoration"
];
}
get
{
return
(
this
.
Attributes
[
"text-decoration"
]
==
null
)
?
SvgTextDecoration
.
I
nherit
:
(
SvgTextDecoration
)
this
.
Attributes
[
"text-decoration"
];
}
set
{
this
.
Attributes
[
"text-decoration"
]
=
value
;
this
.
IsPathDirty
=
true
;
}
}
...
...
@@ -203,7 +203,7 @@ namespace Svg
[
SvgAttribute
(
"font-weight"
,
true
)]
public
virtual
SvgFontWeight
FontWeight
{
get
{
return
(
this
.
Attributes
[
"font-weight"
]
==
null
)
?
SvgFontWeight
.
i
nherit
:
(
SvgFontWeight
)
this
.
Attributes
[
"font-weight"
];
}
get
{
return
(
this
.
Attributes
[
"font-weight"
]
==
null
)
?
SvgFontWeight
.
I
nherit
:
(
SvgFontWeight
)
this
.
Attributes
[
"font-weight"
];
}
set
{
this
.
Attributes
[
"font-weight"
]
=
value
;
this
.
IsPathDirty
=
true
;
}
}
...
...
@@ -328,12 +328,12 @@ namespace Svg
// Get the font-weight
switch
(
this
.
FontWeight
)
{
case
SvgFontWeight
.
bold
:
case
SvgFontWeight
.
b
older
:
case
SvgFontWeight
.
w
600
:
case
SvgFontWeight
.
w
700
:
case
SvgFontWeight
.
w
800
:
case
SvgFontWeight
.
w
900
:
//Note: Bold is not listed because it is = W700.
case
SvgFontWeight
.
B
older
:
case
SvgFontWeight
.
W
600
:
case
SvgFontWeight
.
W
700
:
case
SvgFontWeight
.
W
800
:
case
SvgFontWeight
.
W
900
:
fontStyle
|=
System
.
Drawing
.
FontStyle
.
Bold
;
break
;
}
...
...
@@ -341,8 +341,8 @@ namespace Svg
// Get the font-style
switch
(
this
.
FontStyle
)
{
case
SvgFontStyle
.
i
talic
:
case
SvgFontStyle
.
o
blique
:
case
SvgFontStyle
.
I
talic
:
case
SvgFontStyle
.
O
blique
:
fontStyle
|=
System
.
Drawing
.
FontStyle
.
Italic
;
break
;
}
...
...
@@ -350,10 +350,10 @@ namespace Svg
// Get the text-decoration
switch
(
this
.
TextDecoration
)
{
case
SvgTextDecoration
.
l
ineThrough
:
case
SvgTextDecoration
.
L
ineThrough
:
fontStyle
|=
System
.
Drawing
.
FontStyle
.
Strikeout
;
break
;
case
SvgTextDecoration
.
u
nderline
:
case
SvgTextDecoration
.
U
nderline
:
fontStyle
|=
System
.
Drawing
.
FontStyle
.
Underline
;
break
;
}
...
...
Source/Text/SvgFontFace.cs
View file @
67946913
...
...
@@ -84,7 +84,7 @@ namespace Svg
[
SvgAttribute
(
"font-style"
)]
public
virtual
SvgFontStyle
FontStyle
{
get
{
return
(
this
.
Attributes
[
"font-style"
]
==
null
)
?
SvgFontStyle
.
inherit
:
(
SvgFontStyle
)
this
.
Attributes
[
"font-style"
];
}
get
{
return
(
this
.
Attributes
[
"font-style"
]
==
null
)
?
SvgFontStyle
.
All
:
(
SvgFontStyle
)
this
.
Attributes
[
"font-style"
];
}
set
{
this
.
Attributes
[
"font-style"
]
=
value
;
}
}
...
...
@@ -94,7 +94,7 @@ namespace Svg
[
SvgAttribute
(
"font-variant"
)]
public
virtual
SvgFontVariant
FontVariant
{
get
{
return
(
this
.
Attributes
[
"font-variant"
]
==
null
)
?
SvgFontVariant
.
i
nherit
:
(
SvgFontVariant
)
this
.
Attributes
[
"font-variant"
];
}
get
{
return
(
this
.
Attributes
[
"font-variant"
]
==
null
)
?
SvgFontVariant
.
I
nherit
:
(
SvgFontVariant
)
this
.
Attributes
[
"font-variant"
];
}
set
{
this
.
Attributes
[
"font-variant"
]
=
value
;
}
}
...
...
@@ -104,7 +104,7 @@ namespace Svg
[
SvgAttribute
(
"font-weight"
)]
public
virtual
SvgFontWeight
FontWeight
{
get
{
return
(
this
.
Attributes
[
"font-weight"
]
==
null
)
?
SvgFontWeight
.
i
nherit
:
(
SvgFontWeight
)
this
.
Attributes
[
"font-weight"
];
}
get
{
return
(
this
.
Attributes
[
"font-weight"
]
==
null
)
?
SvgFontWeight
.
I
nherit
:
(
SvgFontWeight
)
this
.
Attributes
[
"font-weight"
];
}
set
{
this
.
Attributes
[
"font-weight"
]
=
value
;
}
}
...
...
Source/Text/SvgTextAnchor.cs
View file @
67946913
...
...
@@ -12,7 +12,8 @@ namespace Svg
[
TypeConverter
(
typeof
(
SvgTextAnchorConverter
))]
public
enum
SvgTextAnchor
{
inherit
,
/// <summary>The value is inherited from the parent element.</summary>
Inherit
,
/// <summary>
/// The rendered characters are aligned such that the start of the text string is at the initial current text position.
/// </summary>
...
...
Source/Text/SvgTextBase.cs
View file @
67946913
...
...
@@ -36,7 +36,7 @@ namespace Svg
[
SvgAttribute
(
"text-anchor"
,
true
)]
public
virtual
SvgTextAnchor
TextAnchor
{
get
{
return
(
this
.
Attributes
[
"text-anchor"
]
==
null
)
?
SvgTextAnchor
.
i
nherit
:
(
SvgTextAnchor
)
this
.
Attributes
[
"text-anchor"
];
}
get
{
return
(
this
.
Attributes
[
"text-anchor"
]
==
null
)
?
SvgTextAnchor
.
I
nherit
:
(
SvgTextAnchor
)
this
.
Attributes
[
"text-anchor"
];
}
set
{
this
.
Attributes
[
"text-anchor"
]
=
value
;
this
.
IsPathDirty
=
true
;
}
}
...
...
@@ -167,7 +167,7 @@ namespace Svg
[
SvgAttribute
(
"lengthAdjust"
,
true
)]
public
virtual
SvgTextLengthAdjust
LengthAdjust
{
get
{
return
(
this
.
Attributes
[
"lengthAdjust"
]
==
null
)
?
SvgTextLengthAdjust
.
s
pacing
:
(
SvgTextLengthAdjust
)
this
.
Attributes
[
"lengthAdjust"
];
}
get
{
return
(
this
.
Attributes
[
"lengthAdjust"
]
==
null
)
?
SvgTextLengthAdjust
.
S
pacing
:
(
SvgTextLengthAdjust
)
this
.
Attributes
[
"lengthAdjust"
];
}
set
{
this
.
Attributes
[
"lengthAdjust"
]
=
value
;
this
.
IsPathDirty
=
true
;
}
}
...
...
@@ -366,7 +366,7 @@ namespace Svg
var
diff
=
(
actLength
-
specLength
);
if
(
Math
.
Abs
(
diff
)
>
1.5
)
{
if
(
this
.
LengthAdjust
==
SvgTextLengthAdjust
.
s
pacing
)
if
(
this
.
LengthAdjust
==
SvgTextLengthAdjust
.
S
pacing
)
{
origState
.
LetterSpacingAdjust
=
-
1
*
diff
/
(
state
.
NumChars
-
origState
.
NumChars
-
1
);
SetPath
(
origState
,
false
);
...
...
Source/Text/SvgTextPath.cs
View file @
67946913
...
...
@@ -42,14 +42,14 @@ namespace Svg
[
SvgAttribute
(
"method"
)]
public
virtual
SvgTextPathMethod
Method
{
get
{
return
(
this
.
Attributes
[
"method"
]
==
null
?
SvgTextPathMethod
.
a
lign
:
(
SvgTextPathMethod
)
this
.
Attributes
[
"method"
]);
}
get
{
return
(
this
.
Attributes
[
"method"
]
==
null
?
SvgTextPathMethod
.
A
lign
:
(
SvgTextPathMethod
)
this
.
Attributes
[
"method"
]);
}
set
{
this
.
Attributes
[
"method"
]
=
value
;
}
}
[
SvgAttribute
(
"spacing"
)]
public
virtual
SvgTextPathSpacing
Spacing
{
get
{
return
(
this
.
Attributes
[
"spacing"
]
==
null
?
SvgTextPathSpacing
.
e
xact
:
(
SvgTextPathSpacing
)
this
.
Attributes
[
"spacing"
]);
}
get
{
return
(
this
.
Attributes
[
"spacing"
]
==
null
?
SvgTextPathSpacing
.
E
xact
:
(
SvgTextPathSpacing
)
this
.
Attributes
[
"spacing"
]);
}
set
{
this
.
Attributes
[
"spacing"
]
=
value
;
}
}
...
...
Prev
1
2
Next
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment