mirror of
https://github.com/servo/servo.git
synced 2025-07-10 17:03:40 +01:00
Remove unused is_missing flag
This commit is contained in:
parent
fa85d5f312
commit
d3d1d15615
2 changed files with 18 additions and 38 deletions
|
@ -62,14 +62,6 @@ impl GlyphEntry {
|
||||||
GlyphEntry::new(glyph_count as u32)
|
GlyphEntry::new(glyph_count as u32)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Create a GlyphEntry for the case where glyphs couldn't be found for the specified
|
|
||||||
/// character.
|
|
||||||
fn missing(glyph_count: usize) -> GlyphEntry {
|
|
||||||
assert!(glyph_count <= u16::MAX as usize);
|
|
||||||
|
|
||||||
GlyphEntry::new(glyph_count as u32)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn is_initial(&self) -> bool {
|
fn is_initial(&self) -> bool {
|
||||||
*self == GlyphEntry::initial()
|
*self == GlyphEntry::initial()
|
||||||
}
|
}
|
||||||
|
@ -317,7 +309,6 @@ pub struct GlyphData {
|
||||||
id: GlyphId,
|
id: GlyphId,
|
||||||
advance: Au,
|
advance: Au,
|
||||||
offset: Point2D<Au>,
|
offset: Point2D<Au>,
|
||||||
is_missing: bool,
|
|
||||||
cluster_start: bool,
|
cluster_start: bool,
|
||||||
ligature_start: bool,
|
ligature_start: bool,
|
||||||
}
|
}
|
||||||
|
@ -327,7 +318,6 @@ impl GlyphData {
|
||||||
pub fn new(id: GlyphId,
|
pub fn new(id: GlyphId,
|
||||||
advance: Au,
|
advance: Au,
|
||||||
offset: Option<Point2D<Au>>,
|
offset: Option<Point2D<Au>>,
|
||||||
is_missing: bool,
|
|
||||||
cluster_start: bool,
|
cluster_start: bool,
|
||||||
ligature_start: bool)
|
ligature_start: bool)
|
||||||
-> GlyphData {
|
-> GlyphData {
|
||||||
|
@ -335,7 +325,6 @@ impl GlyphData {
|
||||||
id: id,
|
id: id,
|
||||||
advance: advance,
|
advance: advance,
|
||||||
offset: offset.unwrap_or(Point2D::zero()),
|
offset: offset.unwrap_or(Point2D::zero()),
|
||||||
is_missing: is_missing,
|
|
||||||
cluster_start: cluster_start,
|
cluster_start: cluster_start,
|
||||||
ligature_start: ligature_start,
|
ligature_start: ligature_start,
|
||||||
}
|
}
|
||||||
|
@ -470,15 +459,13 @@ impl<'a> GlyphStore {
|
||||||
debug_assert!(data.ligature_start); // can't compress ligature continuation glyphs.
|
debug_assert!(data.ligature_start); // can't compress ligature continuation glyphs.
|
||||||
debug_assert!(i < self.char_len());
|
debug_assert!(i < self.char_len());
|
||||||
|
|
||||||
let mut entry = match (data.is_missing, glyph_is_compressible) {
|
let mut entry = if glyph_is_compressible {
|
||||||
(true, _) => GlyphEntry::missing(1),
|
GlyphEntry::simple(data.id, data.advance)
|
||||||
(false, true) => GlyphEntry::simple(data.id, data.advance),
|
} else {
|
||||||
(false, false) => {
|
let glyph = &[DetailedGlyph::new(data.id, data.advance, data.offset)];
|
||||||
let glyph = &[DetailedGlyph::new(data.id, data.advance, data.offset)];
|
self.has_detailed_glyphs = true;
|
||||||
self.has_detailed_glyphs = true;
|
self.detail_store.add_detailed_glyphs_for_entry(i, glyph);
|
||||||
self.detail_store.add_detailed_glyphs_for_entry(i, glyph);
|
GlyphEntry::complex(data.cluster_start, data.ligature_start, 1)
|
||||||
GlyphEntry::complex(data.cluster_start, data.ligature_start, 1)
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
if character == ' ' {
|
if character == ' ' {
|
||||||
|
@ -495,22 +482,18 @@ impl<'a> GlyphStore {
|
||||||
let glyph_count = data_for_glyphs.len();
|
let glyph_count = data_for_glyphs.len();
|
||||||
|
|
||||||
let first_glyph_data = data_for_glyphs[0];
|
let first_glyph_data = data_for_glyphs[0];
|
||||||
let entry = match first_glyph_data.is_missing {
|
let glyphs_vec: Vec<DetailedGlyph> = (0..glyph_count).map(|i| {
|
||||||
true => GlyphEntry::missing(glyph_count),
|
DetailedGlyph::new(data_for_glyphs[i].id,
|
||||||
false => {
|
data_for_glyphs[i].advance,
|
||||||
let glyphs_vec: Vec<DetailedGlyph> = (0..glyph_count).map(|i| {
|
data_for_glyphs[i].offset)
|
||||||
DetailedGlyph::new(data_for_glyphs[i].id,
|
}).collect();
|
||||||
data_for_glyphs[i].advance,
|
|
||||||
data_for_glyphs[i].offset)
|
|
||||||
}).collect();
|
|
||||||
|
|
||||||
self.has_detailed_glyphs = true;
|
self.has_detailed_glyphs = true;
|
||||||
self.detail_store.add_detailed_glyphs_for_entry(i, &glyphs_vec);
|
self.detail_store.add_detailed_glyphs_for_entry(i, &glyphs_vec);
|
||||||
GlyphEntry::complex(first_glyph_data.cluster_start,
|
|
||||||
first_glyph_data.ligature_start,
|
let entry = GlyphEntry::complex(first_glyph_data.cluster_start,
|
||||||
glyph_count)
|
first_glyph_data.ligature_start,
|
||||||
}
|
glyph_count);
|
||||||
};
|
|
||||||
|
|
||||||
debug!("Adding multiple glyphs[idx={:?}, count={}]: {:?}", i, glyph_count, entry);
|
debug!("Adding multiple glyphs[idx={:?}, count={}]: {:?}", i, glyph_count, entry);
|
||||||
|
|
||||||
|
|
|
@ -453,7 +453,6 @@ impl Shaper {
|
||||||
let data = GlyphData::new(space_glyph_id,
|
let data = GlyphData::new(space_glyph_id,
|
||||||
advance,
|
advance,
|
||||||
Default::default(),
|
Default::default(),
|
||||||
false,
|
|
||||||
true,
|
true,
|
||||||
true);
|
true);
|
||||||
glyphs.add_glyph_for_char_index(char_idx, character, &data);
|
glyphs.add_glyph_for_char_index(char_idx, character, &data);
|
||||||
|
@ -463,7 +462,6 @@ impl Shaper {
|
||||||
let data = GlyphData::new(shape.codepoint,
|
let data = GlyphData::new(shape.codepoint,
|
||||||
advance,
|
advance,
|
||||||
shape.offset,
|
shape.offset,
|
||||||
false,
|
|
||||||
true,
|
true,
|
||||||
true);
|
true);
|
||||||
glyphs.add_glyph_for_char_index(char_idx, character, &data);
|
glyphs.add_glyph_for_char_index(char_idx, character, &data);
|
||||||
|
@ -477,7 +475,6 @@ impl Shaper {
|
||||||
datas.push(GlyphData::new(shape.codepoint,
|
datas.push(GlyphData::new(shape.codepoint,
|
||||||
shape.advance,
|
shape.advance,
|
||||||
shape.offset,
|
shape.offset,
|
||||||
false, // not missing
|
|
||||||
true, // treat as cluster start
|
true, // treat as cluster start
|
||||||
glyph_i > glyph_span.begin()));
|
glyph_i > glyph_span.begin()));
|
||||||
// all but first are ligature continuations
|
// all but first are ligature continuations
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue