Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
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
6896260f
Commit
6896260f
authored
8 years ago
by
Tebjan Halm
Committed by
GitHub
8 years ago
Browse files
Options
Download
Plain Diff
Merge pull request #300 from mrbean-bremen/pr/test
Fixed inheritance of text-anchor and baseline-shift attributes
parents
bb69f2be
08589350
master
netstandard2
nuget2.4.2
nuget2.4.1
nuget2.4
No related merge requests found
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
Source/Document Structure/SvgUse.cs
+3
-0
Source/Document Structure/SvgUse.cs
Source/SvgElement.cs
+2
-2
Source/SvgElement.cs
Source/SvgElementStyle.cs
+32
-0
Source/SvgElementStyle.cs
Source/Text/SvgTextBase.cs
+0
-18
Source/Text/SvgTextBase.cs
Tests/W3CTestSuite/PassingTests.txt
+2
-0
Tests/W3CTestSuite/PassingTests.txt
Tests/W3CTestSuite/png/__Flag_of_the_United_States.png
+0
-0
Tests/W3CTestSuite/png/__Flag_of_the_United_States.png
Tests/W3CTestSuite/svg/__Flag_of_the_United_States.svg
+26
-0
Tests/W3CTestSuite/svg/__Flag_of_the_United_States.svg
with
65 additions
and
20 deletions
+65
-20
Source/Document Structure/SvgUse.cs
+
3
-
0
View file @
6896260f
...
...
@@ -80,6 +80,9 @@ namespace Svg
{
var
origParent
=
element
.
Parent
;
element
.
_parent
=
this
;
// as the new parent may have other styles that are inherited,
// we have to redraw the paths for the children
element
.
InvalidateChildPaths
();
element
.
RenderElement
(
renderer
);
element
.
_parent
=
origParent
;
}
...
...
This diff is collapsed.
Click to expand it.
Source/SvgElement.cs
+
2
-
2
View file @
6896260f
...
...
@@ -377,9 +377,9 @@ namespace Svg
}
/// <summary>
/// Gets or sets the
text anchor
.
/// Gets or sets the
space handling
.
/// </summary>
/// <value>The
text anchor
.</value>
/// <value>The
space handling
.</value>
[
SvgAttribute
(
"space"
,
SvgAttributeAttribute
.
XmlNamespace
)]
public
virtual
XmlSpaceHandling
SpaceHandling
{
...
...
This diff is collapsed.
Click to expand it.
Source/SvgElementStyle.cs
+
32
-
0
View file @
6896260f
...
...
@@ -26,6 +26,18 @@ namespace Svg
set
{
this
.
_dirty
=
value
;
}
}
/// <summary>
/// Force recreation of the paths for the element and it's children.
/// </summary>
public
void
InvalidateChildPaths
()
{
this
.
IsPathDirty
=
true
;
foreach
(
SvgElement
element
in
this
.
Children
)
{
element
.
InvalidateChildPaths
();
}
}
protected
static
float
FixOpacityValue
(
float
value
)
{
const
float
max
=
1.0f
;
...
...
@@ -157,6 +169,26 @@ namespace Svg
set
{
this
.
Attributes
[
"shape-rendering"
]
=
value
;
}
}
/// <summary>
/// Gets or sets the text anchor.
/// </summary>
[
SvgAttribute
(
"text-anchor"
,
true
)]
public
virtual
SvgTextAnchor
TextAnchor
{
get
{
return
this
.
Attributes
.
GetInheritedAttribute
<
SvgTextAnchor
>(
"text-anchor"
);
}
set
{
this
.
Attributes
[
"text-anchor"
]
=
value
;
this
.
IsPathDirty
=
true
;
}
}
/// <summary>
/// Specifies dominant-baseline positioning of text.
/// </summary>
[
SvgAttribute
(
"baseline-shift"
,
true
)]
public
virtual
string
BaselineShift
{
get
{
return
this
.
Attributes
.
GetInheritedAttribute
<
string
>(
"baseline-shift"
);
}
set
{
this
.
Attributes
[
"baseline-shift"
]
=
value
;
this
.
IsPathDirty
=
true
;
}
}
/// <summary>
/// Indicates which font family is to be used to render the text.
/// </summary>
...
...
This diff is collapsed.
Click to expand it.
Source/Text/SvgTextBase.cs
+
0
-
18
View file @
6896260f
...
...
@@ -38,24 +38,6 @@ namespace Svg
}
}
/// <summary>
/// Gets or sets the text anchor.
/// </summary>
/// <value>The text anchor.</value>
[
SvgAttribute
(
"text-anchor"
,
true
)]
public
virtual
SvgTextAnchor
TextAnchor
{
get
{
return
(
this
.
Attributes
[
"text-anchor"
]
==
null
)
?
SvgTextAnchor
.
Inherit
:
(
SvgTextAnchor
)
this
.
Attributes
[
"text-anchor"
];
}
set
{
this
.
Attributes
[
"text-anchor"
]
=
value
;
this
.
IsPathDirty
=
true
;
}
}
[
SvgAttribute
(
"baseline-shift"
,
true
)]
public
virtual
string
BaselineShift
{
get
{
return
this
.
Attributes
[
"baseline-shift"
]
as
string
;
}
set
{
this
.
Attributes
[
"baseline-shift"
]
=
value
;
this
.
IsPathDirty
=
true
;
}
}
public
override
XmlSpaceHandling
SpaceHandling
{
get
{
return
base
.
SpaceHandling
;
}
...
...
This diff is collapsed.
Click to expand it.
Tests/W3CTestSuite/PassingTests.txt
+
2
-
0
View file @
6896260f
...
...
@@ -163,11 +163,13 @@ text-text-08-b.svg
text-text-09-t.svg
text-text-10-t.svg
text-text-11-t.svg
text-text-12-t.svg
text-tref-01-b.svg
text-tspan-01-b.svg
text-ws-01-t.svg
text-ws-02-t.svg
text-ws-03-t.svg
types-basic-01-f.svg
painting-stroke-02-t.svg
coords-viewattr-04-f.svg
fonts-desc-01-t.svg
...
...
This diff is collapsed.
Click to expand it.
Tests/W3CTestSuite/png/__Flag_of_the_United_States.png
0 → 100644
+
0
-
0
View file @
6896260f
30.5 KB
This diff is collapsed.
Click to expand it.
Tests/W3CTestSuite/svg/__Flag_of_the_United_States.svg
0 → 100644
+
26
-
0
View file @
6896260f
<?xml version="1.0" encoding="UTF-8"?>
<svg
xmlns=
"http://www.w3.org/2000/svg"
xmlns:xlink=
"http://www.w3.org/1999/xlink"
width=
"1235"
height=
"650"
viewBox=
"0 0 7410 3900"
>
<rect
width=
"7410"
height=
"3900"
fill=
"#b22234"
/>
<path
d=
"M0,450H7410m0,600H0m0,600H7410m0,600H0m0,600H7410m0,600H0"
stroke=
"#fff"
stroke-width=
"300"
/>
<rect
width=
"2964"
height=
"2100"
fill=
"#3c3b6e"
/>
<g
fill=
"#fff"
>
<g
id=
"s18"
>
<g
id=
"s9"
>
<g
id=
"s5"
>
<g
id=
"s4"
>
<path
id=
"s"
d=
"M247,90 317.534230,307.082039 132.873218,172.917961H361.126782L176.465770,307.082039z"
/>
<use
xlink:href=
"#s"
y=
"420"
/>
<use
xlink:href=
"#s"
y=
"840"
/>
<use
xlink:href=
"#s"
y=
"1260"
/>
</g>
<use
xlink:href=
"#s"
y=
"1680"
/>
</g>
<use
xlink:href=
"#s4"
x=
"247"
y=
"210"
/>
</g>
<use
xlink:href=
"#s9"
x=
"494"
/>
</g>
<use
xlink:href=
"#s18"
x=
"988"
/>
<use
xlink:href=
"#s9"
x=
"1976"
/>
<use
xlink:href=
"#s5"
x=
"2470"
/>
</g>
</svg>
\ No newline at end of file
This diff is collapsed.
Click to expand it.
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
Menu
Projects
Groups
Snippets
Help