mirror of
https://github.com/servo/servo.git
synced 2025-08-07 06:25:32 +01:00
font-feature-settings gecko glue code
FeatureTagValue value property changed to use u32. ToCss for FeatureTagValue changed to allow conversion from u32 to string. Parse for the same struct updated to convert from string to u32. Added two functions to transfer settings to gecko and copy settings.
This commit is contained in:
parent
3905b5af18
commit
a3dbf1d275
6 changed files with 79 additions and 17 deletions
|
@ -1296,12 +1296,47 @@ fn static_assert() {
|
|||
skip_font_longhands = """font-family font-size font-size-adjust font-weight
|
||||
font-synthesis -x-lang font-variant-alternates
|
||||
font-variant-east-asian font-variant-ligatures
|
||||
font-variant-numeric font-language-override"""
|
||||
font-variant-numeric font-language-override
|
||||
font-feature-settings"""
|
||||
%>
|
||||
<%self:impl_trait style_struct_name="Font"
|
||||
skip_longhands="${skip_font_longhands}"
|
||||
skip_additionals="*">
|
||||
|
||||
pub fn set_font_feature_settings(&mut self, v: longhands::font_feature_settings::computed_value::T) {
|
||||
use properties::longhands::font_feature_settings::computed_value::T;
|
||||
|
||||
let current_settings = &mut self.gecko.mFont.fontFeatureSettings;
|
||||
current_settings.clear_pod();
|
||||
|
||||
match v {
|
||||
T::Normal => unsafe { current_settings.set_len_pod(0) },
|
||||
|
||||
T::Tag(feature_settings) => {
|
||||
unsafe { current_settings.set_len_pod(feature_settings.len() as u32) };
|
||||
|
||||
for (current, feature) in current_settings.iter_mut().zip(feature_settings) {
|
||||
current.mTag = feature.tag;
|
||||
current.mValue = feature.value;
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
pub fn copy_font_feature_settings_from(&mut self, other: &Self ) {
|
||||
let current_settings = &mut self.gecko.mFont.fontFeatureSettings;
|
||||
let feature_settings = &other.gecko.mFont.fontFeatureSettings;
|
||||
let settings_length = feature_settings.len() as u32;
|
||||
|
||||
current_settings.clear_pod();
|
||||
unsafe { current_settings.set_len_pod(settings_length) };
|
||||
|
||||
for (current, feature) in current_settings.iter_mut().zip(feature_settings.iter()) {
|
||||
current.mTag = feature.mTag;
|
||||
current.mValue = feature.mValue;
|
||||
}
|
||||
}
|
||||
|
||||
pub fn set_font_family(&mut self, v: longhands::font_family::computed_value::T) {
|
||||
use properties::longhands::font_family::computed_value::FontFamily;
|
||||
use gecko_bindings::structs::FontFamilyType;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue