Commit graph

73 commits

Author SHA1 Message Date
Simon Sapin
789807b7b0 Remove the ComputedValue traits and style_struct_traits 2016-07-20 08:42:40 +02:00
Matt Brubeck
e588943b4f Always include the last-resort font
This is used as a fallback for any characters that don't have glyphs in the
specified font.
2016-05-24 08:30:44 -07:00
Ms2ger
a732c3ff76 Simplify FontContext::create_layout_font. 2016-05-17 14:08:43 +02:00
Matt Brubeck
1c5ec6f3ec Make some Font fields private 2016-05-13 16:33:20 -07:00
Matt Brubeck
4361f92067 Remove unnecessary ServoFont type alias 2016-05-13 16:20:59 -07:00
Patrick Walton
18fbf8cf30 gfx: Clamp the font size we supply to Core Text to 0.01pt.
Core Text treats a font size of 0.0 as 12.0, which is obviously not what
we want.

Improves Twitter.
Improves Reddit /r/rust.

Closes #10492.
2016-04-11 13:52:41 -07:00
Glenn Watson
c0531c312f Add WebRender integration to Servo.
WebRender is an experimental GPU accelerated rendering backend for Servo.

The WebRender backend can be specified by running Servo with the -w option (otherwise the default rendering backend will be used).

WebRender has many bugs, and missing features - but it is usable to browse most websites - please report any WebRender specific rendering bugs you encounter!
2016-02-18 10:35:29 +10:00
bors-servo
87aaa5ffe0 Auto merge of #9523 - ruud-v-a:hasher, r=Wafflespeanut
Upgrade to new Hasher API

This fixes #9494.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.svg" height="40" alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/9523)
<!-- Reviewable:end -->
2016-02-05 07:32:13 +05:30
Anthony Ramine
cb5cd8d881 Say farewell to in-tree HeapSizeOf 2016-02-04 22:03:32 +01:00
Ruud van Asseldonk
95be0b9a25 Upgrade to new Hasher API 2016-02-03 20:06:39 +01:00
Vladimir Vukicevic
025ed57c04 win32: use fontconfig/freetype on windows as well (for now) 2016-01-20 08:38:20 -06:00
rohan.prinja
1f02c4ebbb task -> thread 2016-01-10 17:58:13 +09:00
Patrick Walton
154f970b5b Remove the fontgroup address cache.
It's not clear to me that it actually helps. Moreover, it's wrong and
results in fonts randomly changing e.g. on GitHub when mousing over
elements.
2016-01-06 17:06:59 -08:00
bors-servo
ebf4ce8288 Auto merge of #9070 - antrik:debug-fonts, r=nox
Derive Debug for more font-related types

Needs to pull in newer ipc-channel and azure.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/9070)
<!-- Reviewable:end -->
2016-01-03 08:11:57 +05:30
Olaf Buddenhagen
3c5a3ca4ff Derive Debug for more font-related types 2016-01-03 02:54:55 +01:00
David Raifaizen
d942bfb474 Enabled use of FontFamily enum type and replaced plain string parameters with enum 2015-12-30 18:21:37 -05:00
Ms2ger
70653bfe08 Remove unused imports. 2015-12-12 02:13:59 -05:00
Patrick Walton
b31a3b3883 Cache font style struct addresses in a separate font group cache.
On http://en.wikipedia.org/wiki/Spotted_hyena, I was seeing a 100% miss
rate in the first fast cache lookup and 45% of total layout time in this
function. After making this change, the first cache lookup almost always
succeeds, and the time spent in this function drops to 8%.
2015-12-11 15:43:32 -05:00
Anthony Ramine
6d6dbf0129 Derive PartialEq on the style Font structure
We check the hash first.
2015-10-08 00:32:58 +02:00
Ms2ger
05ed98a49c Check for font_variant equality in LayoutFontGroupCacheKey::eq.
This fixes an issue whereby normal text would intermittently be rendered as
small-caps and vice versa.
2015-10-02 11:02:35 +02:00
Glenn Watson
339a3f869b Split Au type into separate crate, with minimal dependencies. 2015-10-01 07:16:11 +10:00
Patrick Walton
1892b27daf layout: Do a couple of minor style cleanups. 2015-09-27 15:38:22 -07:00
Patrick Walton
9bb6acd690 layout: Load Web fonts asynchronously.
Improves page load times significantly.

Closes #7343.
2015-09-27 15:38:20 -07:00
Brandon Fairchild
de3547e401 Fix reported test-tidy errors for unmerged import blocks
This merges import blocks that were reported by tidy as unmerged.
2015-09-19 12:50:14 -04:00
Mathieu Rheaume
7320433cca Remove 'get_*' on getters as per RFC 0344 on various components 2015-09-12 20:14:01 -04:00
erneyja
17663315dd make test-tidy check that = have space after them 2015-09-01 07:18:19 -04:00
Johann Tuffe
ec07178b6f sort all uses 2015-08-20 20:47:12 +08:00
Josh Matthews
8bb853f643 Fix existing syntactics nits. 2015-08-16 10:30:43 -04:00
João Oliveira
0038580abf Replace uses of for foo in bar.iter() and for foo in bar.iter_mut()
closes #7197
2015-08-15 02:27:39 +01:00
João Oliveira
9c11781880 replace .len() == 0 with is_empty()
closes #7198
2015-08-14 04:00:33 +01:00
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