diff options
author | Tor Andersson <tor.andersson@artifex.com> | 2016-01-22 12:00:55 +0100 |
---|---|---|
committer | Tor Andersson <tor.andersson@artifex.com> | 2016-01-22 12:00:55 +0100 |
commit | f501211e904d2c01e47b03e774ffc6f93faeae25 (patch) | |
tree | aa13c9d28c17e3dbb73459ccf7c6a8ca6c3906e4 /source/html/css-parse.c | |
parent | b31c7d1559125b5a0c596e52d632c70e48c506cf (diff) | |
download | mupdf-f501211e904d2c01e47b03e774ffc6f93faeae25.tar.xz |
epub: Implement @font-face rules.
Note: font->fallback is not reference counted here. The fallback
mechanism is probably going to have to change when we add text shaping.
Diffstat (limited to 'source/html/css-parse.c')
-rw-r--r-- | source/html/css-parse.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/source/html/css-parse.c b/source/html/css-parse.c index f9d7595c..e395e933 100644 --- a/source/html/css-parse.c +++ b/source/html/css-parse.c @@ -879,6 +879,21 @@ static fz_css_rule *parse_at_page(struct lexbuf *buf) return fz_new_css_rule(buf->ctx, s, p); } +static fz_css_rule *parse_at_font_face(struct lexbuf *buf) +{ + fz_css_selector *s = NULL; + fz_css_property *p = NULL; + + white(buf); + expect(buf, '{'); + p = parse_declaration_list(buf); + expect(buf, '}'); + white(buf); + + s = fz_new_css_selector(buf->ctx, "@font-face"); + return fz_new_css_rule(buf->ctx, s, p); +} + static void parse_at_rule(struct lexbuf *buf) { expect(buf, CSS_KEYWORD); @@ -938,6 +953,12 @@ static fz_css_rule *parse_stylesheet(struct lexbuf *buf, fz_css_rule *chain) rule = *nextp = parse_at_page(buf); nextp = &rule->next; } + else if (buf->lookahead == CSS_KEYWORD && !strcmp(buf->string, "font-face")) + { + next(buf); + rule = *nextp = parse_at_font_face(buf); + nextp = &rule->next; + } else { parse_at_rule(buf); |