I'm using MagickNet (ImageMagick for .NET) to read the SVG code below, which contains a valid character from the "Symbol" true type font on Windows. The character is UF0B7 (uniF0B7 in the cmap table of the symbol.ttf font). This is a filled circle. The image I get using ImageMagick contains a rectangle with F0B7 written inside.
Here is my SVG file containing this special character. It is inside the text XML element (you might see it as a small square on your browser):
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" id="main1" width="960" height="720">
<g transform="matrix(1.3333334 0 0 1.3333334 0 0)">
<path stroke="none" fill="#FFFFFF" fill-rule="evenodd" d="M0 0L720 0L720 540L0 540z" transform="matrix(1 0 0 1 0 0)" />
<text style="fill:#000000;font-family:Symbol;" font-size="32" transform="matrix(1 0 0 1 43.08661 129.5433)" fill-opacity="1" x="0.028347015" y="29.952" letter-spacing="-0.01"></text>
</g>
</svg>
Here is my C# code:
byte[] imageData = File.ReadAllBytes(#"F:\test.svg");
using MagickImage image = new MagickImage(imageData);
image.Write(#"F:\test.jpg");
Is there a way to make ImageMagick use the system's Symbol font with such private use characters (according to the unicode standard) ? This character and others of the same kind are often used by Powerpoint software for bullets. I need, in my own software, to convert pptx slides to svgs using available libraries, and then rework them, isolate paragraphs in separate SVGs, to produce slide animation. In order to convert the final SVGs to images, I could also use other libraries like SVG.Net, but this one has other problems too. Up to now, MagickNet is the most precise one, except for this problem.
I create an arrow in TikZ and convert it to svg (pdf2svg file.pdf file.svg).
Then I import my output.svg into FontForge and choose there Element --> Overlap --> remove.
Finally I put the character \symbol{65} into a tex-document, but I have still these 'overlaps' in form from white space inside the sign.
Could somebody help me to create the sign correctly?
% arara: lualatex
\documentclass[varwidth, margin=15mm]{standalone}
\usepackage{tikz}
\usepackage{fontspec}
\newfontfamily{\myfont}[Scale=1]{myfont.ttf}
\begin{document}
\textbf{For output and svg-conversion}
\begin{tikzpicture}[line width=5mm]
\draw[-stealth] (0,0) -- (5,0);
\end{tikzpicture}
\textbf{Input from myfont.ttf}
\myfont\Huge\symbol{65}
\end{document}
Working Folder with
test.tex
test.pdf
output.svg
myfont.ttf (only 1 character at No. 65)
https://drive.google.com/file/d/1j2TEubR7IMu91wA4G7Mda4bqG9ddP5sg/view?usp=sharing
If the number of arrows is not too big, you can post-process the svg file with inkscape
select all and ungroup a couple of times
now use Stroke to Path option
and finally union all the shapes
This will result in an svg file like this:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
version="1.1"
id="svg2"
xml:space="preserve"
width="321.26001"
height="132.284"
viewBox="0 0 321.26001 132.284"
sodipodi:docname="document.svg"
inkscape:version="0.92.2 5c3e80d, 2017-08-06"><metadata
id="metadata8"><rdf:RDF><cc:Work
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title></dc:title></cc:Work></rdf:RDF></metadata><defs
id="defs6" /><sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="640"
inkscape:window-height="480"
id="namedview4"
showgrid="false"
inkscape:zoom="2.2729107"
inkscape:cx="160.63"
inkscape:cy="62.842265"
inkscape:current-layer="g10" /><g
id="g10"
inkscape:groupmode="layer"
inkscape:label="document"
transform="matrix(1.3333333,0,0,-1.3333333,0,132.284)"><path
style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;vector-effect:none;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:18.89785385;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:10;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate"
d="M 206.78906 41.976562 L 217.82617 56.693359 L 66.140625 56.693359 L 66.140625 75.591797 L 217.82617 75.591797 L 206.78906 90.308594 L 255.11914 66.142578 L 206.78906 41.976562 z "
transform="matrix(0.75000002,0,0,-0.75000002,0,99.213002)"
id="path18" /></g></svg>
I have an SVG that looks like this:
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="3367px" height="1250px" viewBox="0 0 3367 1250" enable-background="new 0 0 3367 1250" xml:space="preserve"> <image id="image0" width="3367" height="1250" x="0" y="0"
xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAADScAAATiCAQAAABYVH+tAAAABGdBTUEAALGPC/xhBQA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AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAADgKp+yGwDAxepf/m+fj/Lv/34eXx/6GwAAAADA4oSTANZQfggMvV5a05d//7ea3WkAAAAA
IIJwEsCc6j//eW3o6D5vAab6zB8BAAAAAEYlnAQwi+/5Rz9uTzem78Glmt0MAAAAAKAX4SSAkc0S
QvqTL8dxnMeZ3QwAAAAA4BnCSQDj+R5EGmEbu36+HDKWAAAAAGBSwkkA46jHzJlI9zmPr/KVAAAA
AGAuwkkA2VbMRfqYsBIAAAAATEM4CSBPXT4X6WM2wYNs9eF/KSQ8v7L9rxCMaYfraw2sa4f3k93V
h/+l7wcAAAytHvX45vXTq3qkCSmeuxoxO79GXl5jvmr2xSGA9xP6eeb3/JbdeABm8r/sBgBspBz1
uB3fjtfttrb72OtxOwSVIN7np/51zW4+AMD2nrm7lKkMQAPhJIAI5ajHt+N2vJqs/5WgEsR69gGC
0DgAQK765L83nwPgbsJJANf6L5DEvQSVIMrzV6aS3QUAgK09O5+TnwTA3YSTAK4ikPQcQSW4Xnn6
L7jCAQDkKYP8DQC2IJwE0J9AUj9vQSWgv9rhb1jPCgCQp8c9p/tWAO4knATQk0DSNV6Pb8fNQ2vo
rM+VyvUOACBHr4U9NbsjAMxBOAmgl3rcBJIuVOQpQVe1098p2R0BANhU6fR33MUCcJf/y24AwALK
Is it possible to conver that into a standard SVG that uses <path> and <g> tags that we are all familiar with ?
What is that standard SVG called?
Base64 encoding is a way of converting a stream of binary data into printable characters (letters, numbers, and punctuation) for when you can't include arbitrary binary data.
SVG is already printable, so encoding it with Base64 wouldn't make any sense; there is no "base64 SVG" here.
What you're seeing is something else embedded inside the SVG. A clue to what is embedded comes in this line:
data:image/png;base64
That's a data: URI, but the important thing to notice is that as well as "base64", it specifies a file type: "image/png". So the thing that's embedded is a PNG file - a bitmap image format common on the web.
This explains two things:
It needs to be base64 encoded, because it's a binary format embedded into a text format.
It needs to be embedded, because it's a bitmap image (specifying the colour of each pixel) not a vector image (specifying what shapes to draw).
So, in short: no.
I try to write a text element in an SVG from x="50%" y="0".
My text is not appears and I don't know why.
Here is my SVG
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg width="900px" height="706" viewBox="0 0 900 706" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink= "http://www.w3.org/1999/xlink">
<text x="50%" y="0" text-anchor="middle" fill="#f00" text-anchor="middle" style="font-family: DINPro; font-size: 28px;">xxxx</text>
</svg>
I am not know the font-size it will be dynamically. If I am give y="20" then my text appears. But why is it?
As I read here, the 0 0 it the left top corner of the SVG.
Why is it? As you see, the the with and the height and the viewBox is the same.
Do I miss something?
Add an dominant-baseline attribute to your text element and set to hanging.
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg width="900px" height="706" viewBox="0 0 900 706" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink= "http://www.w3.org/1999/xlink">
<text x="50%" y="0" fill="#f00" text-anchor="middle" style="font-family: DINPro; font-size: 28px;" dominant-baseline="hanging">xxxx</text>
</svg>
You have three options to change this:
dominant-baseline – used to determine or re-determine a scaled-baseline-table
alignment-baseline – specifies which baseline is to be aligned with the
corresponding baseline of the parent
baseline-shift – allows repositioning of the dominant-baseline relative to the dominant-baseline of the parent
See this post for more information about this: http://vanseodesign.com/web-design/svg-text-baseline-alignment/
Per the SVG specification
The Y coordinate of the bottom of a roman capital letter is usually zero. And the descenders on lowercase roman letters have negative coordinate values.
On a text element, y is the element bottom position.
In your case, the text printed outside of the viewbox.
Try to set your y to 20.
I tried to figure this out for myself, but I'm stuck.
Overview: I have a flash based designer application that is picky about vector source from SVG uploads. I have about 1000 SVG "templates" that are loaded in to the flash based designer app and people can then build products on my site.
Problem: I don't know why this is causing my tool to break, but when I upload an SVG 1.0 that has been exported from Adobe Illustrator 15.0.0, SVG Export Plug-In it exports the svg width="###px" height="###px" tags differently and my finicky app won't take the file.
Specifically, Illustrator 12.0.0 seems to export width-"###" VS. 15.0.0 which adds 'px' so it outputs "###px". ### = Good, XXXpx = Bad (for my flash tool)
It doesn't cause an error (at least in the flash part I can see). The SVG just won't show up in the tool.
I have tried every possible SVG 1.0 export option variant using the 15.0.0 plugin with no luck getting it to export with the .
test4_good.svg works perfectly in my tool (width="###")
test9_bad.svg breaks the tool (width="###px")
I'll paste the SVG source:
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 15.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN" "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
<svg version="1.0" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
width="463px" height="462px" viewBox="0 0 463 462" enable-background="new 0 0 463 462" xml:space="preserve">
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 12.0.0, SVG Export Plug-In -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN" "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd" [
<!ENTITY ns_flows "http://ns.adobe.com/Flows/1.0/">
<!ENTITY ns_svg "http://www.w3.org/2000/svg">
<!ENTITY ns_xlink "http://www.w3.org/1999/xlink">
<svg version="1.0" xmlns="&ns_svg;" xmlns:xlink="&ns_xlink;" xmlns:a="http://ns.adobe.com/AdobeSVGViewerExtensions/3.0/"
width="463" height="462" viewBox="-0.96 0 463 462" enable-background="new -0.96 0 463 462" xml:space="preserve">
<defs>
</defs>
<path fill="#A59D9E" stroke="#000000" d="M452.375,231.13c0,122.212-99.053,221.285-221.239,221.285
c-122.186,0-221.238-99.073-221.238-221.285c0-122.213,99.052-221.285,221.238-221.285
C353.322,9.845,452.375,108.917,452.375,231.13z M231.136,69.65c-89.164,0-161.444,72.298-161.444,161.479
c0,89.181,72.281,161.476,161.444,161.476c89.165,0,161.442-72.295,161.442-161.476C392.578,141.949,320.301,69.65,231.136,69.65z"
/>
<path fill="#F8224E" stroke="#000000" d="M461.458,231c0,127.302-103.177,230.5-230.451,230.5
C103.731,461.5,0.556,358.302,0.556,231S103.731,0.5,231.007,0.5C358.281,0.5,461.458,103.698,461.458,231z M231.007,62.797
c-92.876,0-168.167,75.307-168.167,168.203c0,92.895,75.292,168.203,168.167,168.203c92.877,0,168.166-75.309,168.166-168.203
C399.173,138.104,323.884,62.797,231.007,62.797z"/>
<path fill="#A59D9E" stroke="#000000" d="M47.536,318.388l7.5-3.571c-7.012-14.581-12.256-30.17-15.477-46.486l27.477-0.037
c0,0-2.207-10.469-3.157-18.43c-0.918-7.684-0.993-18.184-0.998-18.906c0.004-0.722,0.08-11.223,0.998-18.906
c0.951-7.96,3.157-18.43,3.157-18.43l-27.724-0.038c3.115-16.366,8.27-32.007,15.196-46.648l-7.499-3.573
c-7.446,15.735-12.936,32.574-16.151,50.21l-27.274-0.037c0,0-1.297,6.575-2.335,20.073c-0.979,12.735-0.728,16.917-0.696,17.348
c-0.032,0.433-0.283,4.614,0.696,17.35c1.038,13.497,2.335,20.071,2.335,20.071l27.522-0.037
C34.43,285.927,40.002,302.717,47.536,318.388z"/>
<path fill="#A59D9E" stroke="#000000" d="M431.037,268.341l27.379,0.037c0,0,1.298-6.574,2.336-20.071
c0.979-12.735,0.729-16.917,0.696-17.35c0.032-0.432,0.283-4.613-0.696-17.348c-1.038-13.498-2.336-20.073-2.336-20.073
l-27.132,0.037c-3.214-17.636-8.705-34.475-16.15-50.209l-7.498,3.572c6.926,14.642,12.08,30.283,15.195,46.648l-27.867,0.038
c0,0,2.209,10.469,3.16,18.43c0.917,7.683,0.992,18.184,0.996,18.906c-0.004,0.723-0.079,11.223-0.996,18.906
c-0.951,7.961-3.16,18.43-3.16,18.43l27.619,0.037c-3.221,16.316-8.464,31.905-15.476,46.485l7.499,3.572
C422.14,302.717,427.713,285.927,431.037,268.341z"/>
<polygon fill-rule="evenodd" clip-rule="evenodd" fill="#F8224E" stroke="#000000" points="16.377,230.592 31.8,206.367
47.201,230.592 31.785,254.799 16.377,230.592 16.377,230.592 16.377,230.592 "/>
<polygon fill-rule="evenodd" clip-rule="evenodd" fill="#F8224E" stroke="#000000" points="414.996,230.592 430.417,206.367
445.817,230.592 430.403,254.799 414.996,230.592 414.996,230.592 414.996,230.592 "/>
</svg>
Thanks in advance for the help, Chase.
There's no functional difference between specifying a px unit and not specifying a unit at all. It's safe to strip the "px" part off.