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
9b224b2b
Commit
9b224b2b
authored
Sep 23, 2014
by
Ritch Melton
Browse files
Fixed up empty string fix
parent
1585c700
Changes
1
Hide whitespace changes
Inline
Side-by-side
Source/Text/SvgTextBase.cs
View file @
9b224b2b
...
@@ -293,23 +293,16 @@ namespace Svg
...
@@ -293,23 +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
;
.
Select
(
n
=>
string
.
IsNullOrEmpty
(
n
.
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
;
//When an empty string is passed to GraphicsPath, it raises an InvalidArgumentException.
if
(
_path
==
null
||
IsPathDirty
||
nodes
.
Any
())
//if there is a TSpan inside of this text element then path should not be null (even if this text is empty!)
var
isInvalidText
=
string
.
IsNullOrEmpty
(
Text
)
&&
!
Children
.
Any
(
x
=>
x
is
SvgContentNode
);
if
(
_path
==
null
||
IsPathDirty
||
isInvalidText
)
{
{
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