Commit graph

10 commits

Author SHA1 Message Date
Jon Leighton
f22e5ef3bd Lazy load fonts in a FontGroup
This is a step towards fixing #17267. To fix that, we need to be able to
try various different fallback fonts in turn, which would become
unweildy with the prior eager-loading strategy.

Prior to this change, FontGroup loaded up all Font instances, including
the fallback font, before any of them were checked for the presence of
the glyphs we're trying to render.

So for the following CSS:

    font-family: Helvetica, Arial;

The FontGroup would contain a Font instance for Helvetica, and a Font
instance for Arial, and a Font instance for the fallback font.

It may be that Helvetica contains glyphs for every character in the
document, and therefore Arial and the fallback font are not needed at
all.

This change makes the strategy lazy, so that we'll only create a Font
for Arial if we cannot find a glyph within Helvetica. I've also
substantially refactored the existing code in the process and added
some documentation along the way.
2018-02-22 16:36:05 +01:00
Emilio Cobos Álvarez
af879523ea
style: Make all keywords CamelCase for consistency.
This prevents confusion and paves the ground for derive(Parse) of them.
2017-12-06 02:35:10 +01:00
Xidorn Quan
8b842f5417 Use integer for specified and computed font-weight 2017-07-06 15:31:24 +10:00
Simon Sapin
316cd35767 Untry 2017-06-18 13:21:51 +02:00
hinaria
ead828d992 scale line gap by em size 2017-06-15 23:46:17 +10:00
Dominik Boehi
ecab3cd796 Fix panic when font face name is not available 2017-04-12 20:36:27 +02:00
Jonathan Turner
cf911cef28 Change windows font metrics 2017-03-20 11:57:39 +13:00
Vladimir Vukicevic
a9611c31a7 Implement downloadable fonts on Windows 2017-01-18 13:30:58 -05:00
Vladimir Vukicevic
473df194fc tidy and warning fixes 2016-11-10 16:07:40 -05:00
Vladimir Vukicevic
db357b0334 DirectWrite font backend for Windows 2016-11-10 14:58:51 -05:00