Commit graph

43 commits

Author SHA1 Message Date
Patrick Walton
e9ec9289d6 gfx: Instantiate the CTFont corresponding to a Mac font on demand.
This avoids panics in multiprocess mode.
2015-07-31 08:42:30 -07:00
Bogdan Cuza
681b11c08b Fix #6680 2015-07-22 16:45:43 +03:00
Glenn Watson
f8eeef0eb4 Use atoms for font template structures. 2015-07-13 08:23:02 +10:00
Nicholas Nethercote
1553fada53 Instrument FreeType allocations.
This will allow reporting of memory usage by FreeType instances, which
are measured in the MiBs for LayoutWorker threads.

This change also makes FreeType allocations happen with jemalloc instead
of the system malloc, which is a good thing.

Finally, the change documents some dubiousness involving
FontContextHandle.
2015-06-10 15:48:19 -07:00
Corey Farwell
4f47b41fa7 Remove fnv & smallvec crate reexports from util
The util component specified fnv and smallvec as dependencies and publicly
reexported both of them. Several other components utilized these reexports,
presumably because fnv and smallvec used to live in the tree so reexporting
made the transition easier.

These indirect dependencies through the util component are unnecessary.

This commit removes the fnv & smallvec crate reexports in the util component.
It exchange, it adds fnv & smallvec as dependencies to non-util components
wherever needed. Finally, it removes the fnv dependency from util as it is not
utilized anywhere in the util component.
2015-06-10 07:14:55 -07:00
Corey Farwell
435e551753 Remove get_ prefix on getters
Part of #6224

I certainly didn't remove all of them; I avoided `unsafe` areas and also `components/script`
2015-06-02 08:54:44 -04:00
Ms2ger
2bfca8f96f Remove unused imports. 2015-05-06 19:20:10 +02:00
Simon Sapin
6bf830f663 Remove some unnecessary casts. 2015-05-05 20:11:26 +02:00
Simon Sapin
8b522f2e7d Rename Au methods with f32/f64 instead of frac32/frac/subpx 2015-05-05 18:23:29 +02:00
Simon Sapin
ef8edd4e87 Upgrade to rustc 551a74dddd84cf01440ee84148ebd18bc68bd7c8. 2015-05-05 10:07:34 -04:00
Ms2ger
6a55ae06d7 Remove some as_slice calls. 2015-04-24 17:44:47 +02:00
Josh Matthews
57c5b3228a Warning patrol. 2015-04-01 12:59:51 -04:00
Patrick Walton
750bbed2cb gfx: Perform more aggressive caching in
`FontContext::get_layout_font_group_for_style()`.

There are several optimizations here:

* We make font families atoms, to allow for quicker comparisons.

* We precalculate an FNV hash of the relevant fields of the font style
  structure.

* When obtaining a platform font group, we first check pointer equality
  for the font style. If there's no match, we go to the FNV hash. Only
  if both caches miss do we construct and cache a font group. Note that
  individual fonts are *also* cached; thus there are two layers of
  caching here.

15% improvement in total layout thread time for Facebook Timeline.
2015-04-01 08:58:16 -07:00
Mikko Perttunen
92a4bba785 Handle font load errors in FontContext
Thread font load errors from platform font loading code to
FontContext::get_layout_font_group_for_style, and cache the failure
result, instead of panicing the thread when a font fails to load.

Before this patch, a failed font load would panic a LayoutTask,
causing a cascade of panics, eventually aborting the whole engine
during a panic within panic.
2015-03-06 18:18:22 +02:00
Ms2ger
505159a464 Import the util crate as util rather than servo_util.
This used to conflict with the util crate from the standard library, which
has long since been removed.

The import in layout has not been changed because of a conflict with the
util mod there.
2015-01-29 12:16:41 +01:00
Patrick Walton
abddfa742f gfx: Implement font-stretch per CSS3-FONTS § 3.3 in the Core Text
font backend.
2015-01-28 12:42:52 -08:00
bors-servo
c2076d707e auto merge of #4660 : deokjinkim/servo/font_style, r=jdm
'oblique' font-style is not supported now.
When I checked freetype.h, same macro is used for italic and oblique.

  /*    FT_STYLE_FLAG_ITALIC ::                                            */
  /*      Indicates that a given face style is italic or oblique.          */

So, when font style is 'oblique', enable flag for italic.
With tests/html/test_italic_bold.html, it works well.
2015-01-28 11:51:53 -07:00
Ms2ger
01ed338746 Move to to_owned rather than into_string.
into_string has been removed from Rust.
2015-01-20 14:49:07 +01:00
Deokjin Kim
80a6f0ae08 Support 'font-style: oblique'. 2015-01-20 10:48:23 +09:00
Patrick Walton
15d60d7ea4 layout: Implement filter per CSS-FILTERS § 5.
`blur` and `drop-shadow` are not yet supported, because the
`text-shadow` PR makes some fundamental changes to blur rendering that
are needed first.
2015-01-09 07:26:13 -08:00
Ms2ger
16c7060bc8 Update rustc to revision 2cfb5acb5a2751c759627377e602bac4f88f2d19. 2015-01-08 09:58:46 -05:00
Ms2ger
d759b07299 Qualify libstyle enums. 2015-01-04 15:04:35 +01:00
Ms2ger
9068e62f2a Qualify Azure enums. 2015-01-04 15:04:26 +01:00
Manish Goregaokar
e973213606 gfx: to_string() -> into_string() 2014-12-27 14:48:35 +01:00
Tetsuharu OHZEKI
f04c64f500 Replace almost "render" to "paint" words in gfx crate. 2014-12-08 14:55:30 +09:00
Tetsuharu OHZEKI
a9839fa18e Rename RenderFontCacheEntry -> PaintFontCacheEntry. 2014-12-08 14:17:16 +09:00
Jack Moffitt
d1b433a3b3 Rust upgrade to rustc hash b03a2755193cd756583bcf5831cf4545d75ecb8a 2014-11-13 11:17:43 +10:00
Glenn Watson
b1c226778f Cache last fontgroup. Style recalc on wikipedia/rust 66ms -> 41ms. 2014-10-24 08:25:10 +10:00
bors-servo
a6f0159cb8 auto merge of #3765 : pcwalton/servo/profiler-cleanups, r=cgaebel
The only real user-visible change this effects is to trim URLs to 30 characters so they don't make huge lines on the terminal.

r? @cgaebel
2014-10-22 14:45:35 -06:00
Patrick Walton
d2d012165f util: Make some minor formatting cleanups to profiling and gfx 2014-10-22 07:49:56 -07:00
Patrick Walton
55222336b5 gfx: Paint in parallel in CPU painting mode 2014-10-22 07:47:47 -07:00
Glenn Watson
8331cfe089 Convert internal font code to store pt size as Au. 2014-10-22 13:49:41 +10:00
Patrick Walton
79f84a62fe gfx: Make fonts that fail to match hit the cache too.
50%-100% layout perf improvement on CNN.
2014-10-20 22:05:38 -07:00
Glenn Watson
b816550a17 Remove render backend option as it doesn't work and confuses people. 2014-10-20 07:39:36 +10:00
Patrick Walton
a6fcec468f layout: Remove FontStyle in favor of using the font style struct
directly, and optimize `get_layout_font_group()` to use a small vector.

Seems to be a 38% layout win on a site I tested with a lot of text.
2014-10-15 22:17:57 -07:00
Glenn Watson
a70850c261 Fix selection of fallback fonts. Fixes monospace fonts in rust guide.
Previously, any font template that could not be found would return
an item from the last resort font family. Now, the last resort font
family is only searched if the entire list of supplied font families
is empty.
2014-10-13 15:39:53 +10:00
Glenn Watson
f7b7a96961 Add fixme comment for future work, make scale factor a constant. 2014-09-24 06:00:46 +10:00
Glenn Watson
0dd1b85739 Add support for small-caps font-variant.
Ref: 2554.
2014-09-23 14:21:41 +10:00
Keegan McAllister
dc86e83654 Eliminate warnings 2014-09-20 13:00:55 -07:00
Glenn Watson
d9662fc571 Fix font flickering due to missed check in font cache. 2014-09-16 14:35:22 +10:00
Glenn Watson
df48e33926 Fix comment and and reference to bug #3300 2014-09-12 14:00:55 +10:00
Glenn Watson
9ec3c9374d Reduce number of font instances and shaper structures created.
The font cache previously kept weak references to the fonts,
however in layout these fonts are dropped before they are
referenced again, so no caching was being used.

For now, just hold a strong reference in the cache, which means
that fonts will never be thrown out (this will need to be fixed
in the future).
2014-09-12 13:17:44 +10:00
Jack Moffitt
c6ab60dbfc Cargoify servo 2014-09-08 20:21:42 -06:00
Renamed from src/components/gfx/font_context.rs (Browse further)