Ejemplo n.º 1
0
 internal CssValue GetValue(nsCSSFontDesc aDescID)
 {
     switch (aDescID) {
         case nsCSSFontDesc.Family: return mFamily;
         case nsCSSFontDesc.Style: return mStyle;
         case nsCSSFontDesc.Weight: return mWeight;
         case nsCSSFontDesc.Stretch: return mStretch;
         case nsCSSFontDesc.Src: return mSrc;
         case nsCSSFontDesc.UnicodeRange: return mUnicodeRange;
         case nsCSSFontDesc.FontFeatureSettings: return mFontFeatureSettings;
         case nsCSSFontDesc.FontLanguageOverride: return mFontLanguageOverride;
         default: throw new ArgumentOutOfRangeException("aDescID");
     }
 }
Ejemplo n.º 2
0
        internal void SetValue(nsCSSFontDesc aDescID, CssValue value)
        {
            switch (aDescID)
            {
            case nsCSSFontDesc.Family: mFamily = value; break;

            case nsCSSFontDesc.Style: mStyle = value; break;

            case nsCSSFontDesc.Weight: mWeight = value; break;

            case nsCSSFontDesc.Stretch: mStretch = value; break;

            case nsCSSFontDesc.Src: mSrc = value; break;

            case nsCSSFontDesc.UnicodeRange: mUnicodeRange = value; break;

            case nsCSSFontDesc.FontFeatureSettings: mFontFeatureSettings = value; break;

            case nsCSSFontDesc.FontLanguageOverride: mFontLanguageOverride = value; break;

            default: throw new ArgumentOutOfRangeException("aDescID");
            }
        }
Ejemplo n.º 3
0
        internal CssValue GetValue(nsCSSFontDesc aDescID)
        {
            switch (aDescID)
            {
            case nsCSSFontDesc.Family: return(mFamily);

            case nsCSSFontDesc.Style: return(mStyle);

            case nsCSSFontDesc.Weight: return(mWeight);

            case nsCSSFontDesc.Stretch: return(mStretch);

            case nsCSSFontDesc.Src: return(mSrc);

            case nsCSSFontDesc.UnicodeRange: return(mUnicodeRange);

            case nsCSSFontDesc.FontFeatureSettings: return(mFontFeatureSettings);

            case nsCSSFontDesc.FontLanguageOverride: return(mFontLanguageOverride);

            default: throw new ArgumentOutOfRangeException("aDescID");
            }
        }
Ejemplo n.º 4
0
        // font-descriptor: descriptor ':' value ';'
        // caller has advanced mToken to point at the descriptor
        internal bool ParseFontDescriptorValue(nsCSSFontDesc aDescID,
                                                ref nsCSSValue aValue)
        {
            switch (aDescID) {
            // These four are similar to the properties of the same name,
            // possibly with more restrictions on the values they can take.

              case nsCSSFontDesc.Family: {
            if (!ParseFamily(ref aValue) ||
                aValue.GetUnit() != nsCSSUnit.Families)
              return false;

            // the style parameters to the nsFont constructor are ignored,
            // because it's only being used to call EnumerateFamilies
            string valueStr = "";
            aValue.GetStringValue(ref valueStr);
            var font = new nsFont(valueStr, 0, 0, 0, 0, 0, 0);
            var dat = new ExtractFirstFamilyData();

            font.EnumerateFamilies(ExtractFirstFamily, (object) dat);
            if (!dat.mGood)
              return false;

            aValue.SetStringValue(dat.mFamilyName, nsCSSUnit.String);
            return true;
              }

            goto case nsCSSFontDesc.Style;
              case nsCSSFontDesc.Style:
            // property is VARIANT_HMK|VARIANT_SYSFONT
            return ParseVariant(ref aValue, VARIANT_KEYWORD | VARIANT_NORMAL,
                                nsCSSProps.kFontStyleKTable);

              case nsCSSFontDesc.Weight:
            return (ParseFontWeight(ref aValue) &&
                    aValue.GetUnit() != nsCSSUnit.Inherit &&
                    aValue.GetUnit() != nsCSSUnit.Initial &&
                    (aValue.GetUnit() != nsCSSUnit.Enumerated ||
                     (aValue.GetIntValue() != nsStyle.FONT_WEIGHT_BOLDER &&
                      aValue.GetIntValue() != nsStyle.FONT_WEIGHT_LIGHTER)));

              case nsCSSFontDesc.Stretch:
            // property is VARIANT_HK|VARIANT_SYSFONT
            return ParseVariant(ref aValue, VARIANT_KEYWORD,
                                nsCSSProps.kFontStretchKTable);

            // These two are unique to @font-face and have their own special grammar.
            goto case nsCSSFontDesc.Src;
              case nsCSSFontDesc.Src:
            return ParseFontSrc(ref aValue);

              case nsCSSFontDesc.UnicodeRange:
            return ParseFontRanges(ref aValue);

              case nsCSSFontDesc.FontFeatureSettings:
            return ParseFontFeatureSettings(ref aValue);

              case nsCSSFontDesc.FontLanguageOverride:
            return ParseVariant(ref aValue, VARIANT_NORMAL | VARIANT_STRING, null);

              case nsCSSFontDesc.UNKNOWN:
              case nsCSSFontDesc.COUNT:
            Debug.Fail("bad nsCSSFontDesc code");
            break;
              }
              // explicitly do NOT have a default case to let the compiler
              // help find missing descriptors
              return false;
        }
Ejemplo n.º 5
0
 internal void SetDesc(nsCSSFontDesc aDescId, CssValue aValue)
 {
     mDecl.SetValue(aDescId, aValue);
 }
Ejemplo n.º 6
0
 internal void SetDesc(nsCSSFontDesc aDescId, CssValue aValue)
 {
     mDecl.SetValue(aDescId, aValue);
 }
Ejemplo n.º 7
0
 internal void SetValue(nsCSSFontDesc aDescID, CssValue value)
 {
     switch (aDescID) {
         case nsCSSFontDesc.Family: mFamily = value; break;
         case nsCSSFontDesc.Style: mStyle = value; break;
         case nsCSSFontDesc.Weight: mWeight = value; break;
         case nsCSSFontDesc.Stretch: mStretch = value; break;
         case nsCSSFontDesc.Src: mSrc = value; break;
         case nsCSSFontDesc.UnicodeRange: mUnicodeRange = value; break;
         case nsCSSFontDesc.FontFeatureSettings: mFontFeatureSettings = value; break;
         case nsCSSFontDesc.FontLanguageOverride: mFontLanguageOverride = value; break;
         default: throw new ArgumentOutOfRangeException("aDescID");
     }
 }