mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
fonts: Use IpcSharedMemory
to send font data (#33530)
This changes modifes the way that font data is sent over IPC channels. Instead of serializing the data or sending it via IPC byte senders, font data is copied into shared memory and a copy of the handle is sent over the channel. There is also the idea of sending the file handle of the on disk data of system fonts. This could be implemented as a further followup once there is an abstraction in `ipc-channel` over file handles. To accomplish this, a `FontData` abstraction is added, which also allows caching an in-memory shared `Arc<Vec<u8>>` version of the data (neeeded by some APIs). This could also be a place for caching font tables in the future. Finally, the `FontCacheThread` is renamed to the `SystemFontService` while the proxy for this is now named `SystemFontServiceProxy`. Signed-off-by: Martin Robinson <mrobinson@igalia.com> Co-authored-by: Mukilan Thiyagarajan <mukilan@igalia.com>
This commit is contained in:
parent
2c6d9a190f
commit
ade902207f
26 changed files with 601 additions and 544 deletions
|
@ -8,7 +8,7 @@ use std::ops::Range;
|
|||
use app_units::Au;
|
||||
use base::text::is_bidi_control;
|
||||
use fonts::{
|
||||
FontCacheThread, FontContext, FontRef, GlyphRun, ShapingFlags, ShapingOptions,
|
||||
FontContext, FontRef, GlyphRun, ShapingFlags, ShapingOptions, SystemFontServiceProxy,
|
||||
LAST_RESORT_GLYPH_ADVANCE,
|
||||
};
|
||||
use fonts_traits::ByteIndex;
|
||||
|
@ -342,7 +342,7 @@ impl TextRun {
|
|||
pub(super) fn segment_and_shape(
|
||||
&mut self,
|
||||
formatting_context_text: &str,
|
||||
font_context: &FontContext<FontCacheThread>,
|
||||
font_context: &FontContext<SystemFontServiceProxy>,
|
||||
linebreaker: &mut LineBreaker,
|
||||
font_cache: &mut Vec<FontKeyAndMetrics>,
|
||||
bidi_info: &BidiInfo,
|
||||
|
@ -410,7 +410,7 @@ impl TextRun {
|
|||
fn segment_text_by_font(
|
||||
&mut self,
|
||||
formatting_context_text: &str,
|
||||
font_context: &FontContext<FontCacheThread>,
|
||||
font_context: &FontContext<SystemFontServiceProxy>,
|
||||
font_cache: &mut Vec<FontKeyAndMetrics>,
|
||||
bidi_info: &BidiInfo,
|
||||
) -> Vec<(TextRunSegment, FontRef)> {
|
||||
|
@ -556,7 +556,7 @@ pub(super) fn add_or_get_font(font: &FontRef, ifc_fonts: &mut Vec<FontKeyAndMetr
|
|||
|
||||
pub(super) fn get_font_for_first_font_for_style(
|
||||
style: &ComputedValues,
|
||||
font_context: &FontContext<FontCacheThread>,
|
||||
font_context: &FontContext<SystemFontServiceProxy>,
|
||||
) -> Option<FontRef> {
|
||||
let font = font_context
|
||||
.font_group(style.clone_font())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue