fonts: Enable fast text shaping on Windows (#33123)

* Use patched dwrote

Signed-off-by: crbrz <cristianb@gmail.com>

* Enable fast text shaping

Signed-off-by: crbrz <cristianb@gmail.com>

* Add fast text shape test

Signed-off-by: crbrz <cristianb@gmail.com>

* Update dwrote to 0.11.1

Signed-off-by: crbrz <cristianb@gmail.com>

---------

Signed-off-by: crbrz <cristianb@gmail.com>
This commit is contained in:
Cristian Brinza 2024-08-31 02:16:26 +03:00 committed by GitHub
parent 6f333a8e29
commit 4ae2610c24
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 103 additions and 15 deletions

View file

@ -213,15 +213,15 @@ impl PlatformFontMethods for PlatformFont {
/// Can this font do basic horizontal LTR shaping without Harfbuzz?
fn can_do_fast_shaping(&self) -> bool {
// TODO copy CachedKernTable from the MacOS X implementation to
// somehwere global and use it here. We could also implement the
// IDirectWriteFontFace1 interface and use the glyph kerning pair
// methods there.
false
self.face.has_kerning_pairs()
}
fn glyph_h_kerning(&self, _: GlyphId, _: GlyphId) -> FractionalPixel {
0.0
fn glyph_h_kerning(&self, first_glyph: GlyphId, second_glyph: GlyphId) -> FractionalPixel {
let adjustment = self
.face
.get_glyph_pair_kerning_adjustment(first_glyph as u16, second_glyph as u16);
(adjustment as f32 * self.scaled_du_to_px) as FractionalPixel
}
fn metrics(&self) -> FontMetrics {