mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
gfx: Implement letter-spacing
per CSS 2.1 § 16.4.
The ligature disabling code has been manually verified, but I was unable to reftest it. (The only way I could think of would be to create an Ahem-like font with a ligature table, but that would be an awful lot of work.) Near as I can tell, the method used to apply the spacing (manually inserting extra advance post-shaping) matches Gecko.
This commit is contained in:
parent
758d79fff4
commit
07bc97e3e2
11 changed files with 246 additions and 47 deletions
|
@ -1088,6 +1088,29 @@ pub mod longhands {
|
|||
// TODO: initial value should be 'start' (CSS Text Level 3, direction-dependent.)
|
||||
${single_keyword("text-align", "left right center justify")}
|
||||
|
||||
<%self:single_component_value name="letter-spacing">
|
||||
pub type SpecifiedValue = Option<specified::Length>;
|
||||
pub mod computed_value {
|
||||
use super::super::Au;
|
||||
pub type T = Option<Au>;
|
||||
}
|
||||
#[inline]
|
||||
pub fn get_initial_value() -> computed_value::T {
|
||||
None
|
||||
}
|
||||
#[inline]
|
||||
pub fn to_computed_value(value: SpecifiedValue, context: &computed::Context)
|
||||
-> computed_value::T {
|
||||
value.map(|length| computed::compute_Au(length, context))
|
||||
}
|
||||
pub fn from_component_value(input: &ComponentValue, _: &Url) -> Result<SpecifiedValue,()> {
|
||||
match input {
|
||||
&Ident(ref value) if value.eq_ignore_ascii_case("normal") => Ok(None),
|
||||
_ => specified::Length::parse_non_negative(input).map(|length| Some(length)),
|
||||
}
|
||||
}
|
||||
</%self:single_component_value>
|
||||
|
||||
${new_style_struct("Text", is_inherited=False)}
|
||||
|
||||
<%self:longhand name="text-decoration">
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue