Commit Graph

44 Commits

Author SHA1 Message Date
Patrick Walton 9b7da26d1e Update `core-graphics` and `core-text` 2018-07-20 16:48:10 -07:00
Patrick Walton 0a1adb0e18 iOS support 2018-07-18 08:24:09 -07:00
Nicolas Silva 46d1878ef5 Update lyon and euclid dependencies. 2018-07-11 00:27:42 +02:00
Bastien Orivel 42d1c439aa Update core-graphics, core-text and bump version 2018-07-09 12:50:43 +02:00
fschutt 9223717234 Fixed calculation of glyph dimensions on Windows
The dimensions in the `DWRITE_GLYPH_METRICS` are a bit special:
the `rightSideBearing` is measured from the right edge of the
character boundary, not the left edge.

So, doing (right - left) would usually return a negative or very
small number, which, when casted to a u32 in an unsafe block, would
silently overflow to a very large number and make webrender crash.

Therefore, in order to calculate the metrics correctly, we have
to first calculate the full width of the character, then subtract
the right and left edges, same width the height.
2018-05-03 07:55:40 +02:00
fschutt 80a872ca46 Add add_native_font function to get feature parity on Windows + publicly export necessary types 2018-04-13 13:24:53 +02:00
fschutt ddcde6d1ae Fix the API of glyph_dimensions to make webrender compile on Windows 2018-04-13 11:50:52 +02:00
Patrick Walton f755002983 Switch to the crates.io version of Servo's `freetype` library 2018-04-09 13:28:31 -07:00
Patrick Walton 6e1fe50202 Switch to Servo's version of the FreeType library bindings.
This enables compatibility with WebRender on Linux.
2018-04-09 12:41:41 -07:00
Patrick Walton d66a5b6c54 Update to `env-logger` 0.5 2018-03-30 14:25:52 -07:00
Joshua Yanovski c7064b31ce
The Send impl for `FontContext` is too forgiving.
I'm pretty confident that it is only thread safe if FK is (or another way of putting it is, I'm pretty sure if you include an `Rc<_>` in FK it should not be safe to share between threads).
2018-03-09 01:20:49 +01:00
Patrick Walton aa3ecf28a5 Quantize to subpixel boundaries.
This doesn't break meshes the way the previous "discard if too thin"
code did. It fixes several issues observed on Wikipedia when using
Pathfinder in Firefox.

Closes #72.
2018-03-06 19:20:19 -08:00
Patrick Walton 18121208d4 Update euclid to 0.17 and Lyon to 0.10 2018-03-06 15:06:06 -08:00
Patrick Walton 07d978909c Get the DirectWrite backend compiling again.
Partially addresses #69.
2018-03-06 12:24:30 -08:00
Patrick Walton f718aa9ce3 Make the FreeType API match the Core Graphics one 2018-03-05 17:15:17 -08:00
Patrick Walton fad7f2f343 Fix FreeType build 2018-03-05 15:04:52 -08:00
Patrick Walton 5d3c1f6d59 Abstract away `FontKey` so WebRender can more easily use this; switch
from angle measurement to scale-dependent hull height
2018-03-05 11:27:18 -08:00
Patrick Walton 5bd68dec65 Port Pathfinder to use Lyon for Bézier curve math.
This removes a whole lot of code from `pathfinder_path_utils`. Hopefully
the remaining code can go upstream.

These changes regress quality of stroke widths for cubic curves, because
they move fill-to-stroke conversion before cubic-to-quadratic
conversion. To fix that, we will need to recursively subdivide when
doing fill-to-stroke conversion.
2018-01-29 12:47:47 -08:00
Patrick Walton 952186c638 Document `pathfinder_font_renderer`. 2018-01-05 16:59:49 -08:00
Patrick Walton c68f16f6ba Write more API documentation 2018-01-05 15:52:15 -08:00
Patrick Walton 86df78f939 Flesh out the integration test more 2017-11-17 17:06:59 -08:00
Patrick Walton ca0387d355 Get reference and rendered glyphs displaying side-by-side in the integration test 2017-11-13 20:42:07 -08:00
Patrick Walton 9dda148b38 Fix some bugs in Core Graphics native rendering 2017-11-13 17:22:35 -08:00
Patrick Walton dc6bdda7ff Implement basic native FreeType glyph rendering, untested as of yet 2017-10-31 11:26:14 -07:00
Boris-Chengbiao Zhou 90144e6755 Make tests compile again (but not pass) 2017-10-28 04:16:54 +02:00
Patrick Walton 775ee2b526 Add basic native rasterization for Core Graphics and match the WebRender
`FontContext` API more
2017-10-26 17:55:17 -07:00
Patrick Walton 77f135a4ba Fix memory safety problem resulting in missing glyphs on macOS 2017-10-25 17:02:57 -07:00
Patrick Walton 0b179f3a40 Add preliminary DirectWrite support on Windows.
This will eventually need to call into GDI to do hinting, but it's good
enough for now.
2017-10-25 13:01:36 -07:00
Patrick Walton 1c693d5029 Approximate cubic curves with quadratics in the Core Graphics backend 2017-10-23 20:28:45 -07:00
Boris-Chengbiao Zhou ebfe5d0dbd Fix compilation on non-macos 2017-10-21 15:07:51 +02:00
Patrick Walton 9c470e77c1 Make macOS font rendering not depend on FreeType 2017-10-20 12:10:57 -07:00
Patrick Walton b6a60ef987 Make FreeType no longer a dependency of `path-utils` 2017-10-04 19:03:38 -07:00
Patrick Walton 8de1970682 Implement stroking ourselves, and rename `PathSegment` to `PathCommand`.
This makes Pathfinder no longer use the FreeType stroker.
2017-10-04 18:57:30 -07:00
Patrick Walton c36896e337 Implement path stroking using the FreeType stroker.
I'm not too happy with this, as I discovered a segfault in FreeType that doesn't give me confidence
in this as a solution for the long term. Additionally, this exposes the problems in the partitioner
with lack of winding fill rule, proper handling of self-intersections, and splitting of paths at
their extrema. (I believe these problems should be fairly straightforward to handle, but we just
don't handle them yet.)
2017-09-08 16:50:27 -07:00
Patrick Walton 3e5b53f13c Partially refactor the path APIs to be streaming, like Lyon 2017-09-08 13:09:00 -07:00
Patrick Walton f968a4ac20 Don't do server-side hinting 2017-09-03 13:03:45 -07:00
Patrick Walton 64e3558986 Considate `resources` directories 2017-08-29 19:27:05 -07:00
Patrick Walton f87ff0a9e0 Add Open Sans as a built-in font and fix handling of multiple consecutive off-curve points 2017-08-29 19:22:27 -07:00
Patrick Walton 1c21771414 Add EB Garamond as another test font 2017-08-25 17:02:03 -07:00
Patrick Walton c0914a0c87 Fix a bunch of text layout issues 2017-08-25 12:20:36 -07:00
Patrick Walton 14b7b88b3f Take the last control point before closing a subpath into account 2017-08-24 13:02:35 -07:00
Patrick Walton 93277c7c11 Allow multiple glyphs to be rendered simultaneously 2017-08-19 16:34:02 -07:00
Patrick Walton 92c5014ec6 font-renderer: Pull hinted outlines out of FreeType 2017-08-09 17:23:22 -07:00
Patrick Walton 2ddf95bd70 Initial work on the font renderer component 2017-08-09 15:36:41 -07:00