aboutsummaryrefslogtreecommitdiffstats
path: root/components/gfx/platform
diff options
context:
space:
mode:
authorMartin Robinson <mrobinson@igalia.com>2024-05-03 11:54:29 +0200
committerGitHub <noreply@github.com>2024-05-03 09:54:29 +0000
commit1c9120c293cc16c11637feb6003117d4093642b5 (patch)
tree86bdaaca73012869546e6c44e0a68e4e35021665 /components/gfx/platform
parent160c7c0b0f061afa1277fa56cdd1d898379a8223 (diff)
downloadservo-1c9120c293cc16c11637feb6003117d4093642b5.tar.gz
servo-1c9120c293cc16c11637feb6003117d4093642b5.zip
fonts: Add `MallocSizeOf` implementation for `FontContext` (#32206)
* fonts: Add `MallocSizeOf` implementation for `FontContext` Co-authored-by: Mukilan Thiyagarajan <mukilan@igalia.com> Signed-off-by: Martin Robinson <mrobinson@igalia.com> * android: remove unused imports in font_list.rs Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com> --------- Signed-off-by: Martin Robinson <mrobinson@igalia.com> Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com> Co-authored-by: Mukilan Thiyagarajan <mukilan@igalia.com>
Diffstat (limited to 'components/gfx/platform')
-rw-r--r--components/gfx/platform/freetype/android/font_list.rs6
-rw-r--r--components/gfx/platform/freetype/font_list.rs3
-rw-r--r--components/gfx/platform/macos/font_list.rs3
-rw-r--r--components/gfx/platform/windows/font_list.rs4
4 files changed, 10 insertions, 6 deletions
diff --git a/components/gfx/platform/freetype/android/font_list.rs b/components/gfx/platform/freetype/android/font_list.rs
index c29069156c5..97276c35468 100644
--- a/components/gfx/platform/freetype/android/font_list.rs
+++ b/components/gfx/platform/freetype/android/font_list.rs
@@ -4,16 +4,16 @@
use std::fs::File;
use std::io::Read;
-use std::path::{Path, PathBuf};
+use std::path::Path;
use log::warn;
+use malloc_size_of_derive::MallocSizeOf;
use serde::{Deserialize, Serialize};
use style::values::computed::{
FontStretch as StyleFontStretch, FontStyle as StyleFontStyle, FontWeight as StyleFontWeight,
};
use style::Atom;
use ucd::{Codepoint, UnicodeBlock};
-use webrender_api::NativeFontHandle;
use super::xml::{Attribute, Node};
use crate::font_template::{FontTemplate, FontTemplateDescriptor};
@@ -24,7 +24,7 @@ lazy_static::lazy_static! {
}
/// An identifier for a local font on Android systems.
-#[derive(Clone, Debug, Deserialize, Eq, Hash, PartialEq, Serialize)]
+#[derive(Clone, Debug, Deserialize, Eq, Hash, MallocSizeOf, PartialEq, Serialize)]
pub struct LocalFontIdentifier {
/// The path to the font.
pub path: Atom,
diff --git a/components/gfx/platform/freetype/font_list.rs b/components/gfx/platform/freetype/font_list.rs
index a958248f8c5..1462b37ca56 100644
--- a/components/gfx/platform/freetype/font_list.rs
+++ b/components/gfx/platform/freetype/font_list.rs
@@ -24,6 +24,7 @@ use fontconfig_sys::{
};
use libc::{c_char, c_int};
use log::debug;
+use malloc_size_of_derive::MallocSizeOf;
use serde::{Deserialize, Serialize};
use style::values::computed::{FontStretch, FontStyle, FontWeight};
use style::Atom;
@@ -34,7 +35,7 @@ use crate::font_template::{FontTemplate, FontTemplateDescriptor};
use crate::text::util::is_cjk;
/// An identifier for a local font on systems using Freetype.
-#[derive(Clone, Debug, Deserialize, Eq, Hash, PartialEq, Serialize)]
+#[derive(Clone, Debug, Deserialize, Eq, Hash, MallocSizeOf, PartialEq, Serialize)]
pub struct LocalFontIdentifier {
/// The path to the font.
pub path: Atom,
diff --git a/components/gfx/platform/macos/font_list.rs b/components/gfx/platform/macos/font_list.rs
index d4063576316..272916e2d07 100644
--- a/components/gfx/platform/macos/font_list.rs
+++ b/components/gfx/platform/macos/font_list.rs
@@ -7,6 +7,7 @@ use std::io::Read;
use std::path::Path;
use log::debug;
+use malloc_size_of_derive::MallocSizeOf;
use serde::{Deserialize, Serialize};
use style::Atom;
use ucd::{Codepoint, UnicodeBlock};
@@ -20,7 +21,7 @@ use crate::text::util::unicode_plane;
/// An identifier for a local font on a MacOS system. These values comes from the CoreText
/// CTFontCollection. Note that `path` here is required. We do not load fonts that do not
/// have paths.
-#[derive(Clone, Debug, Deserialize, Eq, Hash, PartialEq, Serialize)]
+#[derive(Clone, Debug, Deserialize, Eq, Hash, MallocSizeOf, PartialEq, Serialize)]
pub struct LocalFontIdentifier {
pub postscript_name: Atom,
pub path: Atom,
diff --git a/components/gfx/platform/windows/font_list.rs b/components/gfx/platform/windows/font_list.rs
index fa96c7de226..9cfdbfd988e 100644
--- a/components/gfx/platform/windows/font_list.rs
+++ b/components/gfx/platform/windows/font_list.rs
@@ -6,6 +6,7 @@ use std::hash::Hash;
use std::sync::Arc;
use dwrote::{Font, FontCollection, FontDescriptor, FontStretch, FontStyle};
+use malloc_size_of_derive::MallocSizeOf;
use serde::{Deserialize, Serialize};
use style::values::computed::{FontStyle as StyleFontStyle, FontWeight as StyleFontWeight};
use style::values::specified::font::FontStretchKeyword;
@@ -31,9 +32,10 @@ where
}
/// An identifier for a local font on a Windows system.
-#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
+#[derive(Clone, Debug, Deserialize, MallocSizeOf, PartialEq, Serialize)]
pub struct LocalFontIdentifier {
/// The FontDescriptor of this font.
+ #[ignore_malloc_size_of = "dwrote does not support MallocSizeOf"]
pub font_descriptor: Arc<FontDescriptor>,
}