mirror of
https://github.com/servo/servo.git
synced 2025-06-25 09:34:32 +01:00
Implement font-size and font-style
This commit is contained in:
parent
73078bd2a0
commit
4539a0fa68
3 changed files with 23 additions and 8 deletions
|
@ -1 +1 @@
|
||||||
Subproject commit 473aa3963f0065b35fdc868b0cb3f755630f5bef
|
Subproject commit bc148a64d9f46945bf6fab8a355d06cb58262c06
|
|
@ -1 +1 @@
|
||||||
Subproject commit a840161badbfb5e3adb861c35f210fecf4877f77
|
Subproject commit b41a2e44df11d6c43240ed2d382e62bfdecdd190
|
|
@ -24,11 +24,12 @@ use gfx::text::text_run::TextRun;
|
||||||
use gfx::util::range::*;
|
use gfx::util::range::*;
|
||||||
use newcss::color::{Color, rgba, rgb};
|
use newcss::color::{Color, rgba, rgb};
|
||||||
use newcss::complete::CompleteStyle;
|
use newcss::complete::CompleteStyle;
|
||||||
use newcss::units::{BoxSizing, Cursive, Fantasy, Length, Monospace, Px, SansSerif, Serif};
|
use newcss::units::{BoxSizing, Cursive, Em, Fantasy, Length, Monospace, Pt, Px, SansSerif, Serif};
|
||||||
use newcss::values::{CSSBackgroundColorColor, CSSBackgroundColorTransparent, CSSBorderColor};
|
use newcss::values::{CSSBackgroundColorColor, CSSBackgroundColorTransparent, CSSBorderColor};
|
||||||
use newcss::values::{CSSBorderWidthLength, CSSBorderWidthMedium, CSSDisplay};
|
use newcss::values::{CSSBorderWidthLength, CSSBorderWidthMedium, CSSDisplay};
|
||||||
use newcss::values::{CSSFontFamilyFamilyName, CSSFontFamilyGenericFamily, CSSPositionAbsolute};
|
use newcss::values::{CSSFontFamilyFamilyName, CSSFontFamilyGenericFamily, CSSPositionAbsolute};
|
||||||
use newcss::values::{Specified};
|
use newcss::values::{CSSFontSizeLength, CSSFontStyleItalic, CSSFontStyleNormal};
|
||||||
|
use newcss::values::{CSSFontStyleOblique, Specified};
|
||||||
use std::arc::ARC;
|
use std::arc::ARC;
|
||||||
use std::net::url::Url;
|
use std::net::url::Url;
|
||||||
|
|
||||||
|
@ -534,14 +535,28 @@ impl RenderBox : RenderBoxMethods {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
let font_families = str::connect(font_families, ~", ");
|
let font_families = str::connect(font_families, ~", ");
|
||||||
|
|
||||||
debug!("(font style) font families: `%s`", font_families);
|
debug!("(font style) font families: `%s`", font_families);
|
||||||
|
|
||||||
|
let font_size = match my_style.font_size() {
|
||||||
|
CSSFontSizeLength(Px(l)) |
|
||||||
|
CSSFontSizeLength(Pt(l)) |
|
||||||
|
CSSFontSizeLength(Em(l)) => l,
|
||||||
|
_ => 12f
|
||||||
|
};
|
||||||
|
debug!("(font style) font size: `%f`", font_size);
|
||||||
|
|
||||||
|
let italic, oblique;
|
||||||
|
match my_style.font_style() {
|
||||||
|
CSSFontStyleNormal => { italic = false; oblique = false; }
|
||||||
|
CSSFontStyleItalic => { italic = true; oblique = false; }
|
||||||
|
CSSFontStyleOblique => { italic = false; oblique = true; }
|
||||||
|
}
|
||||||
|
|
||||||
FontStyle {
|
FontStyle {
|
||||||
pt_size: 20f,
|
pt_size: font_size,
|
||||||
weight: FontWeight300,
|
weight: FontWeight300,
|
||||||
italic: false,
|
italic: italic,
|
||||||
oblique: false,
|
oblique: oblique,
|
||||||
families: move font_families,
|
families: move font_families,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue