The Birdfont Source Code


All Repositories / birdfont.git / blobdiff – RSS feed

CSS margin

Changes made to libsvgbird/SvgStyle.vala

Contributing

Send patches or pull requests to johan.mattsson.m@gmail.com.
Clone this repository: git clone https://github.com/johanmattssonm/birdfont.git
--- libsvgbird/SvgStyle.vala +++ libsvgbird/SvgStyle.vala @@ -284,10 +284,32 @@ if (k == "padding") { parse_padding_shorthand (v); + } else if (k == "margin") { + parse_margin_shorthand (v); } else { style.set (k, v); } } + } + } + + void parse_margin_shorthand (string arguments) { + string[] args = StyleSheet.replace_whitespace (arguments).split (" "); + + if (args.length > 0) { + style.set ("margin-top", args[0]); + } + + if (args.length > 1) { + style.set ("margin-right", args[1]); + } + + if (args.length > 2) { + style.set ("margin-bottom", args[2]); + } + + if (args.length > 3) { + style.set ("margin-left", args[3]); } }