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 /include | |
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 'include')
-rw-r--r-- | include/mupdf/html.h | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/include/mupdf/html.h b/include/mupdf/html.h index 75d46313..48231281 100644 --- a/include/mupdf/html.h +++ b/include/mupdf/html.h @@ -3,6 +3,7 @@ #include "mupdf/fitz.h" +typedef struct fz_html_font_face_s fz_html_font_face; typedef struct fz_html_font_set_s fz_html_font_set; typedef struct fz_html_s fz_html; typedef struct fz_html_flow_s fz_html_flow; @@ -19,10 +20,21 @@ typedef struct fz_css_value_s fz_css_value; typedef struct fz_css_number_s fz_css_number; typedef struct fz_css_color_s fz_css_color; +struct fz_html_font_face_s +{ + char *family; + int is_bold; + int is_italic; + fz_font *font; + char *src; + fz_html_font_face *next; +}; + struct fz_html_font_set_s { fz_font *fonts[16]; fz_font *fallback; + fz_html_font_face *custom; }; enum @@ -239,11 +251,13 @@ float fz_from_css_number(fz_css_number, float em, float width); float fz_from_css_number_scale(fz_css_number number, float scale, float em, float width); fz_html_font_set *fz_new_html_font_set(fz_context *ctx); -fz_font *fz_load_html_font(fz_context *ctx, fz_html_font_set *set, - const char *family, const char *variant, const char *style, const char *weight); -fz_font *fz_load_html_fallback_font(fz_context *ctx, fz_html_font_set *set); +void fz_add_html_font_face(fz_context *ctx, fz_html_font_set *set, + const char *family, int is_bold, int is_italic, const char *src, fz_font *font); +fz_font *fz_load_html_font(fz_context *ctx, fz_html_font_set *set, const char *family, int is_bold, int is_italic); void fz_drop_html_font_set(fz_context *ctx, fz_html_font_set *htx); +void fz_add_css_font_faces(fz_context *ctx, fz_html_font_set *set, fz_archive *zip, const char *base_uri, fz_css_rule *css); + fz_html *fz_parse_html(fz_context *ctx, fz_html_font_set *htx, fz_archive *zip, const char *base_uri, fz_buffer *buf, const char *user_css); void fz_layout_html(fz_context *ctx, fz_html *box, float w, float h, float em); void fz_draw_html(fz_context *ctx, fz_html *box, float page_top, float page_bot, fz_device *dev, const fz_matrix *ctm); |