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
a653b4a4
Commit
a653b4a4
authored
Sep 23, 2014
by
Tebjan Halm
Browse files
Merge pull request #99 from skyguy94/FixForNullPath
Fix for null path
parents
1818255b
909fc1f8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Source/Text/SvgTextBase.cs
View file @
a653b4a4
...
@@ -293,19 +293,16 @@ namespace Svg
...
@@ -293,19 +293,16 @@ namespace Svg
/// Gets the <see cref="GraphicsPath"/> for this element.
/// Gets the <see cref="GraphicsPath"/> for this element.
/// </summary>
/// </summary>
/// <value></value>
/// <value></value>
public
override
System
.
Drawing
.
Drawing2D
.
GraphicsPath
Path
(
ISvgRenderer
renderer
)
public
override
GraphicsPath
Path
(
ISvgRenderer
renderer
)
{
{
// Make sure the path is always null if there is no text
//if there is a TSpan inside of this text element then path should not be null (even if this text is empty!)
//if there is a TSpan inside of this text element then path should not be null (even if this text is empty!)
var
nodes
=
this
.
GetContentNodes
().
ToList
();
var
nodes
=
GetContentNodes
().
Where
(
x
=>
x
is
SvgContentNode
&&
if
(
nodes
.
Count
<
1
)
return
_path
=
null
;
string
.
IsNullOrEmpty
(
x
.
Content
.
Trim
(
new
[]
{
'\r'
,
'\n'
,
'\t'
})));
if
(
nodes
.
Count
==
1
&&
nodes
[
0
]
is
SvgContentNode
&&
(
string
.
IsNullOrEmpty
(
nodes
[
0
].
Content
)
||
nodes
[
0
].
Content
.
Trim
().
Length
<
1
))
return
_path
=
null
;
if
(
_path
==
null
||
this
.
IsPathDirty
)
if
(
_path
==
null
||
IsPathDirty
||
nodes
.
Count
()
==
1
)
{
{
renderer
=
(
renderer
??
SvgRenderer
.
FromNull
());
renderer
=
(
renderer
??
SvgRenderer
.
FromNull
());
this
.
SetPath
(
new
TextDrawingState
(
renderer
,
this
));
SetPath
(
new
TextDrawingState
(
renderer
,
this
));
}
}
return
_path
;
return
_path
;
}
}
...
...
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