@@ 190,6 190,13 @@ parseFontFeatures (String feat:toks) | feature@(_:_:_:_:[]) <- unpack feat = cas
Number _ (NVInteger x):tail -> ([(feature, fromEnum x)], True, tail)
parseFontFeatures toks = ([], False, toks)
+parseFontVars :: [Token] -> ([(String, NumericValue)], Bool, [Token])
+parseFontVars (String var':Number _ x:Comma:tail) | var@(_:_:_:_:[]) <- unpack var' =
+ let (vars, b, tail') = parseFontVars tail in ((var, x):vars, b, tail')
+parseFontVars (String var':Number _ x:tail) | var@(_:_:_:_:[]) <- unpack var' =
+ ([(var, x)], True, tail)
+parseFontVars toks = ([], False, toks)
+
parseLength :: Double -> NumericValue -> Text -> Double
parseLength super length unit = convert (nv2double length) unit
where
@@ 211,6 218,7 @@ parseLength super length unit = convert (nv2double length) unit
sets a b c d = Just $ setValues a b c d
set a b c d = Just $ setValue a b c d
seti a b c d = Just $ setValue a b (c :: Int) d
+unset' a b = Just $ unset a b
getSize pat | ValueDouble x <- getValue "size" pat = x
| otherwise = 10
@@ 262,9 270,15 @@ instance PropertyParser Pattern where
| ValueInt _ <- getValue "weight" self = Just self -- As bold as it goes...
| otherwise = seti "weight" Strong 200 self
- longhand _ self "font-feature-settings" [Ident k] | k `elem` ["initial", "normal"] = Just self
+ longhand _ self "font-feature-settings" [Ident k]
+ | k `elem` ["initial", "normal"] = unset' "fontfeatures" self
longhand _ self "font-feature-settings" toks
| (features, True, []) <- parseFontFeatures toks =
set "fontfeatures" Strong (intercalate "," $ map fst features) self
+ longhand _ self "font-variation-settings" [Ident k]
+ | k `elem` ["initial", "normal"] = unset' "variable" self
+ longhand _ self "font-variation-settings" toks
+ | (_, True, []) <- parseFontVars toks = set "variable" Strong True self
+
longhand _ _ _ _ = Nothing