aboutsummaryrefslogtreecommitdiffstats
path: root/components/gfx/text/util.rs
Commit message (Collapse)AuthorAgeFilesLines
* Rename `gfx` to `fonts` (#32556)Martin Robinson2024-06-191-11/+0
| | | | | | | | | This crate only takes care of fonts now as graphics related things are split into other crates. In addition, this exposes data structures at the top of the crate, hiding the implementation details and making it simpler to import them. Signed-off-by: Martin Robinson <mrobinson@igalia.com> Co-authored-by: Mukilan Thiyagarajan <mukilan@igalia.com>
* base: Remove `ucd` dependency (#32424)Martin Robinson2024-06-031-43/+0
| | | | | | | | | | | | | | Remove the `ucd` dependency which has not been updated in 8 years. In addition, replace it with a generated UnicodeBlock enum which reflects the modern Unicode standard. This is generated via a Python script which is included in the repository. The generation is not part of the build process, because the Unicode database is hosted on the web and it does not change the frequently. This is done instead of bringing in the more up-to-date `unicode_blocks` dependency. `unicode_blocks` defines each block as constant, which means that they cannot be used in match statements -- which we do in Servo. Co-authored-by: Lauryn Menard <lauryn.menard@gmail.com>
* layout: Add support for `white-space-collapse: break-spaces` (#32388)Martin Robinson2024-05-301-100/+0
| | | | | | | | | | | | | | This change adds support for `white-space-collapse: break-spaces` and adds initial parsing support for `overflow-wrap` and `word-break`. The later two properties are not fully supported, only in their interaction with `break-spaces`. This is a preliminary change preparing to implement them. In addition, `break_and_shape` is now forked and added to Layout 2020. This function is going to change a lot soon and forking is preparation for this. More code that is only used by Layout 2013 is moved from `gfx` to that crate. Co-authored-by: Rakhi Sharma <atbrakhi@igalia.com>
* fonts: Consider Tertiary Ideographic Plane to be CJK (#31670)sandeep2024-03-181-1/+2
| | | | | | | | | | | | | | | | | | | | * added check for Tertiary Ideographic Plane * added unit test for is_cjk function Signed-off-by: Sandeep Pillai <sandeeppillai@Sandeeps-MacBook-Air.local> * fixed formatting Signed-off-by: Sandeep Pillai <sandeeppillai@Sandeeps-MacBook-Air.local> * removed for loop assertions & added TIP chars Signed-off-by: Sandeep Pillai <sandeeppillai@Sandeeps-MacBook-Air.local> --------- Signed-off-by: Sandeep Pillai <sandeeppillai@Sandeeps-MacBook-Air.local> Co-authored-by: Sandeep Pillai <sandeeppillai@Sandeeps-MacBook-Air.local>
* clippy: fix warnings in components/gfx (#31560)eri2024-03-081-6/+1
| | | | | | | * clippy: fix warnings in components/gfx * refactor: switched the order of impl so that its intent is clearer * fix: add font context default in other platforms
* Fix some new warningsSimon Sapin2019-06-221-2/+2
|
* Update MPL license to https (part 4)Jan Andre Ikenmeyer2018-11-191-1/+1
|
* Format gfx text #21373kingdido9992018-09-071-19/+20
|
* Implement font fallbackJon Leighton2018-05-191-0/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Prior to this change, if none of the fonts specified in CSS contained a glyph for a codepoint, we tried only one fallback font. If that font didn't contain the glyph, we'd give up. With this change, we try multiple fonts in turn. The font names we try differ across each platform, and based on the codepoint we're trying to match. The current implementation is heavily inspired by the analogous code in Gecko, but I've used to ucd lib to make it more readable, whereas Gecko matches raw unicode ranges. This fixes some of the issues reported in #17267, although colour emoji support is not implemented. == Notes on changes to WPT metadata == === css/css-text/i18n/css3-text-line-break-opclns-* === A bunch of these have started failing on macos when they previously passed. These tests check that the browser automatically inserts line breaks near certain characters that are classified as "opening and closing punctuation". The idea is that if we have e.g. an opening parenthesis, it does not make sense for it to appear at the end of a line box; it should "stick" to the next character and go into the next line box. Before this change, a lot of these codepoints rendered as a missing glyph on Mac and Linux. In some cases, that meant that the test was passing. After this change, a bunch of these codepoints are now rendering glyphs on Mac (but not Linux). In some cases, the test should continue to pass where it previously did when rendering with the missing glyph. However, it seems this has also exposed a layout bug. The "ref" div in these tests contains a <br> element, and it seems that this, combined with these punctuation characters, makes the spacing between glyphs ever so slightly different to the "test" div. (Speculation: might be something to do with shaping?) Therefore I've had to mark a bunch of these tests failing on mac. === css/css-text/i18n/css3-text-line-break-baspglwj-* === Some of these previously passed on Mac due to a missing glyph. Now that we're rendering the correct glyph, they are failing. === css/css-text/word-break/word-break-normal-bo-000.html === The characters now render correctly on Mac, and the test is passing. But we do not find a suitable fallback font on Linux, so it is still failing on that platform. === css/css-text/word-break/word-break-break-all-007.html === This was previously passing on Mac, but only because missing character glyphs were rendered. Now that a fallback font is able to be found, it (correctly) fails. === mozilla/tests/css/font_fallback_* === These are new tests added in this commit. 01 and 02 are marked failing on Linux because the builders don't have the appropriate fonts installed (that will be a follow-up). Fix build errors from rebase FontTemplateDescriptor can no longer just derive(Hash). We need to implement it on each component part, because the components now generally wrap floats, which do not impl Hash because of NaN. However in this case we know that we won't have a NaN, so it is safe to manually impl Hash.
* order derivable traits listsClément DAVID2017-08-231-1/+1
| | | | | | Ignoring : - **generated**.rs - python/tidy/servo_tidy_tests/rust_tidy.rs
* Add support for `pre-wrap` and `pre-line` values for `white-space`.Eli Friedman2015-10-201-1/+1
| | | | | | | This is mostly straightforward. I had to modify a couple of places which were accidentally discarding whitespace. Fixes #1513.
* layout: Rewrite whitespace stripping.Patrick Walton2015-08-111-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch makes Servo unconditionally strip whitespace before text run scanning (assuming that the `white-space` property allows it). Whitespace stripping during reflow is now only used for handling whitespace at the ends of lines; reflow now never attempts to handle ignorable whitespace. Many CSS tests pass now. There are some new failures, however. The following reference tests now fail due to a pre-existing bug whereby whitespace is used to calculate the position of inline hypothetical boxes for elements with `display: inline; position: absolute`: * `absolute-replaced-height-036.htm` * `vertical-align-sub-001.htm` * `vertical-align-super-001.htm` The following reference tests fail due to a pre-existing bug whereby we don't handle `font-size: 0` properly in inline reflow: * `font-size-zero-1.htm` * `font-size-zero-2.htm` The following reference test fails due to the fact that it relied on our incorrect insertion of whitespace to make room for the black background: * `inline-formatting-context-007.htm`
* Implement the unicode-bidi propertyMatt Brubeck2015-08-031-3/+12
|
* Remove dead code from gfx/textMatt Brubeck2015-07-141-9/+0
|
* Implement Clone for Copy types.Ms2ger2015-04-281-1/+1
|
* layout: Simplify and improve the correctness of whitespace stripping inPatrick Walton2015-04-081-15/+2
| | | | | | | | | text layout, and unify the inline layout paths for pre- and normally-formatted text. This fixes a lot of "jumpiness" and removes the `new_line_pos` stuff. Closes #2260.
* Auto merge of #5571 - jdm:gfx_uint, r=Ms2gerbors-servo2015-04-081-8/+8
|\ | | | | | | r? @Ms2ger
| * Remove int_uint feature from gfx.Josh Matthews2015-04-071-8/+8
| |
* | Move gfx unit tests to the unit_tests crate.Simon Sapin2015-04-071-160/+0
|/
* Update rustc to 00b112c45a604fa6f4b59af2a40c9deeadfdb7c6/rustc-1.0.0-dev.Josh Matthews2015-01-281-1/+1
|
* Write a macro or syntax extension to generate OpenType tagsGilles Leblanc2015-01-151-14/+0
| | | | Fixes #4556
* Update rustc to revision 2cfb5acb5a2751c759627377e602bac4f88f2d19.Ms2ger2015-01-081-1/+1
|
* Reformat the transform_text tests.Ms2ger2014-12-301-29/+83
|
* Cleanup the transform_text tests.Ms2ger2014-12-281-105/+56
|
* Re-enable two transform_text unit tests.Ms2ger2014-12-271-41/+49
| | | | Note that I had to change some expectations to make them pass.
* gfx: to_string() -> into_string()Manish Goregaokar2014-12-271-30/+30
|
* gfx: Remove glob imports added in #4405Tetsuharu OHZEKI2014-12-191-10/+8
|
* Update rustc to revision 3dcd2157403163789aaf21a9ab3c4d30a7c6494d.Ms2ger2014-12-171-0/+2
|
* Rust upgrade to rustc hash b03a2755193cd756583bcf5831cf4545d75ecb8aJack Moffitt2014-11-131-3/+3
|
* layout: Rewrite text and inline fragment handling during flowPatrick Walton2014-10-201-11/+16
| | | | | | | construction to avoid cloning and moving flows so much. Besides amounting to a 5%-10% win on a page with a lot of text, this simplifies and refactors the text layout code.
* gfx: Fix imprecision in `float_to_fixed`.Patrick Walton2014-10-011-1/+1
| | | | Improves text rendering a lot.
* Remove redundant into_string() calls.Ms2ger2014-09-231-1/+1
|
* Cargoify servoJack Moffitt2014-09-081-0/+285