-
Notifications
You must be signed in to change notification settings - Fork 0
/
font_face.py
34 lines (25 loc) · 837 Bytes
/
font_face.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# coding: utf8
"""
tinycss.font_face
Support for @font-face syntax
"""
from __future__ import unicode_literals, division
from tinycss.css21 import CSS21Parser, ParseError
class fontFaceRule(object):
"""
A parsed CSS @font-face rule
http://www.w3.org/TR/css3-fonts/#font-face-rule
"""
at_keyword = '@font-face'
def __init__(self, declarations, line, column):
self.declarations = declarations
self.line = line
self.column = column
class CSSFontFaceParser(CSS21Parser):
"""
Extend CSS21Parser for @font-face syntax
"""
def parse_at_rule(self, rule, previous_rules, errors, context):
declarations, body_errors = self.parse_declaration_list(rule.body)
errors.extend(body_errors)
return fontFaceRule(declarations, rule.line, rule.column)