Just want to make sure that there is no misunderstanding here: based on
the data from
https://bugzilla.mozilla.org/show_bug.cgi?id=948856#c37,
some experience with loading icon fonts versus images versus svg that
has been described on dev-gaia, *preloading the font is needed*.
On 06/17/2014 12:52 PM, Wilson Page wrote:
> I'm inlining to minimise cross-origin issues and to reduce requests.
> The entire asset is <12k so I'm really not concerned with performance
> here, especially considering the number of PNG assets this replaces.
> We've been using a similar approach in Camera for quite some time and
> all has been well. I think there are better areas we can focus
> performance efforts.
Performance is not always related to the size of the asset. For example
last time I found that we consume 2.4mb of memory all the time in the
System app because we were loading 4 times an image asset of 3k. Every
time this asset was rendered it was consuming 600k of memory. This asset
was a gradient and it was expensive to render it.
When you consider the size of the asset in this case, you should also
consider at which time it is read, if is it going to trigger some
invalidations because the image will arrive after the app is rendered,
how long will it take for the font subsystem to render those glyphs, can
we save some memory by using some system features, instead of having a
local copy in all apps, etc...
> I'm not exactly sure if glyphs are still assigned to code points
> within the generated font, is that an issue?
>
> IMO we should just treat icon assets in the same way we do images assets.
Image assets may be slow. We run into this issue multiple times in the
Settings app. Replacing our current image assets icons with an icon font
baked into the platform shave ~300ms of load time.
> Baking them into the platform seems like it could cause unnecessary
> complications further down the line, for negligible perf gains.
Obviously 300ms is not negligible :)
Also in terms of memory there is an impact too, and since we're
targeting very low end devices, I expect this to be useful too.
The current mechanism used by Gecko to discard images help us to reduce
the memory overhead here for background apps, but it has the side effect
that the image needs to be re-decoded when the app goes to foreground
and it takes time (you see images flashes when the images are re-decoded
/ repainted).
So icon font would make some apps to load faster, consume less memory,
and avoid some glitches when the app goes from background to foreground.
Definitively not negligible.
> At the end of the day we're a collection of web-apps, the more we
> exploit our platform power, the further we distance ourselves from the
> real web platform.
>
What you say here is true. And we would all like to use only simple web
features, and that's definitively the goal.
But while we are heading up to this goal, we sometimes needs to do some
trade-offs, and using icon fonts is one of them. It does not mean there
is more distance from the real web platform, as I believe that while
Gaia use icon fonts, a lot of efforts will be done on the svg side in
order to replace the icon font with SVG when it will be time to do so.
So you should see that as: it makes us more competitive in this
extremely competitive area, and offers us a bit more time to fix the
real issue, which is that SVG does not fit yet, and beside that, to fix
the web platform to make it becomes reals on mobile.
Vivien.
> *Cc: *"Patryk Adamczyk" <
pada...@mozilla.com>, "John Daggett"
> "Cameron McCormack" <
hey...@gmail.com>, "Jonathan Watt"
> <
jw...@mozilla.com>, "L. David Baron" <
dba...@mozilla.com>, "Jaime
> Chen" <
jac...@mozilla.com>, "Vivien" <
vnic...@mozilla.com>, "sicking"
> *Sent: *Tuesday, June 17, 2014 11:31:18 AM
> *Subject: *Re: Icon fonts in FxOS
>
> On 17/6/14 11:10, Wilson Page wrote:
>
> The gaia-icons font currently uses ligatures to place icons, see
> here
> <
https://github.com/gaia-components/gaia-icons/blob/master/style.css#L32>.
> The ligature character sequence is derived from the original
> filename of the SVG source file in `images/`.
>
> Is this what you were referring to?
>
>
> OK, so if you're using ligatures to access the icon glyphs, can you
> modify the script that generates this font so that it does NOT assign
> PUA codepoints to the glyphs at all? It should be possible to leave
> them unencoded (i.e. with no entry in the font's cmap), so that the
> only way they can be accessed is via the ligature sequence.
>
> I see you're embedding the generated font directly in a CSS file as a
> data-URL. How's the performance of this approach? It won't be quite as
> efficient as installing the font in the base OS, because each app that
> uses it will be instantiating its own separate copy, so there must be
> a memory and perf cost. But maybe it's good enough?
>
> JK
>
> ------------------------------------------------------------------------
> *From: *"Jet Villegas" <
j...@mozilla.com>
> *To: *"Wilson Page" <
wilso...@mozilla.com>
> *Cc: *"Patryk Adamczyk" <
pada...@mozilla.com>, "John Daggett"
> "Cameron McCormack" <
hey...@gmail.com>, "Jonathan Watt"
> <
jw...@mozilla.com>, "L. David Baron" <
dba...@mozilla.com>, "Jaime
> Chen" <
jac...@mozilla.com>, "Vivien" <
vnic...@mozilla.com>,