-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Svg font does not support <use> in Safari #266
Comments
Interesting, thanks for reporting. If it works on FireFox then this is a Safari bug. You should probably file an issue with Apple. |
I changed :: characters in ttx and rebuilt it to ttf, but it still doesn't work. Although this is a bug in Safari, can we add an option not to generate use? |
This is the ttx file after modifying the use id. <?xml version="1.0" encoding="UTF-8"?>
<ttFont sfntVersion="\x00\x01\x00\x00" ttLibVersion="4.21">
<GlyphOrder>
<!-- The 'id' attribute is only for humans; it is ignored when parsed. -->
<GlyphID id="0" name=".notdef"/>
<GlyphID id="1" name="space"/>
<GlyphID id="2" name="f"/>
</GlyphOrder>
<head>
<!-- Most of this table will be recalculated by the compiler -->
<tableVersion value="1.0"/>
<fontRevision value="1.0"/>
<checkSumAdjustment value="0xac2d1b06"/>
<magicNumber value="0x5f0f3cf5"/>
<flags value="00000000 00000011"/>
<unitsPerEm value="1024"/>
<created value="Fri Apr 9 13:36:55 2021"/>
<modified value="Fri Apr 9 13:36:55 2021"/>
<xMin value="0"/>
<yMin value="0"/>
<xMax value="0"/>
<yMax value="0"/>
<macStyle value="00000000 00000000"/>
<lowestRecPPEM value="6"/>
<fontDirectionHint value="2"/>
<indexToLocFormat value="0"/>
<glyphDataFormat value="0"/>
</head>
<hhea>
<tableVersion value="0x00010000"/>
<ascent value="950"/>
<descent value="-250"/>
<lineGap value="0"/>
<advanceWidthMax value="1200"/>
<minLeftSideBearing value="0"/>
<minRightSideBearing value="0"/>
<xMaxExtent value="0"/>
<caretSlopeRise value="1"/>
<caretSlopeRun value="0"/>
<caretOffset value="0"/>
<reserved0 value="0"/>
<reserved1 value="0"/>
<reserved2 value="0"/>
<reserved3 value="0"/>
<metricDataFormat value="0"/>
<numberOfHMetrics value="3"/>
</hhea>
<maxp>
<!-- Most of this table will be recalculated by the compiler -->
<tableVersion value="0x10000"/>
<numGlyphs value="3"/>
<maxPoints value="0"/>
<maxContours value="0"/>
<maxCompositePoints value="0"/>
<maxCompositeContours value="0"/>
<maxZones value="1"/>
<maxTwilightPoints value="0"/>
<maxStorage value="0"/>
<maxFunctionDefs value="0"/>
<maxInstructionDefs value="0"/>
<maxStackElements value="0"/>
<maxSizeOfInstructions value="0"/>
<maxComponentElements value="0"/>
<maxComponentDepth value="0"/>
</maxp>
<OS_2>
<!-- The fields 'usFirstCharIndex' and 'usLastCharIndex'
will be recalculated by the compiler -->
<version value="4"/>
<xAvgCharWidth value="1112"/>
<usWeightClass value="400"/>
<usWidthClass value="5"/>
<fsType value="00000000 00000100"/>
<ySubscriptXSize value="666"/>
<ySubscriptYSize value="614"/>
<ySubscriptXOffset value="0"/>
<ySubscriptYOffset value="77"/>
<ySuperscriptXSize value="666"/>
<ySuperscriptYSize value="614"/>
<ySuperscriptXOffset value="0"/>
<ySuperscriptYOffset value="358"/>
<yStrikeoutSize value="51"/>
<yStrikeoutPosition value="307"/>
<sFamilyClass value="0"/>
<panose>
<bFamilyType value="0"/>
<bSerifStyle value="0"/>
<bWeight value="0"/>
<bProportion value="0"/>
<bContrast value="0"/>
<bStrokeVariation value="0"/>
<bArmStyle value="0"/>
<bLetterForm value="0"/>
<bMidline value="0"/>
<bXHeight value="0"/>
</panose>
<ulUnicodeRange1 value="00000000 00000000 00000000 00000001"/>
<ulUnicodeRange2 value="00000000 00000000 00000000 00000000"/>
<ulUnicodeRange3 value="00000000 00000000 00000000 00000000"/>
<ulUnicodeRange4 value="00000000 00000000 00000000 00000000"/>
<achVendID value="NONE"/>
<fsSelection value="00000000 11000000"/>
<usFirstCharIndex value="32"/>
<usLastCharIndex value="102"/>
<sTypoAscender value="950"/>
<sTypoDescender value="-250"/>
<sTypoLineGap value="0"/>
<usWinAscent value="950"/>
<usWinDescent value="250"/>
<ulCodePageRange1 value="00000000 00000000 00000000 00000001"/>
<ulCodePageRange2 value="00000000 00000000 00000000 00000000"/>
<sxHeight value="512"/>
<sCapHeight value="717"/>
<usDefaultChar value="0"/>
<usBreakChar value="32"/>
<usMaxContext value="0"/>
</OS_2>
<hmtx>
<mtx name=".notdef" width="0" lsb="0"/>
<mtx name="f" width="1200" lsb="0"/>
<mtx name="space" width="1024" lsb="0"/>
</hmtx>
<cmap>
<tableVersion version="0"/>
<cmap_format_4 platformID="0" platEncID="3" language="0">
<map code="0x20" name="space"/><!-- SPACE -->
<map code="0x66" name="f"/><!-- LATIN SMALL LETTER F -->
</cmap_format_4>
<cmap_format_4 platformID="3" platEncID="1" language="0">
<map code="0x20" name="space"/><!-- SPACE -->
<map code="0x66" name="f"/><!-- LATIN SMALL LETTER F -->
</cmap_format_4>
</cmap>
<loca>
<!-- The 'loca' table will be calculated by the compiler -->
</loca>
<glyf>
<!-- The xMin, yMin, xMax and yMax values
will be recalculated by the compiler. -->
<TTGlyph name=".notdef"/><!-- contains no outline data -->
<TTGlyph name="f"/><!-- contains no outline data -->
<TTGlyph name="space"/><!-- contains no outline data -->
</glyf>
<name>
<namerecord nameID="1" platformID="3" platEncID="1" langID="0x409">
iconfont
</namerecord>
<namerecord nameID="2" platformID="3" platEncID="1" langID="0x409">
Regular
</namerecord>
<namerecord nameID="3" platformID="3" platEncID="1" langID="0x409">
1.000;NONE;iconfont-Regular
</namerecord>
<namerecord nameID="4" platformID="3" platEncID="1" langID="0x409">
iconfont Regular
</namerecord>
<namerecord nameID="5" platformID="3" platEncID="1" langID="0x409">
Version 1.000
</namerecord>
<namerecord nameID="6" platformID="3" platEncID="1" langID="0x409">
iconfont-Regular
</namerecord>
</name>
<post>
<formatType value="3.0"/>
<italicAngle value="0.0"/>
<underlinePosition value="-77"/>
<underlineThickness value="51"/>
<isFixedPitch value="0"/>
<minMemType42 value="0"/>
<maxMemType42 value="0"/>
<minMemType1 value="0"/>
<maxMemType1 value="0"/>
</post>
<SVG>
<svgDoc endGlyphID="2" startGlyphID="2">
<![CDATA[<svg xmlns="http://www.w3.org/2000/svg" version="1.1"><defs/><g id="glyph2" transform="matrix(6 0 0 6 0 -950)"><path d="M200,100 A100 100 0 1 1 0,100 A100 100 0 1 1 200,100 Z" fill="#F49924"/><path d="M74.545,71.818 A15 21.818 0 1 1 44.545,71.818 A15 21.818 0 1 1 74.545,71.818 Z" fill="#7E4418" id="a"/><use href="#a" x="80.91"/></g></svg>]]>
</svgDoc>
</SVG>
</ttFont> |
if you use |
thanks! we should open a distinct issue for the latter mis-positioning for nanoemoji/src/nanoemoji/svg.py Lines 419 to 437 in ad3fe0a
I think I have a solution. |
I created an OT-SVG font from the SVG file posted by @yisibl that reproduces this issue on Safari 14.0. test-ot-svg-safari-use-bug.zip It looks like this on Safari: On Firefox (v87.0) it looks correctly as expected: The SVG document embedded in the font looks like this: <svg xmlns="http://www.w3.org/2000/svg" version="1.1">
<defs/>
<g id="glyph2" transform="matrix(6 0 0 6 37.5 -950)">
<path d="M200,100 A100 100 0 1 1 0,100 A100 100 0 1 1 200,100 Z" fill="#F49924"/>
<path d="M74.545,71.818 A15 21.818 0 1 1 44.545,71.818 A15 21.818 0 1 1 74.545,71.818 Z" fill="#7E4418" id="glyph2::1"/>
<use href="#glyph2::1" x="80.91"/>
</g>
</svg> Besides the use of If I load the SVG document as an SVG in Safari (not as a glyph embedded in OT-SVG font), then it renders correctly even with the So I have to conclude that |
I haven't debugged this, so I don't know if there are multiple problems with this content, but I can say right off the bat that you need to add the
You can see an example of this working correctly in the SVG 1.1 spec: https://www.w3.org/TR/SVG11/images/struct/Use01.svg
We do support |
We were using the unqualified 'href' notation which is only supported in SVG2. For this to work properly on Safari and Adobe apps we need to declar the xlink namespace and qualify the attribute as 'xlink:href' Fixes #264 and #266 Supersedes googlefonts/picosvg#207 and #270 Many thanks yisibl for helping debugging and fixing this!
nanoemoji --color_format=picosvg
The svg file:
TTX file:
I think Safari does not support
<use href="#glyph2::1" x="80.91"/>
, so the ellipse on the right is missing.Expect:
Keynote
The text was updated successfully, but these errors were encountered: