aboutsummaryrefslogtreecommitdiffstats
path: root/components/layout/text.rs
Commit message (Collapse)AuthorAgeFilesLines
* fonts: Add `FontIdentifier` and `LocalFontIdentifier` (#31658)Martin Robinson2024-03-141-3/+3
| | | | | | | | | | | | | | | | | | | Instead of using a simple `Atom` to identify a local font, use a data structure. This allows us to carry more information necessary to identify a local font (such as a path on MacOS). We need this for the new version of WebRender, as fonts on MacOS now require a path. This has a lot of benefits: 1. We can avoid loading fonts without paths on MacOS, which should avoid a lot of problems with flakiness and ensure we always load the same font for a given identifier. 2. This clarifies the difference between web fonts and local fonts, though there is more work to do here. 3. This avoid a *lot* of font shenanigans, such as trying to work backwards from the name of the font to the path of the font we actually matched. In general, we can remove a lot of code trying to accomplish these shenanigans. 4. Getting the font bytes always returns an `Arc` now avoiding an extra full font copy in the case of Canvas.
* clippy: Fix warnings in `components/layout` (#31612)eri2024-03-111-4/+5
| | | | | * clippy: fix warnings in components/layout * fix: formatting
* layout: Turn on synthetic small-caps for layout 2020 (#31435)Martin Robinson2024-02-281-3/+6
| | | | | | | | | | | | Synthetic small caps is supported by the font subsystem, but this is disabled in Layout 2020. We can turn this on to bring support to parity with the old layout system. In addition to turning on synthetic small-caps this change also improves the way that they work. Before, synthetic small caps meant that every character was a small version of capitalized character. After this change, capital letters are larger than small caps versions of small letters -- matching other browsers and the common expectation of how small caps works.
* Lint layout_2013 with clippy (#31221)Oriol Brufau2024-01-301-17/+15
| | | | | | | | | * Lint layout_2013 with clippy CARGO_BUILD_RUSTC=rustc cargo clippy --fix -p layout_2013 --broken-code * ./mach fmt * Cosmetic adjustments
* Further changes required by ServoOriol Brufau2023-11-041-1/+1
|
* Don't panic when no font is found for a TextRun (#30581)Martin Robinson2023-10-191-6/+19
| | | | Instead of panicking when no found is found for a TextRun, instead print a warning. This prevents panics on pages with very large font sizes.
* Strict import formatting (grouping and granularity) (#30325)Samson2023-09-111-9/+13
| | | | | * strict imports formatting * Reformat all imports
* remove `extern crate` (#30311)Samson2023-09-081-0/+1
| | | | | | | | | | | * remove extern crate * Update components/script_plugins/lib.rs Co-authored-by: Martin Robinson <mrobinson@igalia.com> --------- Co-authored-by: Martin Robinson <mrobinson@igalia.com>
* Revert "Revert "Update font-kit and freetype and unicode-script.""Josh Matthews2020-08-101-2/+2
| | | | This reverts commit 10ae3bfbbb2383d349de6150434cc47c6ad1c8e9.
* Revert "Update font-kit and freetype and unicode-script."Josh Matthews2020-08-041-2/+2
| | | | This reverts commit 5c0d7998bd28ceb383f553cd7af5a60f472a47ba.
* Update font-kit and freetype and unicode-script.Josh Matthews2020-07-311-2/+2
|
* layout: Resolve word_spacing ahead of time.Emilio Cobos Álvarez2020-02-121-2/+19
| | | | | | | It's not possible anymore, in the presence of min() / max(), to split a <length-percentage> value into a <length> and a <percentage> component. Tweak word_spacing to do what Gecko does (resolving it in advance).
* Servo build fixes.Emilio Cobos Álvarez2019-12-161-1/+1
|
* layout: fix Servo build.Emilio Cobos Álvarez2019-05-071-6/+6
|
* layout: Fix servo build.Emilio Cobos Álvarez2019-03-131-12/+9
|
* Rustfmt has changed its default style :/Simon Sapin2018-12-281-6/+6
|
* Update MPL license to https (part 4)Jan Andre Ikenmeyer2018-11-191-1/+1
|
* Reorder importsPyfisch2018-11-061-3/+3
|
* Sort `use` statementsSimon Sapin2018-11-061-2/+2
|
* `cargo fix --edition`Simon Sapin2018-11-061-6/+6
|
* Layout: Remove redundant deny unsafe and formatPyfisch2018-10-221-2/+0
| | | | | | Add license to two files. Bypass DisplayListBuilder for some items.
* Rustfmt layout cratePyfisch2018-09-011-149/+202
|
* layout: script: Fix build.Emilio Cobos Álvarez2018-06-231-2/+2
|
* Update dependencies to use new_debug_unrechableMatt Brubeck2018-06-061-2/+2
| | | | Because reem/rust-debug-unreachable#6 makes `debug_unreachable` enable debug checks even in release builds since Rust 1.0.
* Don't perform font matching for control charactersJon Leighton2018-05-191-52/+54
| | | | | | | | We can encounter control characters here, for example when processing a <pre> element which contains newlines. Control characters are inherently non-printing, therefore if we try to call find_by_codepoint for these characters we will end up triggering an unnecessary font fallback search.
* Add test for FontContext/FontGroup functionalityJon Leighton2018-02-221-4/+4
| | | | | | | | | | | | | | | | | | | | | | Unfortunately, this required quite a bit of changes to the non-test code. That's because FontContext depends on a FontCacheThread, which in turn depends on a CoreResourceThread and therefore lots of other data structures. It seemed like it would be very difficult to instantiate a FontContext as it was, and even if we could it seems like overkill to have all these data structures present for a relatively focused test. Therefore, I created a FontSource trait which represents the interface which FontContext uses to talk to FontCacheThread. FontCacheThread then implements FontSource. Then, in the test, we can create a dummy implementation of FontSource rather than using FontCacheThread. This actually has the advantage that we can make our dummy implementation behave in certain specific way which are useful for testing, for example it can count the number of times find_font_template() is called, which helps us verify that caching/lazy-loading is working as intended.
* Lazy load fonts in a FontGroupJon Leighton2018-02-221-25/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* style: Move content property out of mako.Igor Gutorov2018-02-071-1/+1
|
* Share line breaking state across text runsManish Goregaokar2018-01-241-12/+33
| | | | Fixes #874
* style: Make all keywords CamelCase for consistency.Emilio Cobos Álvarez2017-12-061-15/+17
| | | | This prevents confusion and paves the ground for derive(Parse) of them.
* Bump bitflags to 1.0 in every servo crateBastien Orivel2017-10-301-14/+13
|
* Backed out changeset e64e659c077d: servo PR #18809 and revendor for reftest ↵Gecko Backout2017-10-191-13/+14
| | | | | | failures, e.g. in layout/reftests/bugs/392435-1.html. r=backout on a CLOSED TREE Backs out https://github.com/servo/servo/pull/18809
* Update bitflags to 1.0 in every servo crateBastien Orivel2017-10-191-14/+13
| | | | | It still needs dependencies update to remove all the other bitflags versions.
* Remove usage of unstable box syntax, except in the script crateSimon Sapin2017-10-121-6/+9
| | | | | … because there’s a lot of it, and script still uses any other unstable features anyway.
* stylo: Add keyword info to computed value of font-sizeManish Goregaokar2017-09-231-1/+1
|
* Introduce CSSPixelLength and update NonNegativeLength.Boris Chiou2017-09-131-7/+8
| | | | | | | | | | | First, we define computed::CSSPixelLength which contains a CSSFloat, a pixel value, and then we replace computed::Length with CSSPixelLength. Therefore, the |ComputedValue| of NoCalcLength, AbsoluteLength, FontRelativeLength, ViewportPercentageLength, CharacterWidth, and PhysicalLength is CSSPixelLength. Besides, we drop NonNegativeAu, and replace computed::NonNegativeLength with NonNegative<computed::Length>. (i.e. NonNegative<CSSPixelLength>)
* order derivable traits listsClément DAVID2017-08-231-1/+1
| | | | | | Ignoring : - **generated**.rs - python/tidy/servo_tidy_tests/rust_tidy.rs
* Upgrade to rustc 1.21.0-nightly (13d94d5fa 2017-08-10)Simon Sapin2017-08-151-1/+1
|
* Bug 1374233 - Part 12: Implement ToAnimatedValue for LineHeight.Boris Chiou2017-08-041-2/+2
| | | | | | | Besides, we replace its type with GenericLineHeight<NonNegativeNumber, NonNegativeAu>. MozReview-Commit-ID: GGOGXyUFJsJ
* Bug 1374233 - Part 3: Use NonNegativeAu as computed values for font-size ↵Boris Chiou2017-08-041-1/+1
| | | | | | | | related properties. For font-size and font-size-adjust. MozReview-Commit-ID: 5rrfVSzB7WF
* Replace all uses of the style::stylearc alias with servo_arc.Michael Partheil2017-07-191-1/+1
| | | | | | The alias is left there temporarilly and will be removed completely in a later commit where also components/style/gecko/generated/structs_{debug|release}.rs are re-generated (they still use the old alias).
* stylo: Use ComputedValuesInner instead of ComputedValues when we don't need itManish Goregaokar2017-07-171-2/+2
|
* Use BorderSideWidth for outline-widthAnthony Ramine2017-06-021-1/+1
|
* Use generics for text spacing propertiesAnthony Ramine2017-06-021-5/+5
|
* Use generics for the line-height propertyAnthony Ramine2017-06-021-4/+5
|
* [gfx] [layout] [style] Upgrade unicode-bidi to 0.3Behnam Esfahbod2017-05-221-8/+8
|
* Fix up script and layout.Bobby Holley2017-05-021-1/+1
|
* Overwrite default RunInfo values with the first real ones encountered.Josh Matthews2017-04-131-11/+16
|
* Convert text-orientation to a Gecko-only propertyMatt Brubeck2017-01-271-16/+3
| | | | | | Remove incomplete and buggy support for text-orientation in Servo. Make the property values align with Gecko and the latest draft of CSS Writing Modes Level 3.
* layout: Remove get_font_arc in favor of clone_font.Emilio Cobos Álvarez2016-12-311-1/+1
| | | | Since they do the same.