コード例 #1
0
        public override CssAtRule Copy()
        {
            FontFeatureValuesRule at = new FontFeatureValuesRule();

            at.FontName    = FontName;
            at.Entries     = Entries;
            at.RawValue    = RawValue;
            at.ParentSheet = ParentSheet;
            return(at);
        }
コード例 #2
0
        public override Rule LoadRule(Css.Rule parent, StyleSheet sheet, Css.Value value)
        {
            // Grab the sheet:
            ParentSheet = sheet;
            RawValue    = value;

            FontFeatureValuesRule parentRule = parent as FontFeatureValuesRule;

            // Add to lookup:
            parentRule.FeatureLookup[FeatureName] = this;

            // Load the OpenType rules now:
            int count = value.Count;

            // Get the block:
            PropertyMapUnit sBlock = value[count - 1] as PropertyMapUnit;

            if (sBlock == null)
            {
                // Try as a set instead:
                ValueSet set = value[count - 1] as ValueSet;

                if (set == null)
                {
                    // Invalid/ unrecognised block. Ignore it.
                    return(null);
                }

                // Get last one in the set:
                sBlock = set[set.Count - 1] as PropertyMapUnit;

                // still null?
                if (sBlock == null)
                {
                    // Invalid/ unrecognised block. Ignore it.
                    return(null);
                }
            }

            // - For each CSS property (each of which is a user defined identifier)..
            foreach (KeyValuePair <string, Css.Value> kvp in sBlock.Properties)
            {
                // Create our feature list:
                List <OpenTypeFeature> features = new List <OpenTypeFeature>();

                // Map to open type feature now:
                ToOpenTypeFeature(kvp.Value, features);

                // Put it into the properties set:
                Properties[kvp.Key] = features;
            }

            return(this);
        }