aboutsummaryrefslogtreecommitdiffstats
path: root/components/shared/compositing/lib.rs
diff options
context:
space:
mode:
authorMukilan Thiyagarajan <mukilan@igalia.com>2024-04-22 15:08:21 +0530
committerGitHub <noreply@github.com>2024-04-22 09:38:21 +0000
commit821893b2eecfc72918ab8154c3cb61cd45d53857 (patch)
tree035596a6a3af9a3138b0a58974d9745ffa702a26 /components/shared/compositing/lib.rs
parent25b182c372427e798954b814b0f1a0875ab43f98 (diff)
downloadservo-821893b2eecfc72918ab8154c3cb61cd45d53857.tar.gz
servo-821893b2eecfc72918ab8154c3cb61cd45d53857.zip
fonts: Rework platform font initialization (#32127)
This change reworks the way that platform fonts are created and descriptor data is on `FontTemplate` is initialized. The main change here is that platform fonts for local font faces are always initialized using the font data loaded into memory from disk. This means that there is now only a single path for creating platform fonts. In addition, the font list is now responsible for getting the `FontTemplateDescriptor` for local `FontTemplate`s. Before the font had to be loaded into memory to get the weight, style, and width used for the descriptor. This is what fonts lists are for though, so for every platform we have that information before needing to load the font. In the future, hopefully this will allow discarding fonts before needing to load them into memory. Web fonts still get the descriptor from the platform handle, but hopefully that can be done with skrifa in the future. Thsese two fixes together allow properly loading indexed font variations on Linux machines. Before only the first variation could be instantiated. Fixes https://github.com/servo/servo/issues/13317. Fixes https://github.com/servo/servo/issues/24554. Co-authored-by: Martin Robinson <mrobinson@igalia.com> ---- - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [x] These changes fix #13317 and #24554 - [x] There are tests for these changes --------- Co-authored-by: Martin Robinson <mrobinson@igalia.com>
Diffstat (limited to 'components/shared/compositing/lib.rs')
-rw-r--r--components/shared/compositing/lib.rs5
1 files changed, 3 insertions, 2 deletions
diff --git a/components/shared/compositing/lib.rs b/components/shared/compositing/lib.rs
index 9c759bc4acf..6af096dbbbf 100644
--- a/components/shared/compositing/lib.rs
+++ b/components/shared/compositing/lib.rs
@@ -25,7 +25,7 @@ use script_traits::{
};
use style_traits::CSSPixel;
use webrender_api::units::{DeviceIntPoint, DeviceIntSize, DeviceRect};
-use webrender_api::{self, FontInstanceKey, FontKey, ImageKey};
+use webrender_api::{self, FontInstanceKey, FontKey, ImageKey, NativeFontHandle};
/// Sends messages to the compositor.
pub struct CompositorProxy {
@@ -140,7 +140,8 @@ pub struct CompositionPipeline {
pub enum FontToCompositorMsg {
AddFontInstance(FontKey, f32, Sender<FontInstanceKey>),
- AddFont(gfx_traits::FontData, Sender<FontKey>),
+ AddFont(Sender<FontKey>, u32, ipc_channel::ipc::IpcBytesReceiver),
+ AddSystemFont(Sender<FontKey>, NativeFontHandle),
}
pub enum CanvasToCompositorMsg {