I ran into an issue with FontAwesome a few months back, where a NoCache header was being injected at the server and FA was broken for any partial refresh. I convinced the admin to reverse that setting and all was well until last week... We had some users who were not getting any icons to appear. Ever. We tracked it down to a new Windows 10 setting for IE11 which disallows untrusted fonts. Since we do not set security protocols for our users, and there is no chance of ever convincing those admins to change this policy that they explicitly turned on, I had to find a new solution. I did some searching and it turned out to not be too difficult. First, here is the original implementation.
The theme:
Web fonts are out, so I looked for a solution to convert FontAwesome into SVG graphics. It turns out, there is one. Here is the guide I used. This provides you with an SVG image, a CSS class, and a JS file (required for IE). I added those files to my application, and to my theme. Then I modified each icon in the theme as follows:
The theme:
<control>
The xsp tag:
<name>Icon.Search</name>
<property mode="override">
<property mode="concat">
</control>
<property mode="override">
<name>tagName</name>
<value>i</value>
</property><value>i</value>
<property mode="concat">
<name>styleClass</name>
<value>fa fa-search</value>
</property>
<value>fa fa-search</value>
<xp:text themeId="Icon.Search" />
Web fonts are out, so I looked for a solution to convert FontAwesome into SVG graphics. It turns out, there is one. Here is the guide I used. This provides you with an SVG image, a CSS class, and a JS file (required for IE). I added those files to my application, and to my theme. Then I modified each icon in the theme as follows:
<control>
That essentially solved the issue. The icon alignment can be slightly different as a graphic than as a font, and the appearance is slightly inconsistent. I tried experimenting with the SVG shape-rendering tag without success, but I could have just been doing something wrong or perhaps once the graphic is drawn it won't redraw when the SVG markup changes. Both of those issues are fairly minor in scope.
<name>Icon.Search</name>
<property mode="override">
<property mode="override">
<property mode="concat">
<property mode="override">
</control>
<property mode="override">
<name>tagName</name>
<value>svg</value>
</property><value>svg</value>
<property mode="override">
<name>escape</name>
<value>#{false}</value>
</property><value>#{false}</value>
<property mode="concat">
<name>styleClass</name>
<value>icon icon-search</value>
</property><value>icon icon-search</value>
<property mode="override">
<name>value</name>
<value>&lt;use xlink:href="fonts/symbol-defs.svg#icon-search"> </use&gt;</value>
</property>
<value>&lt;use xlink:href="fonts/symbol-defs.svg#icon-search"> </use&gt;</value>
Comments
Post a Comment