mirror of
https://github.com/servo/servo.git
synced 2025-08-07 22:45:34 +01:00
Fix servo build.
This commit is contained in:
parent
16ca8de6df
commit
54b444992d
13 changed files with 148 additions and 143 deletions
|
@ -22,8 +22,7 @@ use servo_atoms::Atom;
|
|||
use std::{fmt, ptr};
|
||||
use std::ops::Range;
|
||||
use std::sync::Arc;
|
||||
use style::computed_values::font_stretch::T as FontStretch;
|
||||
use style::computed_values::font_weight::T as FontWeight;
|
||||
use style::values::computed::font::{FontStretch, FontStyle, FontWeight};
|
||||
use text::glyph::GlyphId;
|
||||
|
||||
const KERN_PAIR_LEN: usize = 6;
|
||||
|
@ -204,8 +203,13 @@ impl FontHandleMethods for FontHandle {
|
|||
Some(self.ctfont.face_name())
|
||||
}
|
||||
|
||||
fn is_italic(&self) -> bool {
|
||||
self.ctfont.symbolic_traits().is_italic()
|
||||
fn style(&self) -> FontStyle {
|
||||
use style::values::generics::font::FontStyle::*;
|
||||
if self.ctfont.symbolic_traits().is_italic() {
|
||||
Italic
|
||||
} else {
|
||||
Normal
|
||||
}
|
||||
}
|
||||
|
||||
fn boldness(&self) -> FontWeight {
|
||||
|
@ -221,19 +225,11 @@ impl FontHandleMethods for FontHandle {
|
|||
}
|
||||
|
||||
fn stretchiness(&self) -> FontStretch {
|
||||
use style::values::computed::Percentage;
|
||||
use style::values::generics::NonNegative;
|
||||
|
||||
let normalized = self.ctfont.all_traits().normalized_width(); // [-1.0, 1.0]
|
||||
let normalized = (normalized + 1.0) / 2.0 * 9.0; // [0.0, 9.0]
|
||||
match normalized {
|
||||
v if v < 1.0 => FontStretch::UltraCondensed,
|
||||
v if v < 2.0 => FontStretch::ExtraCondensed,
|
||||
v if v < 3.0 => FontStretch::Condensed,
|
||||
v if v < 4.0 => FontStretch::SemiCondensed,
|
||||
v if v < 5.0 => FontStretch::Normal,
|
||||
v if v < 6.0 => FontStretch::SemiExpanded,
|
||||
v if v < 7.0 => FontStretch::Expanded,
|
||||
v if v < 8.0 => FontStretch::ExtraExpanded,
|
||||
_ => FontStretch::UltraExpanded,
|
||||
}
|
||||
NonNegative(Percentage(normalized as f32 + 1.0))
|
||||
}
|
||||
|
||||
fn glyph_index(&self, codepoint: char) -> Option<GlyphId> {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue