Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
K
kicad-source-mirror
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
Elphel
kicad-source-mirror
Commits
6c2c6477
Commit
6c2c6477
authored
Apr 27, 2013
by
Felix Morgner
Browse files
Options
Browse Files
Download
Plain Diff
merge with upstream
parents
8ddbf84c
ec497d5d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
61 additions
and
2 deletions
+61
-2
common_plotSVG_functions.cpp
common/common_plotSVG_functions.cpp
+61
-2
No files found.
common/common_plotSVG_functions.cpp
View file @
6c2c6477
...
...
@@ -99,6 +99,65 @@
#include <macros.h>
#include <kicad_string.h>
/**
* Function XmlEsc
* translates '<' to "<", '>' to ">" and so on, according to the spec:
* http://www.w3.org/TR/2000/WD-xml-c14n-20000119.html#charescaping
* May be moved to a library if needed generally, but not expecting that.
*/
static
wxString
XmlEsc
(
const
wxString
&
aStr
,
bool
isAttribute
=
false
)
{
wxString
escaped
;
escaped
.
reserve
(
aStr
.
length
()
);
for
(
wxString
::
const_iterator
it
=
aStr
.
begin
();
it
!=
aStr
.
end
();
++
it
)
{
const
wxChar
c
=
*
it
;
switch
(
c
)
{
case
wxS
(
'<'
):
escaped
.
append
(
wxS
(
"<"
)
);
break
;
case
wxS
(
'>'
):
escaped
.
append
(
wxS
(
">"
)
);
break
;
case
wxS
(
'&'
):
escaped
.
append
(
wxS
(
"&"
)
);
break
;
case
wxS
(
'\r'
):
escaped
.
append
(
wxS
(
"
"
)
);
break
;
default:
if
(
isAttribute
)
{
switch
(
c
)
{
case
wxS
(
'"'
):
escaped
.
append
(
wxS
(
"""
)
);
break
;
case
wxS
(
'\t'
):
escaped
.
append
(
wxS
(
"	"
)
);
break
;
case
wxS
(
'\n'
):
escaped
.
append
(
wxS
(
"
"
));
break
;
default:
escaped
.
append
(
c
);
}
}
else
escaped
.
append
(
c
);
}
}
return
escaped
;
}
SVG_PLOTTER
::
SVG_PLOTTER
()
{
m_graphics_changed
=
true
;
...
...
@@ -460,10 +519,10 @@ bool SVG_PLOTTER::StartPlot()
fprintf
(
outputFile
,
"<title>SVG Picture created as %s date %s </title>
\n
"
,
TO_UTF8
(
wxFileName
(
filename
).
GetFullName
(
)
),
date_buf
);
TO_UTF8
(
XmlEsc
(
wxFileName
(
filename
).
GetFullName
()
)
),
date_buf
);
// End of header
fprintf
(
outputFile
,
" <desc>Picture generated by %s </desc>
\n
"
,
TO_UTF8
(
creator
)
);
TO_UTF8
(
XmlEsc
(
creator
)
)
);
// output the pen and brush color (RVB values in hex) and opacity
double
opacity
=
1.0
;
// 0.0 (transparent to 1.0 (solid)
...
...
Write
Preview
Markdown
is supported
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