mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
base: Remove ucd
dependency (#32424)
Remove the `ucd` dependency which has not been updated in 8 years. In addition, replace it with a generated UnicodeBlock enum which reflects the modern Unicode standard. This is generated via a Python script which is included in the repository. The generation is not part of the build process, because the Unicode database is hosted on the web and it does not change the frequently. This is done instead of bringing in the more up-to-date `unicode_blocks` dependency. `unicode_blocks` defines each block as constant, which means that they cannot be used in match statements -- which we do in Servo. Co-authored-by: Lauryn Menard <lauryn.menard@gmail.com>
This commit is contained in:
parent
48ab8d8847
commit
f8985c5521
18 changed files with 834 additions and 100 deletions
|
@ -12,6 +12,7 @@ use std::{f32, fmt};
|
|||
|
||||
use app_units::Au;
|
||||
use base::id::{BrowsingContextId, PipelineId};
|
||||
use base::text::is_bidi_control;
|
||||
use bitflags::bitflags;
|
||||
use canvas_traits::canvas::{CanvasId, CanvasMsg};
|
||||
use euclid::default::{Point2D, Rect, Size2D, Vector2D};
|
||||
|
@ -2914,7 +2915,7 @@ impl Fragment {
|
|||
let mut new_text_string = String::new();
|
||||
let mut modified = false;
|
||||
for (i, character) in unscanned_text_fragment_info.text.char_indices() {
|
||||
if gfx::text::util::is_bidi_control(character) {
|
||||
if is_bidi_control(character) {
|
||||
new_text_string.push(character);
|
||||
continue;
|
||||
}
|
||||
|
@ -2984,7 +2985,7 @@ impl Fragment {
|
|||
let mut trailing_bidi_control_characters_to_retain = Vec::new();
|
||||
let (mut modified, mut last_character_index) = (true, 0);
|
||||
for (i, character) in unscanned_text_fragment_info.text.char_indices().rev() {
|
||||
if gfx::text::util::is_bidi_control(character) {
|
||||
if is_bidi_control(character) {
|
||||
trailing_bidi_control_characters_to_retain.push(character);
|
||||
continue;
|
||||
}
|
||||
|
@ -3401,7 +3402,7 @@ impl WhitespaceStrippingResult {
|
|||
) -> WhitespaceStrippingResult {
|
||||
if info.text.is_empty() {
|
||||
WhitespaceStrippingResult::FragmentContainedOnlyWhitespace
|
||||
} else if info.text.chars().all(gfx::text::util::is_bidi_control) {
|
||||
} else if info.text.chars().all(is_bidi_control) {
|
||||
WhitespaceStrippingResult::FragmentContainedOnlyBidiControlCharacters
|
||||
} else {
|
||||
WhitespaceStrippingResult::RetainFragment
|
||||
|
|
|
@ -9,10 +9,10 @@ use std::collections::LinkedList;
|
|||
use std::sync::Arc;
|
||||
|
||||
use app_units::Au;
|
||||
use base::text::is_bidi_control;
|
||||
use gfx::font::{self, FontMetrics, FontRef, RunMetrics, ShapingFlags, ShapingOptions};
|
||||
use gfx::font_cache_thread::FontIdentifier;
|
||||
use gfx::text::glyph::ByteIndex;
|
||||
use gfx::text::util::is_bidi_control;
|
||||
use log::{debug, warn};
|
||||
use range::Range;
|
||||
use style::computed_values::text_rendering::T as TextRendering;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue