diff --git a/zuss-test/cases/font_face.zuss b/zuss-test/cases/font_face.zuss new file mode 100644 index 0000000..d3bf646 --- /dev/null +++ b/zuss-test/cases/font_face.zuss @@ -0,0 +1,49 @@ +@font-face { + font-family: 'PT Sans'; + font-style: normal; + font-weight: 400; + src: url('../../fonts/pt_sans/PT_Sans-Web-Regular.eot'); /* EOT file for IE */ + src: local('PT Sans'), local('PTSans-Regular'), url('../../fonts/pt_sans/PT_Sans-Web-Regular.ttf') format("truetype"); /*CSS3 Browser*/ +} + +@font-face { + font-family: 'PT Sans'; + font-style: normal; + font-weight: 700; + src: url('../../fonts/pt_sans/PT_Sans-Web-Bold.eot'); /* EOT file for IE */ + src: local('PT Sans Bold'), local('PTSans-Bold'), url('../../fonts/pt_sans/PT_Sans-Web-Bold.ttf') format("truetype"); +} + +@nice_grey: #5B5B5B; +@darken(@color, @diff: 10%): @color * (1 - @diff); + +div { + color: @darken(@nice_grey); +} + +.bordered { + &.float { + float: left; + } + .top { + margin: 5px; + } +} + +@border_radious(@radius: 4px) { + border-radius: @radius; +} + +div.rounded { + @border_radious(); +} +button.rounded { + @border_radious(3px); +} + +@nice-blue: #5B83AD; +@light-blue: @nice-blue + #111; +@dark-orange: orange - #010203; + +div.hilite { color: @light-blue;} +div.hilite2 { color: @dark-orange;} \ No newline at end of file diff --git a/zuss/src/org/zkoss/zuss/impl/in/Keyword.java b/zuss/src/org/zkoss/zuss/impl/in/Keyword.java index 344ac6d..3b1f603 100755 --- a/zuss/src/org/zkoss/zuss/impl/in/Keyword.java +++ b/zuss/src/org/zkoss/zuss/impl/in/Keyword.java @@ -47,7 +47,9 @@ public String toString() { /** CSS's @charset. */ CHARSET("@charset"), /** CSS's @media. */ - MEDIA("@media"); + MEDIA("@media"), + /** CSS's @font-face **/ + FONTFACE("@font-face"); private final String value; private Value(String value) { diff --git a/zuss/src/org/zkoss/zuss/impl/in/Parser.java b/zuss/src/org/zkoss/zuss/impl/in/Parser.java index dfae425..6b9d5ee 100755 --- a/zuss/src/org/zkoss/zuss/impl/in/Parser.java +++ b/zuss/src/org/zkoss/zuss/impl/in/Parser.java @@ -135,6 +135,9 @@ private void parseKeyword(Context ctx, Keyword kw) throws IOException { newBlock(ctx, new MediaDefinition(ctx.block.owner, scope, kw.getLine())); return; + case FONTFACE: + new RawValue(ctx.block.owner, "@font-face "+_in.getUntil("}")+'\n', kw.getLine()); + return; case IF: nextAndCheck(ctx, '(', false); expr = new Expression(_in.getLine()); diff --git a/zuss/src/org/zkoss/zuss/impl/in/Tokenizer.java b/zuss/src/org/zkoss/zuss/impl/in/Tokenizer.java index d613c42..44fd1a2 100755 --- a/zuss/src/org/zkoss/zuss/impl/in/Tokenizer.java +++ b/zuss/src/org/zkoss/zuss/impl/in/Tokenizer.java @@ -332,6 +332,8 @@ private Token asId() throws IOException { return new Keyword(Keyword.Value.IMPORT, getLine()); if ("media".equals(nm)) return new Keyword(Keyword.Value.MEDIA, getLine()); + if ("font-face".equals(nm)) + return new Keyword(Keyword.Value.FONTFACE, getLine()); return new Id(nm, getLine()); } private Token asString(char quot) throws IOException {