mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Update some code that's feature-gated under core.
This commit is contained in:
parent
29a36adbe7
commit
ba87666cdb
33 changed files with 104 additions and 107 deletions
|
@ -1079,7 +1079,7 @@ impl DisplayItem {
|
|||
paint_context.draw_linear_gradient(&gradient.base.bounds,
|
||||
&gradient.start_point,
|
||||
&gradient.end_point,
|
||||
gradient.stops.as_slice());
|
||||
&gradient.stops);
|
||||
}
|
||||
|
||||
DisplayItem::LineClass(ref line) => {
|
||||
|
|
|
@ -84,7 +84,7 @@ impl FontTemplate {
|
|||
}
|
||||
|
||||
pub fn identifier<'a>(&'a self) -> &'a str {
|
||||
self.identifier.as_slice()
|
||||
&*self.identifier
|
||||
}
|
||||
|
||||
/// Get the data for creating a font if it matches a given descriptor.
|
||||
|
|
|
@ -36,7 +36,7 @@ pub fn get_available_families<F>(mut callback: F) where F: FnMut(String) {
|
|||
unsafe {
|
||||
let config = FcConfigGetCurrent();
|
||||
let fontSet = FcConfigGetFonts(config, FcSetSystem);
|
||||
for i in range(0, (*fontSet).nfont as int) {
|
||||
for i in 0..((*fontSet).nfont as int) {
|
||||
let font = (*fontSet).fonts.offset(i);
|
||||
let mut family: *mut FcChar8 = ptr::null_mut();
|
||||
let mut v: c_int = 0;
|
||||
|
@ -74,7 +74,7 @@ pub fn get_variations_for_family<F>(family_name: &str, mut callback: F)
|
|||
|
||||
debug!("found {} variations", (*matches).nfont);
|
||||
|
||||
for i in range(0, (*matches).nfont as int) {
|
||||
for i in 0..((*matches).nfont as int) {
|
||||
let font = (*matches).fonts.offset(i);
|
||||
let mut file: *mut FcChar8 = ptr::null_mut();
|
||||
let file = if FcPatternGetString(*font, FC_FILE.as_ptr() as *mut c_char, 0, &mut file) == FcResultMatch {
|
||||
|
|
|
@ -356,7 +356,7 @@ impl<'a> DetailedGlyphStore {
|
|||
detail_offset: 0, // unused
|
||||
};
|
||||
|
||||
let i = self.detail_lookup.as_slice().binary_search_index(&key)
|
||||
let i = (&*self.detail_lookup).binary_search_index(&key)
|
||||
.expect("Invalid index not found in detailed glyph lookup table!");
|
||||
|
||||
assert!(i + (count as uint) <= self.detail_buffer.len());
|
||||
|
@ -600,7 +600,7 @@ impl<'a> GlyphStore {
|
|||
data_for_glyphs[i].offset)
|
||||
}).collect();
|
||||
|
||||
self.detail_store.add_detailed_glyphs_for_entry(i, glyphs_vec.as_slice());
|
||||
self.detail_store.add_detailed_glyphs_for_entry(i, &glyphs_vec);
|
||||
GlyphEntry::complex(first_glyph_data.cluster_start,
|
||||
first_glyph_data.ligature_start,
|
||||
glyph_count)
|
||||
|
|
|
@ -306,7 +306,7 @@ impl Shaper {
|
|||
}
|
||||
|
||||
debug!("(glyph idx) -> (text byte offset)");
|
||||
for i in range(0, glyph_data.len()) {
|
||||
for i in 0..glyph_data.len() {
|
||||
// loc refers to a *byte* offset within the utf8 string.
|
||||
let loc = glyph_data.byte_offset_of_glyph(i);
|
||||
if loc < byte_max {
|
||||
|
@ -481,7 +481,7 @@ impl Shaper {
|
|||
}
|
||||
|
||||
// now add the detailed glyph entry.
|
||||
glyphs.add_glyphs_for_char_index(char_idx, datas.as_slice());
|
||||
glyphs.add_glyphs_for_char_index(char_idx, &datas);
|
||||
|
||||
// set the other chars, who have no glyphs
|
||||
let mut i = covered_byte_span.begin();
|
||||
|
|
|
@ -186,7 +186,7 @@ impl<'a> Iterator for LineIterator<'a> {
|
|||
|
||||
impl<'a> TextRun {
|
||||
pub fn new(font: &mut Font, text: String, options: &ShapingOptions) -> TextRun {
|
||||
let glyphs = TextRun::break_and_shape(font, text.as_slice(), options);
|
||||
let glyphs = TextRun::break_and_shape(font, &text, options);
|
||||
let run = TextRun {
|
||||
text: Arc::new(text),
|
||||
font_metrics: font.metrics.clone(),
|
||||
|
@ -331,7 +331,7 @@ impl<'a> TextRun {
|
|||
|
||||
/// Returns the index of the first glyph run containing the given character index.
|
||||
fn index_of_first_glyph_run_containing(&self, index: CharIndex) -> Option<uint> {
|
||||
self.glyphs.as_slice().binary_search_index_by(&index, CharIndexComparator)
|
||||
(&**self.glyphs).binary_search_index_by(&index, CharIndexComparator)
|
||||
}
|
||||
|
||||
/// Returns an iterator that will iterate over all slices of glyphs that represent natural
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue