SVG embedded font gets overwritten in Internet Edge - svg

I'm using vecta.io to create SVG images for my website, some of which include embedded fonts. I embed these simply via an <img src="this.svg"> tag.
This works as needed on Chrome, Firefox, Internet Explorer - but not Microsoft Edge.
Specifically on Edge, the embedded font gets replaced by Times New Roman when using the <img> tag - but not when using the <object> tag for inserting the SVG. I wish to use the image tag for simplicity and ideally avoid fallbacks - is there a way to solve this on Edge?
Below is an example of the problem - an SVG with embedded fonts inserted both via image tag and object tag: https://test123new.smoolis.com/screen/page/test

It seems to be a known issue of Edge Legacy. I found a similar thread and others have reported the issue. You could also provide your feedback in Edge Legacy.
As a workaround for now, if you don't want to use <object> tag, I think you can only save the picture as a png file and use png pic in Edge Legacy.

Related

I'm trying use flutter svg, but load with black svg

I'm trying to use Flutter SVG dependency, i put in the svg in assets, set in pubspec.yaml, and set in my widget, but, the svg load with black container
I've already tried change the svg, and the another svg works fine, but the other not...
final Widget svg = SvgPicture.asset(assetName, semanticsLabel: 'Acme Logo');
the svg in flutter
Here the svg
My expected response was colored svg like the link in codepen, but i got this
This is probably happened because of the corrupted SVG files from the internet. I faced this problem earlier and tried many ways to solve it. But finally, I solved it with the help of this software, svgcleaner.
Download the application into your OS, from here
After installation,
import your SVG.
Click run.
Success! Here you can see your SVGs' cleaned successfully.
After cleaning, you can grab those SVG files from the output folder location and add those files into your flutter app without seeing any black coloured SVG.
It works perfectly fine like this.
I think I am late but this might just help someone. Just make all the styles in your svg image use inline styling otherwise all colors and styling won't be rendered as the tag is not readable by the SvgPicture.
I tried this SVG asset with the latest version of jovial_svg, and it works great! Here's the result:
This version of jovial_svg should be released in a couple of days, but for now it's 1.1.4-rc.4.
(This asset helped me flesh out stylesheet support - thanks!)
I found this site it solved my problem with the svg file that was out of color.
https://iconly.io/tools/svg-cleaner
use this configuration in illustrator before you add it to your project.
https://user-images.githubusercontent.com/2842459/62599914-91de9c00-b8fe-11e9-8fb7-4af57d5100f7.png
If You don't have solution try to convert your image from svg to png and use:
Image.asset('assets/images/image.png',)
Some SVG images uses style tag and if you try to load such image using flutter_svg, image won't render as expected. Currently flutter_svg supports styling through inline styles only and not the style tag that some of SVG files may contain (in my case, I exported image from Adobe XD and it has all styles in tag). When you try to load such SVG images, you will get below error:
======== Exception caught by SVG =================================================================== The following UnimplementedError was thrown in parseSvgElement: The
element is not implemented in this library.
Style elements are not supported by this library and the requested SVG
may not render as intended.
If possible, ensure the SVG uses inline styles and/or attributes
(which are supported), or use a preprocessing utility such as
svgcleaner to inline the styles for you.
This error mentions to use inline style instead of style tag, you can use svgcleaner (as mentioned in #Alif's answer) or similar utility to convert SVG file with inline styling.
For more detials, refer this link to check SVG compatibility with flutter_svg and handling other use-cases
try this:
Container(
child: SvgPicture.asset(
'assets/images/image.svg',
fit: BoxFit.contain,
),
)

How do I get these SVG fonts to work?

I need to dynamically make an SVG in my web app and to do so I'm making an SVG in Corel and modifying that template file in Node.js as needed. This works except for fonts. For this project I need my text as text, not curves, because I need to modify it. I'm using Century Gothic. I was using embedded fonts, but apparently those are no longer supported by Chrome and Edge. However, if I used linked fonts the file renders improperly if the user doesn't have the font installed. In either of these error cases the browser defaults to Times New Roman. What can I do to get Century Gothic to render in all browsers in an SVG?
You'll need a web font. Century Gothic is not freely available, so you have to either buy a license, or use an open source alternative. Muli seems to be considered as a good alternative. For how to use an external font provider, see this.

Firefox could not display SVG img properly

In desktop version of Firefox (version 56.0), the SVG image was displayed incorrectly.
For example, with the following SVG image for twitter logo, it shows something that not even close to twitter logo. The same SVG image is displayed properly in other browsers, (IE11, Edge, Chrome, etc.). Is this a bug in Firefox? or there is a workaround to make it work? (two screenshots for working and not-working pages in attachment)
<img style="width:640px; height:640px;" src="data:image/svg+xml;charset=utf-8,%3Csvg%20version%3D%221.1%22%20id%3D%22Layer_1%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20xmlns%3Axlink%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2Fxlink%22%20x%3D%220px%22%20y%3D%220px%22%20viewBox%3D%220%200%2032%2032%22%20enable-background%3D%22new%200%200%2032%2032%22%20xml%3Aspace%3D%22preserve%22%3E%3Cpath%20fill%3D%22%2355ACEE%22%20d%3D%22M32%2C6.4c-1.2%2C0.5-2.4%2C0.9-3.8%2C1c1.4-0.8%2C2.4-2.1%2C2.9-3.6c-1.3%2C0.8-2.7%2C1.3-4.2%2C1.6c-1.2-1.3-2.9-2.1-4.8-2.1%2Cc-3.6%2C0-6.6%2C2.9-6.6%2C6.6c0%2C0.5%2C0.1%2C1%2C0.2%2C1.5C10.3%2C11.1%2C5.5%2C8.5%2C2.2%2C4.5c-0.6%2C1-0.9%2C2.1-0.9%2C3.3c0%2C2.3%2C1.2%2C4.3%2C2.9%2C5.5%2Cc-1.1%2C0-2.1-0.3-3-0.8c0%2C0%2C0%2C0.1%2C0%2C0.1c0%2C3.2%2C2.3%2C5.8%2C5.3%2C6.4c-0.6%2C0.1-1.1%2C0.2-1.7%2C0.2c-0.4%2C0-0.8%2C0-1.2-0.1%2Cc0.8%2C2.6%2C3.3%2C4.5%2C6.1%2C4.6c-2.2%2C1.8-5.1%2C2.8-8.2%2C2.8c-0.5%2C0-1.1%2C0-1.6-0.1c2.9%2C1.9%2C6.4%2C2.9%2C10.1%2C2.9c12.1%2C0%2C18.7-10%2C18.7-18.7%2Cc0-0.3%2C0-0.6%2C0-0.8C30%2C8.9%2C31.1%2C7.7%2C32%2C6.4z%22%2F%3E%3C%2Fsvg%3E" />
Working SVG in Chrome
Not-working SVG in Firefox
Your path is invalid. Commas are only allowed between numbers so -2.1,c is invalid and a UA should stop parsing there. Firefox is correct and the other UAs are not per the SVG specification.
If you decoded the data URL to a file and viewed the file directly you'd have seen the error logged in the Firefox console.
Removing the invalid commas fixes things. If this SVG was produced by a tool you should get the tool fixed.
<img style="width:640px; height:640px;" src="data:image/svg+xml;charset=utf-8,%3Csvg%20version%3D%221.1%22%20id%3D%22Layer_1%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20xmlns%3Axlink%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2Fxlink%22%20x%3D%220px%22%20y%3D%220px%22%20viewBox%3D%220%200%2032%2032%22%20enable-background%3D%22new%200%200%2032%2032%22%20xml%3Aspace%3D%22preserve%22%3E%3Cpath%20fill%3D%22%2355ACEE%22%20d%3D%22M32%2C6.4c-1.2%2C0.5-2.4%2C0.9-3.8%2C1c1.4-0.8%2C2.4-2.1%2C2.9-3.6c-1.3%2C0.8-2.7%2C1.3-4.2%2C1.6c-1.2-1.3-2.9-2.1-4.8-2.1c-3.6%2C0-6.6%2C2.9-6.6%2C6.6c0%2C0.5%2C0.1%2C1%2C0.2%2C1.5C10.3%2C11.1%2C5.5%2C8.5%2C2.2%2C4.5c-0.6%2C1-0.9%2C2.1-0.9%2C3.3c0%2C2.3%2C1.2%2C4.3%2C2.9%2C5.5c-1.1%2C0-2.1-0.3-3-0.8c0%2C0%2C0%2C0.1%2C0%2C0.1c0%2C3.2%2C2.3%2C5.8%2C5.3%2C6.4c-0.6%2C0.1-1.1%2C0.2-1.7%2C0.2c-0.4%2C0-0.8%2C0-1.2-0.1c0.8%2C2.6%2C3.3%2C4.5%2C6.1%2C4.6c-2.2%2C1.8-5.1%2C2.8-8.2%2C2.8c-0.5%2C0-1.1%2C0-1.6-0.1c2.9%2C1.9%2C6.4%2C2.9%2C10.1%2C2.9c12.1%2C0%2C18.7-10%2C18.7-18.7c0-0.3%2C0-0.6%2C0-0.8C30%2C8.9%2C31.1%2C7.7%2C32%2C6.4z%22%2F%3E%3C%2Fsvg%3E">

How to create an Angular Material svg iconset

Does anybody know if SVG iconsets are working as of the current version? (1.0.7)
I'm strugling to use some custom svg with the md-icon directive but I haven't managed to see anything on the screen. Is there something broken or it's simply not implemented?
Any example of how to create and use an svg iconset file?
I know I can use the md-svg-src attribute to load one specific svg file providing its url, but that forces me to have all svgs on separated files and it also doesn't play well with the template cache.
Note: I'm using SVGs for the icons, not an icon font.

Links missing in SVG Sphinx inheritance diagrams

When I configure Sphinx's Graphviz extension to generate SVG output, using
graphviz_output_format = 'svg'
I am no longer able to click on the nodes of inheritance diagrams generated using the inheritance_diagram extension.
Is there a way to enable these links in an SVG diagram, or do they only work for PNG diagrams?
I had a similar experience with embedded dot graphs (graphviz directive in Sphinx). Doing a little digging (and testing), I've concluded:
When setting graphviz_output_format to png, sphinx handles this by doing a few extra things:
It has dot output both a .png and a corresponding .map file.
The rendered HTML includes a map section to "overlay" the png image with link targets.
When using SVG, the renderer omits the map section and only produces an SVG image. Since SVG supports links within the format (which dot correctly embeds), I presume it was expected the map section was redundant (or more likely problematic since it would "compete" with the SVG-rendered image for focus.)
As alluded to here, most browsers disable embedded SVG links (when surrounded by a <img> tag). The consequence is that the embedded links are not visible, and thus not clickable.
In my case when I open the SVG image directly in the browser, the embedded links are clickable (tested on Safari and Firefox).

Resources