From d5a183e14d42560632a6aa270aede226215bb3d3 Mon Sep 17 00:00:00 2001 From: John Mark Bell Date: Sun, 4 Dec 2011 21:06:24 +0000 Subject: @font-face support. Credit: James Montgomerie Things missing: parser tests; the following descriptors: font-feature-settings, font-stretch, font-variant, unicode-range. svn path=/trunk/libcss/; revision=13244 --- include/libcss/font_face.h | 79 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 include/libcss/font_face.h (limited to 'include/libcss/font_face.h') diff --git a/include/libcss/font_face.h b/include/libcss/font_face.h new file mode 100644 index 0000000..6b18433 --- /dev/null +++ b/include/libcss/font_face.h @@ -0,0 +1,79 @@ +/* + * This file is part of LibCSS. + * Licensed under the MIT License, + * http://www.opensource.org/licenses/mit-license.php + * Copyright 2011 Things Made Out Of Other Things Ltd. + * Written by James Montgomerie + */ + +#ifndef libcss_font_face_h_ +#define libcss_font_face_h_ + +#ifdef __cplusplus +extern "C" +{ +#endif + +#include + +#include +#include +#include +#include + +typedef enum css_font_face_format { + CSS_FONT_FACE_FORMAT_UNSPECIFIED = 0x00, + + CSS_FONT_FACE_FORMAT_WOFF = 0x01, + /* WOFF (Web Open Font Format); .woff */ + CSS_FONT_FACE_FORMAT_OPENTYPE = 0x02, + /* TrueType or OpenType; .ttf, .otf */ + CSS_FONT_FACE_FORMAT_EMBEDDED_OPENTYPE = 0x04, + /* Embedded OpenType; .eot */ + CSS_FONT_FACE_FORMAT_SVG = 0x08, + /* SVG Font; .svg, .svgz */ + + CSS_FONT_FACE_FORMAT_UNKNOWN = 0x10, + /* Format specified, but not recognised */ + + /* We don't define CSS_FONT_FACE_SRC_FORMAT_TRUETYPE as might be + * expected, because the CSS3 specification + * (http://www.w3.org/TR/css3-fonts/, ยง4.3) says: + * "Given the overlap in common usage between TrueType and + * OpenType, the format hints "truetype" and "opentype" must be + * considered as synonymous" + * so we compute a hint of 'truetype' to css_font_face_format_opentype. + */ +} css_font_face_format; + +typedef enum css_font_face_location_type { + CSS_FONT_FACE_LOCATION_TYPE_UNSPECIFIED = 0, + CSS_FONT_FACE_LOCATION_TYPE_LOCAL = 1, + CSS_FONT_FACE_LOCATION_TYPE_URI = 2, +} css_font_face_location_type; + + +css_error css_font_face_get_font_family( + const css_font_face *font_face, + lwc_string **font_family); + +css_error css_font_face_count_srcs(const css_font_face *font_face, + uint32_t *count); +css_error css_font_face_get_src(const css_font_face *font_face, uint32_t index, + const css_font_face_src **src); + +css_error css_font_face_src_get_location(const css_font_face_src *src, + lwc_string **location); + +css_font_face_location_type css_font_face_src_location_type( + const css_font_face_src *src); +css_font_face_format css_font_face_src_format(const css_font_face_src *src); + +uint8_t css_font_face_font_style(const css_font_face *font_face); +uint8_t css_font_face_font_weight(const css_font_face *font_face); + +#ifdef __cplusplus +} +#endif + +#endif -- cgit v1.2.3