SergeyMell / nativescript-plugins

Apache License 2.0
14 stars 4 forks source link

Some SVG will not display on iOS #6

Closed crowmagnumb closed 3 years ago

crowmagnumb commented 3 years ago

I was developing an app in my primary dev environment android and had some SVGs that this tool smashingly delivered on! When I went to finally test this app out on iOS as well, the SVGs would not show. So I went to the task of eliminating parts of the SVG till I found the culprit and I hit upon it on my first try! I got the SVGs from a graphic designer and the DOCTYPE tag was as follows ...

<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" [
    <!ENTITY ns_extend "http://ns.adobe.com/Extensibility/1.0/">
    <!ENTITY ns_ai "http://ns.adobe.com/AdobeIllustrator/10.0/">
    <!ENTITY ns_graphs "http://ns.adobe.com/Graphs/1.0/">
    <!ENTITY ns_vars "http://ns.adobe.com/Variables/1.0/">
    <!ENTITY ns_imrep "http://ns.adobe.com/ImageReplacement/1.0/">
    <!ENTITY ns_sfw "http://ns.adobe.com/SaveForWeb/1.0/">
    <!ENTITY ns_custom "http://ns.adobe.com/GenericCustomNamespace/1.0/">
    <!ENTITY ns_adobe_xpath "http://ns.adobe.com/XPath/1.0/">
]>

I removed all the "extraneous" stuff so that it looked like this ...

<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">

... and it worked! I have been using these SVGs on the web for years and have never found anything that wouldn't display them till now. So not sure what you want to do with this info, maybe its easily fixed?, maybe it can be passed on?, maybe this is just here (to be closed) for someone else to stumble upon if they get the same problem.

Cheers, thanks so much for this plugin!!

SergeyMell commented 3 years ago

Hi @crowmagnumb I never used the svg files with the DOCTYPE header so didn't meet this issue before. I need to check how it is handled by the native iOS code. After that, I can tell how can I fix this or improve this logic. In anycase, thank you for the issue. Issues help the plugins to become better.

crowmagnumb commented 3 years ago

Oh interesting, I found 2 links right off that indicate that it is generally accepted best practice to leave the DOCTYPE element off completely because it causes too many problems. :)

https://jwatt.org/svg/authoring/#doctype-declaration https://developer.mozilla.org/en-US/docs/Web/SVG/Tutorial/Getting_Started

So I'm going to do just that for these SVGs as well. Good to know.

SergeyMell commented 3 years ago

Added the references to the readme Thank you for your effort, @crowmagnumb!