Go to file
Patrick Walton 314185684c Implement stem darkening and split ECAA into ECAA and MCAA.
We now implement stem darkening (also known as font dilation) like
macOS and FreeType under certain configurations. This pushes out font
outlines along their normals slightly in order to make small text easier
to read. This is especially important when performing gamma correction,
as otherwise text can end up too light.

Because the stem darkening is implemented in the vertex shader, it can
easily break the mesh. Therefore, I needed to implement a new rendering
mode that does not use the mesh. It's a variant of ECAA, and for
clarity's sake I've renamed the related antialiasing methods:

* MCAA stands for "mesh coverage antialiasing" and is the new name for
what was called "ECAA" prior to this patch.

* ECAA now stands for "edge coverage antialiasing". It does not use the
mesh but rather computes winding numbers from scratch for every pixel.
Surprisingly, despite being worse asymptotically, this usually ends up
being faster than MCAA at small font sizes, presumably because there are
fewer vertices to transform.

* XCAA, "exact coverage antialiasing" is a generic term that refers to
both ECAA and MCAA. References to ECAA have been changed to XCAA as
needed.
2017-10-15 13:28:49 -07:00
demo Implement stem darkening and split ECAA into ECAA and MCAA. 2017-10-15 13:28:49 -07:00
font-renderer Make FreeType no longer a dependency of `path-utils` 2017-10-04 19:03:38 -07:00
partitioner Implement stem darkening and split ECAA into ECAA and MCAA. 2017-10-15 13:28:49 -07:00
path-utils Implement stem darkening and split ECAA into ECAA and MCAA. 2017-10-15 13:28:49 -07:00
resources Use the Inter UI font in the demo 2017-09-28 15:23:52 -07:00
shaders/gles2 Implement stem darkening and split ECAA into ECAA and MCAA. 2017-10-15 13:28:49 -07:00
.gitignore Partially refactor the path APIs to be streaming, like Lyon 2017-09-08 13:09:00 -07:00
LICENSE-APACHE Add a license file to `partitionfinder/`, and copy it into the root directory too so that GitHub 2017-08-07 10:22:10 -07:00
LICENSE-MIT Add a license file to `partitionfinder/`, and copy it into the root directory too so that GitHub 2017-08-07 10:22:10 -07:00
README.md Implement stem darkening and split ECAA into ECAA and MCAA. 2017-10-15 13:28:49 -07:00

README.md

Pathfinder 2

Pathfinder 2 is a fast, practical, work in progress GPU-based rasterizer for fonts and vector graphics using OpenGL and OpenGL ES 2.0+.

Please note that Pathfinder is under heavy development and is incomplete in various areas.

The project features:

  • Low setup time. Typical glyph outlines can be prepared for GPU rendering in about 5 microseconds each (typically O(n log n) in the number of vertices), making Pathfinder suitable for dynamic environments. The setup process is lossless and fully resolution independent; paths need only be prepared once and can thereafter be rendered at any zoom level without any loss in quality. For static paths such as game assets, the resulting meshes can be saved to disk to avoid having to generate them at runtime.

  • High quality antialiasing. Pathfinder can compute exact fractional trapezoidal area coverage on a per-pixel basis for the highest-quality antialiasing, provided that either OpenGL 3.0+ or a few common extensions are available. Supersampling is available as an alternative for 3D scenes and/or lower-end hardware.

  • Fast rendering, even at small pixel sizes. Even on lower-end GPUs, Pathfinder typically matches or exceeds the performance of the best CPU rasterizers. The difference is particularly pronouced at large sizes, where Pathfinder regularly achieves multi-factor speedups. All shaders have no loops and minimal branching.

  • Advanced font rendering. Pathfinder can render fonts with slight hinting and can perform subpixel antialiasing on LCD screens. It can do stem darkening/font dilation like macOS and FreeType in order to make text easier to read at small sizes. The library also has experimental support for sRGB (gamma correction).

  • Support for full vector scenes. Pathfinder 2 is designed to efficiently handle workloads that consist of many overlapping vector paths, such as those commonly found in SVG and PDF files. It makes heavy use of the hardware Z buffer to perform occlusion culling, which often results in dramatic performance wins over typical software renderers that use the painter's algorithm.

  • 3D capability. Pathfinder 2 can render fonts and vector paths in 3D environments. Vector meshes are rendered just like any other mesh, with a simple shader applied.

  • Portability to most GPUs manufactured in the last decade, including integrated and mobile GPUs. Geometry, tessellation, and compute shader functionality is not required.

Building

Pathfinder 2 is a set of modular packages, allowing you to choose which parts of the library you need. A WebGL demo is included, so you can try Pathfinder right in your browser. (Please note that, like the rest of Pathfinder, it's under heavy development and has known bugs.)

To run the demo, make sure NPM and nightly Rust are installed, and run the following commands:

$ cd demo/client
$ npm install
$ npm run build
$ cd ../server
$ cargo run --release

Then navigate to http://localhost:8000/.

Authors

The primary author is Patrick Walton (@pcwalton), with contributions from the Servo development community.

Pathfinder abides by the same Code of Conduct as Rust itself.

License

Licensed under the same terms as Rust itself. See LICENSE-APACHE and LICENSE-MIT.