Example #1
0
        public static void LoadInto(TextRenderingProperty trp, List <OpenTypeFeature> features, ComputedStyle cs)
        {
            Css.Value value = cs[GlobalProperty];

            if (value == null)
            {
                return;
            }

            if (Features == null)
            {
                Features = new OpenTypeFeatureSet();
            }

            switch (value.Text)
            {
            default:
            case "normal":
                // Do nothing
                break;

            case "small-caps":

                features.Add(Features["smcp"]);

                break;

            case "all-small-caps":

                features.Add(Features["smcp"]);
                features.Add(Features["c2sc"]);

                break;

            case "petite-caps":

                features.Add(Features["pcap"]);

                break;

            case "all-petite-caps":

                features.Add(Features["pcap"]);
                features.Add(Features["c2pc"]);

                break;

            case "unicase":

                features.Add(Features["unic"]);

                break;

            case "titling-caps":

                features.Add(Features["titl"]);

                break;
            }
        }
Example #2
0
        public static void LoadInto(TextRenderingProperty trp, List <OpenTypeFeature> features, ComputedStyle cs)
        {
            Css.Value value = cs[GlobalProperty];

            if (value == null)
            {
                return;
            }

            if (Features == null)
            {
                Features = new OpenTypeFeatureSet();
            }

            switch (value.Text)
            {
            default:
                // Do nothing
                break;

            case "sub":

                features.Add(Features["subs"]);
                features.Add(Features["dnom"]);

                break;

            case "super":

                features.Add(Features["sups"]);
                features.Add(Features["numr"]);

                break;
            }
        }
Example #3
0
        public static void LoadInto(TextRenderingProperty trp, List <OpenTypeFeature> features, ComputedStyle cs)
        {
            Css.Value value = cs[GlobalProperty];

            if (value == null)
            {
                return;
            }

            if (Features == null)
            {
                Features = new OpenTypeFeatureSet();
            }

            for (int i = 0; i < value.Count; i++)
            {
                Css.Value current = value[i];

                // The feature name:
                string name;

                if (current is Css.ValueSet)
                {
                    // E.g. "swsh" 2
                    name = current[0].Text;

                    // Get the value (may be 'on' or 'off'):
                    Css.Value par = current[1];

                    if (par.Type == ValueType.Text)
                    {
                        if (par.Text == "off")
                        {
                            continue;
                        }

                        // name followed by 'on'.
                        features.Add(Features[name]);
                    }
                    else
                    {
                        int param = (int)current[1].GetRawDecimal();

                        features.Add(new OpenTypeFeature(name, param));
                    }
                }
                else
                {
                    // It's just a feature name:
                    name = current.Text;

                    features.Add(Features[name]);
                }
            }
        }
        public static void LoadInto(TextRenderingProperty trp, List <OpenTypeFeature> features, ComputedStyle cs)
        {
            Css.Value value = cs[GlobalProperty];

            if (value == null)
            {
                return;
            }

            if (Features == null)
            {
                Features = new OpenTypeFeatureSet();
            }

            if (value is CssFunction)
            {
                value.GetOpenTypeFeatures(trp, features);
                return;
            }

            for (int i = 0; i < value.Count; i++)
            {
                Css.Value current = value[i];

                if (current is CssFunction)
                {
                    // E.g. stylistic(..)
                    current.GetOpenTypeFeatures(trp, features);
                }
                else
                {
                    switch (current.Text)
                    {
                    default:
                    case "normal":
                        // Do nothing
                        break;

                    case "historical-forms":

                        features.Add(Features["hist"]);

                        break;
                    }
                }
            }
        }
Example #5
0
        public static void LoadInto(TextRenderingProperty trp, List <OpenTypeFeature> features, ComputedStyle cs)
        {
            Css.Value value = cs[GlobalProperty];

            if (value == null)
            {
                return;
            }

            if (Features == null)
            {
                Features = new OpenTypeFeatureSet();
            }

            switch (value.Text)
            {
            default:
                // Do nothing
                break;

            case "common-ligatures":

                features.Add(Features["clig"]);
                features.Add(Features["liga"]);

                break;

            case "discretionary-ligatures":

                features.Add(Features["dlig"]);

                break;

            case "historical-ligatures":

                features.Add(Features["hlig"]);

                break;

            case "contextual":

                features.Add(Features["calt"]);

                break;
            }
        }
Example #6
0
        public static void LoadInto(TextRenderingProperty trp, List <OpenTypeFeature> features, ComputedStyle cs)
        {
            Css.Value value = cs[GlobalProperty];

            if (value == null)
            {
                return;
            }

            if (Features == null)
            {
                Features = new OpenTypeFeatureSet();
            }

            switch (value.Text)
            {
            default:
                // Do nothing
                break;

            case "lining-nums":

                features.Add(Features["lnum"]);

                break;

            case "oldstyle-nums":

                features.Add(Features["onum"]);

                break;

            case "proportional-nums":

                features.Add(Features["pnum"]);

                break;

            case "tabular-nums":

                features.Add(Features["tnum"]);

                break;

            case "diagonal-fractions":

                features.Add(Features["frac"]);

                break;

            case "stacked-fractions":

                features.Add(Features["afrc"]);

                break;

            case "ordinal":

                features.Add(Features["ordn"]);

                break;

            case "slashed-zero":

                features.Add(Features["zero"]);

                break;
            }
        }
Example #7
0
        public static void LoadInto(TextRenderingProperty trp, List <OpenTypeFeature> features, ComputedStyle cs)
        {
            Css.Value value = cs[GlobalProperty];

            if (value == null)
            {
                return;
            }

            if (Features == null)
            {
                Features = new OpenTypeFeatureSet();
            }

            switch (value.Text)
            {
            default:
                // Do nothing
                break;

            case "jis78":

                features.Add(Features["jp78"]);

                break;

            case "jis83":

                features.Add(Features["jp83"]);

                break;

            case "jis90":

                features.Add(Features["jp90"]);

                break;

            case "jis04":

                features.Add(Features["jp04"]);

                break;

            case "simplified":

                features.Add(Features["smpl"]);

                break;

            case "traditional":

                features.Add(Features["trad"]);

                break;

            case "full-width":

                features.Add(Features["fwid"]);

                break;

            case "proportional-width":

                features.Add(Features["pwid"]);

                break;

            case "ruby":

                features.Add(Features["ruby"]);

                break;
            }
        }