mirror of
https://github.com/servo/servo.git
synced 2025-07-29 10:10:34 +01:00
This change adds support for `white-space-collapse: break-spaces` and adds initial parsing support for `overflow-wrap` and `word-break`. The later two properties are not fully supported, only in their interaction with `break-spaces`. This is a preliminary change preparing to implement them. In addition, `break_and_shape` is now forked and added to Layout 2020. This function is going to change a lot soon and forking is preparation for this. More code that is only used by Layout 2013 is moved from `gfx` to that crate. Co-authored-by: Rakhi Sharma <atbrakhi@igalia.com>
40 lines
1.2 KiB
Rust
40 lines
1.2 KiB
Rust
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
|
|
|
use unicode_properties::{emoji, UnicodeEmoji};
|
|
|
|
pub use crate::text::shaping::Shaper;
|
|
|
|
pub mod glyph;
|
|
pub mod shaping;
|
|
pub mod util;
|
|
|
|
#[derive(Clone, Copy, Debug)]
|
|
pub struct FallbackFontSelectionOptions {
|
|
pub character: char,
|
|
pub prefer_emoji_presentation: bool,
|
|
}
|
|
|
|
impl Default for FallbackFontSelectionOptions {
|
|
fn default() -> Self {
|
|
Self {
|
|
character: ' ',
|
|
prefer_emoji_presentation: false,
|
|
}
|
|
}
|
|
}
|
|
|
|
impl FallbackFontSelectionOptions {
|
|
pub fn new(character: char, next_character: Option<char>) -> Self {
|
|
let prefer_emoji_presentation = match next_character {
|
|
Some(next_character) if emoji::is_emoji_presentation_selector(next_character) => true,
|
|
Some(next_character) if emoji::is_text_presentation_selector(next_character) => false,
|
|
_ => character.is_emoji_char(),
|
|
};
|
|
Self {
|
|
character,
|
|
prefer_emoji_presentation,
|
|
}
|
|
}
|
|
}
|