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
9521956d
Commit
9521956d
authored
Jul 02, 2014
by
Tebjan Halm
Committed by
Eric Domke
Jul 24, 2014
Browse files
Revert ".Net 3.5 Support and Rendering Improvements (Markers, TSpans, Paths, etc.)"
parent
2261cfdb
Changes
67
Hide whitespace changes
Inline
Side-by-side
Source/TestResults/eric.domke_G5130 2014-06-30 16_56_29.trx
deleted
100644 → 0
View file @
2261cfdb
<?xml version="1.0" encoding="UTF-8"?>
<TestRun
id=
"a578ea20-3d1e-4706-80f7-ef51fc03f8a0"
name=
"eric.domke@G5130 2014-06-30 16:56:29"
runUser=
"WONDERLAN\eric.domke"
xmlns=
"http://microsoft.com/schemas/VisualStudio/TeamTest/2010"
>
<TestSettings
name=
"Local"
id=
"ad4d99d5-165f-493c-9b8f-937d51b9a02a"
>
<Description>
These are default test settings for a local test run.
</Description>
<Deployment
userDeploymentRoot=
"C:\Users\edomke\Documents\GitHub\SVG\Source\TestResults"
useDefaultDeploymentRoot=
"false"
enabled=
"false"
runDeploymentRoot=
"eric.domke_G5130 2014-06-30 16_56_29"
>
<DeploymentItem
filename=
"C:\Users\edomke\Documents\GitHub\vvvv\public\common\src\thirdparty\Svg.dll"
/>
</Deployment>
<Execution>
<TestTypeSpecific
/>
<AgentRule
name=
"Execution Agents"
>
</AgentRule>
</Execution>
</TestSettings>
<Times
creation=
"2014-06-30T16:56:29.0230709-04:00"
queuing=
"2014-06-30T16:56:30.9962682-04:00"
start=
"2014-06-30T16:56:31.1392825-04:00"
finish=
"2014-06-30T16:56:35.7357421-04:00"
/>
<ResultSummary
outcome=
"Completed"
>
<Counters
total=
"1"
executed=
"1"
passed=
"1"
error=
"0"
failed=
"0"
timeout=
"0"
aborted=
"0"
inconclusive=
"0"
passedButRunAborted=
"0"
notRunnable=
"0"
notExecuted=
"0"
disconnected=
"0"
warning=
"0"
completed=
"0"
inProgress=
"0"
pending=
"0"
/>
</ResultSummary>
<TestDefinitions>
<UnitTest
name=
"TestDescendants"
storage=
"c:\users\edomke\documents\github\svg\source\svg.unittests\bin\debug\svg.unittests.dll"
id=
"2422b99b-f3cc-d94b-5c30-c25d9ff9e9a3"
>
<Execution
id=
"6e136fc3-49ee-410b-83cc-2b92e6c33668"
/>
<TestMethod
codeBase=
"C:/Users/edomke/Documents/GitHub/SVG/Source/Svg.UnitTests/bin/Debug/Svg.UnitTests.DLL"
adapterTypeName=
"Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestAdapter, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.Adapter, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
className=
"Svg.UnitTests.ExtensionsTest, Svg.UnitTests, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"
name=
"TestDescendants"
/>
</UnitTest>
</TestDefinitions>
<TestLists>
<TestList
name=
"Results Not in a List"
id=
"8c84fa94-04c1-424b-9868-57a2d4851a1d"
/>
<TestList
name=
"All Loaded Results"
id=
"19431567-8539-422a-85d7-44ee4e166bda"
/>
</TestLists>
<TestEntries>
<TestEntry
testId=
"2422b99b-f3cc-d94b-5c30-c25d9ff9e9a3"
executionId=
"6e136fc3-49ee-410b-83cc-2b92e6c33668"
testListId=
"8c84fa94-04c1-424b-9868-57a2d4851a1d"
/>
</TestEntries>
<Results>
<UnitTestResult
executionId=
"6e136fc3-49ee-410b-83cc-2b92e6c33668"
testId=
"2422b99b-f3cc-d94b-5c30-c25d9ff9e9a3"
testName=
"TestDescendants"
computerName=
"G5130"
duration=
"00:00:02.8171618"
startTime=
"2014-06-30T16:56:31.3173003-04:00"
endTime=
"2014-06-30T16:56:35.6667352-04:00"
testType=
"13cdc9d9-ddb5-4fa4-a97d-d965ccfc6d4b"
outcome=
"Passed"
testListId=
"8c84fa94-04c1-424b-9868-57a2d4851a1d"
relativeResultsDirectory=
"6e136fc3-49ee-410b-83cc-2b92e6c33668"
>
<Output>
<DebugTrace>
SvgDefinitionList
SvgLinearGradientServer
SvgGradientStop
SvgGradientStop
SvgGradientStop
SvgGradientStop
SvgGradientStop
SvgLinearGradientServer
SvgGradientStop
SvgGradientStop
SvgGradientStop
SvgGradientStop
SvgGradientStop
SvgLinearGradientServer
SvgGradientStop
SvgGradientStop
SvgGradientStop
SvgGradientStop
SvgGradientStop
SvgLinearGradientServer
SvgLinearGradientServer
SvgLinearGradientServer
SvgLinearGradientServer
SvgFilter
SvgGaussianBlur
SvgFilter
SvgGaussianBlur
SvgFilter
SvgGaussianBlur
SvgLinearGradientServer
SvgGradientStop
SvgGradientStop
SvgLinearGradientServer
SvgLinearGradientServer
SvgGradientStop
SvgGradientStop
SvgLinearGradientServer
SvgGradientStop
SvgGradientStop
SvgLinearGradientServer
SvgLinearGradientServer
SvgGradientStop
SvgGradientStop
SvgLinearGradientServer
SvgLinearGradientServer
SvgGradientStop
SvgGradientStop
SvgLinearGradientServer
SvgGradientStop
SvgGradientStop
SvgLinearGradientServer
SvgPath
SvgClipPath
SvgUse
SvgPath
SvgClipPath
SvgUse
SvgPath
SvgClipPath
SvgUse
SvgPath
SvgClipPath
SvgUse
SvgPath
SvgClipPath
SvgUse
SvgPath
SvgClipPath
SvgUse
SvgLinearGradientServer
SvgGradientStop
SvgGradientStop
SvgLinearGradientServer
SvgLinearGradientServer
SvgGradientStop
SvgGradientStop
SvgLinearGradientServer
SvgGradientStop
SvgGradientStop
SvgLinearGradientServer
SvgLinearGradientServer
SvgLinearGradientServer
SvgGradientStop
SvgGradientStop
SvgLinearGradientServer
SvgDocumentMetadata
SvgGroup
SvgGroup
SvgPath
SvgPath
SvgPath
SvgRectangle
SvgPath
SvgPath
SvgPath
SvgRectangle
SvgPath
SvgRectangle
SvgRectangle
SvgRectangle
SvgRectangle
SvgRectangle
SvgPath
SvgPath
SvgRectangle
SvgPath
SvgRectangle
SvgPath
SvgPath
SvgPath
SvgPath
SvgText
SvgTextSpan
SvgPath
SvgPath
SvgPath
SvgPath
SvgGroup
SvgPath
SvgPath
SvgText
SvgTextSpan
SvgPath
SvgPath
SvgPath
SvgPath
SvgPath
SvgPath
</DebugTrace>
</Output>
</UnitTestResult>
</Results>
</TestRun>
\ No newline at end of file
Source/TestResults/eric.domke_G5130 2014-06-30 16_57_50.trx
deleted
100644 → 0
View file @
2261cfdb
<?xml version="1.0" encoding="UTF-8"?>
<TestRun
id=
"c9ca8274-0dac-446a-be51-5f2bfd5bb8b7"
name=
"eric.domke@G5130 2014-06-30 16:57:50"
runUser=
"WONDERLAN\eric.domke"
xmlns=
"http://microsoft.com/schemas/VisualStudio/TeamTest/2010"
>
<TestSettings
name=
"Local"
id=
"ad4d99d5-165f-493c-9b8f-937d51b9a02a"
>
<Description>
These are default test settings for a local test run.
</Description>
<Deployment
enabled=
"false"
runDeploymentRoot=
"eric.domke_G5130 2014-06-30 16_57_50"
>
<DeploymentItem
filename=
"C:\Users\edomke\Documents\GitHub\vvvv\public\common\src\thirdparty\Svg.dll"
/>
</Deployment>
<Execution>
<TestTypeSpecific
/>
<AgentRule
name=
"Execution Agents"
>
</AgentRule>
</Execution>
</TestSettings>
<Times
creation=
"2014-06-30T16:57:50.3362014-04:00"
queuing=
"2014-06-30T16:57:50.9392617-04:00"
start=
"2014-06-30T16:57:50.9632641-04:00"
finish=
"2014-06-30T16:57:51.7163394-04:00"
/>
<ResultSummary
outcome=
"Completed"
>
<Counters
total=
"1"
executed=
"1"
passed=
"1"
error=
"0"
failed=
"0"
timeout=
"0"
aborted=
"0"
inconclusive=
"0"
passedButRunAborted=
"0"
notRunnable=
"0"
notExecuted=
"0"
disconnected=
"0"
warning=
"0"
completed=
"0"
inProgress=
"0"
pending=
"0"
/>
</ResultSummary>
<TestDefinitions>
<UnitTest
name=
"TestDescendants"
storage=
"c:\users\edomke\documents\github\svg\source\svg.unittests\bin\debug\svg.unittests.dll"
id=
"2422b99b-f3cc-d94b-5c30-c25d9ff9e9a3"
>
<Execution
id=
"59a9af8c-e6cb-4be7-9189-68cbbb5aa13b"
/>
<TestMethod
codeBase=
"C:/Users/edomke/Documents/GitHub/SVG/Source/Svg.UnitTests/bin/Debug/Svg.UnitTests.DLL"
adapterTypeName=
"Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestAdapter, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.Adapter, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
className=
"Svg.UnitTests.ExtensionsTest, Svg.UnitTests, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"
name=
"TestDescendants"
/>
</UnitTest>
</TestDefinitions>
<TestLists>
<TestList
name=
"Results Not in a List"
id=
"8c84fa94-04c1-424b-9868-57a2d4851a1d"
/>
<TestList
name=
"All Loaded Results"
id=
"19431567-8539-422a-85d7-44ee4e166bda"
/>
</TestLists>
<TestEntries>
<TestEntry
testId=
"2422b99b-f3cc-d94b-5c30-c25d9ff9e9a3"
executionId=
"59a9af8c-e6cb-4be7-9189-68cbbb5aa13b"
testListId=
"8c84fa94-04c1-424b-9868-57a2d4851a1d"
/>
</TestEntries>
<Results>
<UnitTestResult
executionId=
"59a9af8c-e6cb-4be7-9189-68cbbb5aa13b"
testId=
"2422b99b-f3cc-d94b-5c30-c25d9ff9e9a3"
testName=
"TestDescendants"
computerName=
"G5130"
duration=
"00:00:00.0161522"
startTime=
"2014-06-30T16:57:50.9782656-04:00"
endTime=
"2014-06-30T16:57:51.3513029-04:00"
testType=
"13cdc9d9-ddb5-4fa4-a97d-d965ccfc6d4b"
outcome=
"Passed"
testListId=
"8c84fa94-04c1-424b-9868-57a2d4851a1d"
relativeResultsDirectory=
"59a9af8c-e6cb-4be7-9189-68cbbb5aa13b"
>
<Output>
<DebugTrace>
SvgDefinitionList
SvgLinearGradientServer
SvgGradientStop
SvgGradientStop
SvgGradientStop
SvgGradientStop
SvgGradientStop
SvgLinearGradientServer
SvgGradientStop
SvgGradientStop
SvgGradientStop
SvgGradientStop
SvgGradientStop
SvgLinearGradientServer
SvgGradientStop
SvgGradientStop
SvgGradientStop
SvgGradientStop
SvgGradientStop
SvgLinearGradientServer
SvgLinearGradientServer
SvgLinearGradientServer
SvgLinearGradientServer
SvgFilter
SvgGaussianBlur
SvgFilter
SvgGaussianBlur
SvgFilter
SvgGaussianBlur
SvgLinearGradientServer
SvgGradientStop
SvgGradientStop
SvgLinearGradientServer
SvgLinearGradientServer
SvgGradientStop
SvgGradientStop
SvgLinearGradientServer
SvgGradientStop
SvgGradientStop
SvgLinearGradientServer
SvgLinearGradientServer
SvgGradientStop
SvgGradientStop
SvgLinearGradientServer
SvgLinearGradientServer
SvgGradientStop
SvgGradientStop
SvgLinearGradientServer
SvgGradientStop
SvgGradientStop
SvgLinearGradientServer
SvgPath
SvgClipPath
SvgUse
SvgPath
SvgClipPath
SvgUse
SvgPath
SvgClipPath
SvgUse
SvgPath
SvgClipPath
SvgUse
SvgPath
SvgClipPath
SvgUse
SvgPath
SvgClipPath
SvgUse
SvgLinearGradientServer
SvgGradientStop
SvgGradientStop
SvgLinearGradientServer
SvgLinearGradientServer
SvgGradientStop
SvgGradientStop
SvgLinearGradientServer
SvgGradientStop
SvgGradientStop
SvgLinearGradientServer
SvgLinearGradientServer
SvgLinearGradientServer
SvgGradientStop
SvgGradientStop
SvgLinearGradientServer
SvgDocumentMetadata
SvgGroup
SvgGroup
SvgPath
SvgPath
SvgPath
SvgRectangle
SvgPath
SvgPath
SvgPath
SvgRectangle
SvgPath
SvgRectangle
SvgRectangle
SvgRectangle
SvgRectangle
SvgRectangle
SvgPath
SvgPath
SvgRectangle
SvgPath
SvgRectangle
SvgPath
SvgPath
SvgPath
SvgPath
SvgText
SvgTextSpan
SvgPath
SvgPath
SvgPath
SvgPath
SvgGroup
SvgPath
SvgPath
SvgText
SvgTextSpan
SvgPath
SvgPath
SvgPath
SvgPath
SvgPath
SvgPath
</DebugTrace>
</Output>
</UnitTestResult>
</Results>
</TestRun>
\ No newline at end of file
Source/TestResults/eric.domke_G5130 2014-06-30 16_57_50/Out/AgentRestart.dat
deleted
100644 → 0
View file @
2261cfdb
File deleted
Source/Text/FontData.cs
deleted
100644 → 0
View file @
2261cfdb
using
System
;
using
System.Collections.Generic
;
using
System.Drawing
;
using
System.Linq
;
using
System.Text
;
using
Svg.DataTypes
;
using
System.Text.RegularExpressions
;
namespace
Svg
{
internal
class
FontData
{
private
SvgUnit
_fontSize
;
private
SvgFontWeight
_fontWeight
=
SvgFontWeight
.
inherit
;
private
string
_font
;
private
string
_fontFamily
;
private
const
string
DefaultFontFamily
=
"Times New Roman"
;
public
FontData
()
{
this
.
_fontSize
=
new
SvgUnit
(
0.0f
);
}
/// <summary>
/// Indicates which font family is to be used to render the text.
/// </summary>
public
virtual
string
FontFamily
{
get
{
return
this
.
_fontFamily
??
DefaultFontFamily
;
}
set
{
this
.
_fontFamily
=
ValidateFontFamily
(
value
);
}
}
/// <summary>
/// Refers to the size of the font from baseline to baseline when multiple lines of text are set solid in a multiline layout environment.
/// </summary>
public
virtual
SvgUnit
FontSize
{
get
{
return
this
.
_fontSize
;
}
set
{
this
.
_fontSize
=
value
;
}
}
/// <summary>
/// Refers to the boldness of the font.
/// </summary>
public
virtual
SvgFontWeight
FontWeight
{
get
{
return
this
.
_fontWeight
;
}
set
{
this
.
_fontWeight
=
value
;
}
}
/// <summary>
/// Set all font information.
/// </summary>
public
string
Font
{
get
{
return
this
.
_font
;
}
set
{
var
parts
=
value
.
Split
(
','
);
foreach
(
var
part
in
parts
)
{
//This deals with setting font size. Looks for either <number>px or <number>pt style="font: bold 16px/normal 'trebuchet ms', verdana, sans-serif;"
Regex
rx
=
new
Regex
(
@"(\d+)+(?=pt|px)"
);
var
res
=
rx
.
Match
(
part
);
if
(
res
.
Success
)
{
int
fontSize
=
10
;
int
.
TryParse
(
res
.
Value
,
out
fontSize
);
this
.
FontSize
=
new
SvgUnit
((
float
)
fontSize
);
}
//this assumes "bold" has spaces around it. e.g.: style="font: bold 16px/normal
rx
=
new
Regex
(
@"\sbold\s"
);
res
=
rx
.
Match
(
part
);
if
(
res
.
Success
)
{
this
.
FontWeight
=
SvgFontWeight
.
bold
;
}
}
var
font
=
ValidateFontFamily
(
value
);
this
.
_fontFamily
=
font
;
this
.
_font
=
font
;
//not sure this is used?
}
}
public
Font
GetFont
(
ISvgStylable
owner
,
FontData
inherit
)
{
float
fontSize
=
this
.
FontSize
.
ToDeviceValue
(
owner
);
if
(
fontSize
==
0.0f
)
{
fontSize
=
(
inherit
==
null
?
1.0f
:
inherit
.
FontSize
.
ToDeviceValue
(
owner
));
fontSize
=
(
fontSize
==
0.0f
?
1.0f
:
fontSize
);
}
var
baseWeight
=
(
_fontWeight
==
SvgFontWeight
.
inherit
&&
inherit
!=
null
?
inherit
.
FontWeight
:
_fontWeight
);
var
fontWeight
=
(
baseWeight
==
SvgFontWeight
.
bold
?
FontStyle
.
Bold
:
FontStyle
.
Regular
);
var
family
=
_fontFamily
??
(
inherit
==
null
?
DefaultFontFamily
:
inherit
.
FontFamily
);
return
new
Font
(
family
,
fontSize
,
fontWeight
,
GraphicsUnit
.
Pixel
);
}
private
static
string
ValidateFontFamily
(
string
fontFamilyList
)
{
// Split font family list on "," and then trim start and end spaces and quotes.
var
fontParts
=
fontFamilyList
.
Split
(
new
[]
{
','
}).
Select
(
fontName
=>
fontName
.
Trim
(
new
[]
{
'"'
,
' '
,
'\''
}));
var
families
=
System
.
Drawing
.
FontFamily
.
Families
;
// Find a the first font that exists in the list of installed font families.
//styles from IE get sent through as lowercase.
foreach
(
var
f
in
fontParts
.
Where
(
f
=>
families
.
Any
(
family
=>
family
.
Name
.
ToLower
()
==
f
.
ToLower
())))
{
return
f
;
}
// No valid font family found from the list requested.
return
null
;
}
public
override
bool
Equals
(
object
obj
)
{
var
thisType
=
obj
as
FontData
;
if
(
thisType
!=
null
)
return
Equals
(
thisType
);
return
base
.
Equals
(
obj
);
}
public
bool
Equals
(
FontData
obj
)
{
return
obj
.
_fontFamily
==
this
.
_fontFamily
&&
obj
.
_fontSize
==
this
.
_fontSize
&&
obj
.
_fontWeight
==
this
.
_fontWeight
;
}
public
override
int
GetHashCode
()
{
return
(
this
.
_fontFamily
==
null
?
0
:
this
.
_fontFamily
.
GetHashCode
())
^
(
this
.
_fontSize
==
null
?
0
:
this
.
_fontSize
.
GetHashCode
())
^
this
.
_fontWeight
.
GetHashCode
();
}
}
}
Source/Text/SvgText.cs
View file @
9521956d
...
...
@@ -23,7 +23,10 @@ namespace Svg
private
SvgUnit
_dx
;
private
SvgUnit
_letterSpacing
;
private
SvgUnit
_wordSpacing
;
private
FontData
_fontData
;
private
SvgUnit
_fontSize
;
private
SvgFontWeight
_fontWeight
;
private
string
_font
;
private
string
_fontFamily
;
private
GraphicsPath
_path
;
private
SvgTextAnchor
_textAnchor
=
SvgTextAnchor
.
Start
;
private
static
readonly
SvgRenderer
_stringMeasure
;
...
...
@@ -44,7 +47,8 @@ namespace Svg
/// </summary>
public
SvgText
()
{
this
.
_fontData
=
new
FontData
();
this
.
_fontFamily
=
DefaultFontFamily
;
this
.
_fontSize
=
new
SvgUnit
(
0.0f
);
this
.
_dy
=
new
SvgUnit
(
0.0f
);
this
.
_dx
=
new
SvgUnit
(
0.0f
);
}
...
...
@@ -180,8 +184,12 @@ namespace Svg
[
SvgAttribute
(
"font-family"
)]
public
virtual
string
FontFamily
{
get
{
return
this
.
_fontData
.
FontFamily
;
}
set
{
this
.
_fontData
.
FontFamily
=
value
;
this
.
IsPathDirty
=
true
;
}
get
{
return
this
.
_fontFamily
;
}
set
{
this
.
_fontFamily
=
ValidateFontFamily
(
value
);
this
.
IsPathDirty
=
true
;
}
}
/// <summary>
...
...
@@ -190,8 +198,8 @@ namespace Svg
[
SvgAttribute
(
"font-size"
)]
public
virtual
SvgUnit
FontSize
{
get
{
return
this
.
_font
Data
.
Font
Size
;
}
set
{
this
.
_font
Data
.
Font
Size
=
value
;
this
.
IsPathDirty
=
true
;
}
get
{
return
this
.
_fontSize
;
}
set
{
this
.
_fontSize
=
value
;
this
.
IsPathDirty
=
true
;
}
}
...
...
@@ -201,8 +209,8 @@ namespace Svg
[
SvgAttribute
(
"font-weight"
)]
public
virtual
SvgFontWeight
FontWeight
{
get
{
return
this
.
_font
Data
.
Font
Weight
;
}
set
{
this
.
_font
Data
.
Font
Weight
=
value
;
this
.
IsPathDirty
=
true
;
}
get
{
return
this
.
_fontWeight
;
}
set
{
this
.
_fontWeight
=
value
;
this
.
IsPathDirty
=
true
;
}
}
...
...
@@ -212,8 +220,36 @@ namespace Svg
[
SvgAttribute
(
"font"
)]
public
virtual
string
Font
{
get
{
return
this
.
_fontData
.
Font
;
}
set
{
_fontData
.
Font
=
value
;
this
.
IsPathDirty
=
true
;
}
get
{
return
this
.
_font
;
}
set
{
var
parts
=
value
.
Split
(
','
);
foreach
(
var
part
in
parts
)
{
//This deals with setting font size. Looks for either <number>px or <number>pt style="font: bold 16px/normal 'trebuchet ms', verdana, sans-serif;"
Regex
rx
=
new
Regex
(
@"(\d+)+(?=pt|px)"
);
var
res
=
rx
.
Match
(
part
);
if
(
res
.
Success
)
{
int
fontSize
=
10
;
int
.
TryParse
(
res
.
Value
,
out
fontSize
);
this
.
FontSize
=
new
SvgUnit
((
float
)
fontSize
);
}
//this assumes "bold" has spaces around it. e.g.: style="font: bold 16px/normal
rx
=
new
Regex
(
@"\sbold\s"
);
res
=
rx
.
Match
(
part
);
if
(
res
.
Success
)
{
this
.
FontWeight
=
SvgFontWeight
.
bold
;
}
}
var
font
=
ValidateFontFamily
(
value
);
this
.
_fontFamily
=
font
;
this
.
_font
=
font
;
//not sure this is used?
this
.
IsPathDirty
=
true
;
}
}
/// <summary>
...
...
@@ -225,17 +261,7 @@ namespace Svg
/// <value>The fill.</value>
public
override
SvgPaintServer
Fill
{
get
{
var
spans
=
this
.
Children
.
Where
(
x
=>
x
is
SvgTextSpan
).
Select
(
x
=>
x
as
SvgTextSpan
).
ToList
();
if
(
spans
.
Count
==
1
&&
spans
[
0
].
Fill
!=
SvgColourServer
.
NotSet
)
{
return
spans
[
0
].
Fill
;
}
else
{
return
(
this
.
Attributes
[
"fill"
]
==
null
)
?
new
SvgColourServer
(
Color
.
Black
)
:
(
SvgPaintServer
)
this
.
Attributes
[
"fill"
];
}
}
get
{
return
(
this
.
Attributes
[
"fill"
]
==
null
)
?
new
SvgColourServer
(
Color
.
Black
)
:
(
SvgPaintServer
)
this
.
Attributes
[
"fill"
];
}
set
{
this
.
Attributes
[
"fill"
]
=
value
;
}
}
...
...
@@ -287,48 +313,40 @@ namespace Svg
{
// 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
(
(
string
.
IsNullOr
Empty
(
this
.
Text
)
||
this
.
Text
.
Trim
().
Length
<
1
)
&&
this
.
Children
.
Where
(
x
=>
x
is
SvgTextSpan
).
Select
(
x
=>
x
as
SvgTextSpan
).
Count
()
==
0
)
if
(
string
.
IsNullOr
WhiteSpace
(
this
.
Text
)
&&
this
.
Children
.
Where
(
x
=>
x
is
SvgTextSpan
).
Select
(
x
=>
x
as
SvgTextSpan
).
Count
()
==
0
)
return
_path
=
null
;
//NOT SURE WHAT THIS IS ABOUT - Path gets created again anyway - WTF?
// When an empty string is passed to GraphicsPath, it rises an InvalidArgumentException...
if
(
_path
==
null
||
this
.
IsPathDirty
)
{
var
font
=
this
.
_fontData
.
GetFont
(
this
,
null
);
float
fontSize
=
this
.
FontSize
.
ToDeviceValue
(
this
);
if
(
fontSize
==
0.0f
)
{
fontSize
=
1.0f
;
}
FontStyle
fontWeight
=
(
this
.
FontWeight
==
SvgFontWeight
.
bold
?
FontStyle
.
Bold
:
FontStyle
.
Regular
);
Font
font
=
new
Font
(
this
.
_fontFamily
,
fontSize
,
fontWeight
,
GraphicsUnit
.
Pixel
);
_path
=
new
GraphicsPath
();
_path
.
StartFigure
();
if
(!
string
.
IsNullOrEmpty
(
this
.
Text
))
DrawString
(
_path
,
this
.
X
,
this
.
Y
,
this
.
Dx
,
this
.
Dy
,
font
,
this
.
Text
);
DrawString
(
_path
,
this
.
X
,
this
.
Y
,
this
.
Dx
,
this
.
Dy
,
font
,
fontSize
,
this
.
Text
);
foreach
(
var
tspan
in
this
.
Children
.
Where
(
x
=>
x
is
SvgTextSpan
).
Select
(
x
=>
x
as
SvgTextSpan
))
{
if
(!
string
.
IsNullOrEmpty
(
tspan
.
Text
))
{
if
(
tspan
.
FontInfo
.
Equals
(
this
.
_fontData
))
{
DrawString
(
_path
,
tspan
.
X
==
SvgUnit
.
Empty
?
this
.
X
:
tspan
.
X
,
tspan
.
Y
==
SvgUnit
.
Empty
?
this
.
Y
:
tspan
.
Y
,
tspan
.
DX
,
tspan
.
DY
,
font
,
tspan
.
Text
);
}
else
{
DrawString
(
_path
,
tspan
.
X
==
SvgUnit
.
Empty
?
this
.
X
:
tspan
.
X
,
tspan
.
Y
==
SvgUnit
.
Empty
?
this
.
Y
:
tspan
.
Y
,
tspan
.
DX
,
tspan
.
DY
,
tspan
.
FontInfo
.
GetFont
(
this
,
_fontData
),
tspan
.
Text
);
}
}
if
(!
string
.
IsNullOrEmpty
(
tspan
.
Text
))
DrawString
(
_path
,
tspan
.
X
==
SvgUnit
.
Empty
?
this
.
X
:
tspan
.
X
,
tspan
.
Y
==
SvgUnit
.
Empty
?
this
.
Y
:
tspan
.
Y
,
tspan
.
DX
,
tspan
.
DY
,
font
,
fontSize
,
tspan
.
Text
);
}
_path
.
CloseFigure
();
...
...
@@ -359,9 +377,9 @@ namespace Svg
return
DefaultFontFamily
;
}
private
void
DrawString
(
GraphicsPath
path
,
SvgUnit
x
,
SvgUnit
y
,
SvgUnit
dx
,
SvgUnit
dy
,
Font
font
,
string
text
)
private
void
DrawString
(
GraphicsPath
path
,
SvgUnit
x
,
SvgUnit
y
,
SvgUnit
dx
,
SvgUnit
dy
,
Font
font
,
float
fontSize
,
string
text
)
{
PointF
location
=
PointF
.
Empty
;
PointF
location
=
PointF
.
Empty
;
SizeF
stringBounds
;
lock
(
_stringMeasure
)
...
...
@@ -403,13 +421,13 @@ namespace Svg
char
[]
characters
=
word
.
ToCharArray
();
foreach
(
char
currentCharacter
in
characters
)
{
path
.
AddString
(
currentCharacter
.
ToString
(),
font
.
F
ontFamily
,
(
int
)
font
.
Style
,
font
.
Size
,
location
,
StringFormat
.
GenericTypographic
);
path
.
AddString
(
currentCharacter
.
ToString
(),
new
FontFamily
(
this
.
_f
ontFamily
)
,
(
int
)
font
.
Style
,
fontSize
,
location
,
StringFormat
.
GenericTypographic
);
location
=
new
PointF
(
path
.
GetBounds
().
Width
+
start
+
letterSpacing
,
location
.
Y
);
}
}
else
{
path
.
AddString
(
word
,
font
.
F
ontFamily
,
(
int
)
font
.
Style
,
font
.
Size
,
location
,
StringFormat
.
GenericTypographic
);
path
.
AddString
(
word
,
new
FontFamily
(
this
.
_f
ontFamily
)
,
(
int
)
font
.
Style
,
fontSize
,
location
,
StringFormat
.
GenericTypographic
);
}
// Move the location of the word to be written along
...
...
@@ -420,7 +438,7 @@ namespace Svg
{
if
(!
string
.
IsNullOrEmpty
(
text
))
{
path
.
AddString
(
text
,
font
.
F
ontFamily
,
(
int
)
font
.
Style
,
font
.
Size
,
location
,
StringFormat
.
GenericTypographic
);
path
.
AddString
(
text
,
new
FontFamily
(
this
.
_f
ontFamily
)
,
(
int
)
font
.
Style
,
fontSize
,
location
,
StringFormat
.
GenericTypographic
);
}
}
...
...
@@ -444,7 +462,6 @@ namespace Svg
}
}
#if Net4
public
override
void
RegisterEvents
(
ISvgEventCaller
caller
)
{
//register basic events
...
...
@@ -463,7 +480,6 @@ namespace Svg
caller
.
UnregisterAction
(
this
.
ID
+
"/onchange"
);
}
#endif
public
override
SvgElement
DeepCopy
()
{
...
...
Source/Text/SvgTextSpan.cs
View file @
9521956d
...
...
@@ -4,7 +4,6 @@ using System.Collections.Generic;
using
System.Drawing.Drawing2D
;
using
System.Linq
;
using
System.Text
;
using
Svg.DataTypes
;
namespace
Svg
{
...
...
@@ -15,7 +14,6 @@ namespace Svg
private
SvgUnit
_y
;
private
SvgUnit
_dx
;
private
SvgUnit
_dy
;
private
FontData
_fontData
=
new
FontData
();
/// <summary>
/// Gets or sets the X.
...
...
@@ -61,57 +59,6 @@ namespace Svg
get
{
return
this
.
_dy
;
}
set
{
this
.
_dy
=
value
;
}
}
/// <summary>
/// Gets or sets the fill <see cref="SvgPaintServer"/> of this element.
/// </summary>
[
SvgAttribute
(
"fill"
)]
public
virtual
SvgPaintServer
Fill
{
get
{
return
(
this
.
Attributes
[
"fill"
]
==
null
)
?
SvgColourServer
.
NotSet
:
(
SvgPaintServer
)
this
.
Attributes
[
"fill"
];
}
set
{
this
.
Attributes
[
"fill"
]
=
value
;
}
}
/// <summary>
/// Indicates which font family is to be used to render the text.
/// </summary>
[
SvgAttribute
(
"font-family"
)]
public
virtual
string
FontFamily
{
get
{
return
this
.
_fontData
.
FontFamily
;
}
set
{
this
.
_fontData
.
FontFamily
=
value
;
}
}
/// <summary>
/// Refers to the size of the font from baseline to baseline when multiple lines of text are set solid in a multiline layout environment.
/// </summary>
[
SvgAttribute
(
"font-size"
)]
public
virtual
SvgUnit
FontSize
{
get
{
return
this
.
_fontData
.
FontSize
;
}
set
{
this
.
_fontData
.
FontSize
=
value
;
}
}
/// <summary>
/// Refers to the boldness of the font.
/// </summary>
[
SvgAttribute
(
"font-weight"
)]
public
virtual
SvgFontWeight
FontWeight
{
get
{
return
this
.
_fontData
.
FontWeight
;
}
set
{
this
.
_fontData
.
FontWeight
=
value
;
}
}
/// <summary>
/// Set all font information.
/// </summary>
[
SvgAttribute
(
"font"
)]
public
virtual
string
Font
{
get
{
return
this
.
_fontData
.
Font
;
}
set
{
_fontData
.
Font
=
value
;
}
}
/// <summary>
...
...
@@ -142,6 +89,6 @@ namespace Svg
return
newObj
;
}
internal
FontData
FontInfo
{
get
{
return
_fontData
;
}
}
}
}
\ No newline at end of file
Source/TraceAndTestImpact.testsettings
deleted
100644 → 0
View file @
2261cfdb
<?xml version="1.0" encoding="UTF-8"?>
<TestSettings
name=
"Trace and Test Impact"
id=
"84b93c72-1ada-4d8d-a7a1-abdf3aaccd1b"
xmlns=
"http://microsoft.com/schemas/VisualStudio/TeamTest/2010"
>
<Description>
These are test settings for Trace and Test Impact.
</Description>
<Execution>
<TestTypeSpecific
/>
<AgentRule
name=
"Execution Agents"
>
</AgentRule>
</Execution>
</TestSettings>
\ No newline at end of file
Prev
1
2
3
4
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