diff options
author | Nikhil Ramakrishnan <ramakrishnan.nikhil@gmail.com> | 2019-06-11 23:40:19 +0530 |
---|---|---|
committer | Nikhil Ramakrishnan <ramakrishnan.nikhil@gmail.com> | 2019-06-16 19:09:07 +0530 |
commit | c26c91aa39dcbc383e9db1cdee1191d8073db148 (patch) | |
tree | 7c78aecc8b58e5e2d454dad2d1cd72f73cca8aeb | |
parent | 47ca5cb69d26b606b51292a90d025688d4dc5e4e (diff) | |
download | freetype2-c26c91aa39dcbc383e9db1cdee1191d8073db148.tar.gz |
Add structures for WOFF2.
Add structures and macro for WOFF 2 header and table directory.
* include/freetype/internal/wofftypes.h (WOFF2_HeaderRec,
WOFF2_TableRec_): New structures.
* include/freetype/tttags.h (TTAG_wOF2): New macro.
-rw-r--r-- | include/freetype/internal/wofftypes.h | 67 | ||||
-rw-r--r-- | include/freetype/tttags.h | 1 |
2 files changed, 68 insertions, 0 deletions
diff --git a/include/freetype/internal/wofftypes.h b/include/freetype/internal/wofftypes.h index ba55bf883..1a5437f43 100644 --- a/include/freetype/internal/wofftypes.h +++ b/include/freetype/internal/wofftypes.h @@ -104,6 +104,73 @@ FT_BEGIN_HEADER } WOFF_TableRec, *WOFF_Table; + /************************************************************************** + * + * @struct: + * WOFF2_HeaderRec + * + * @description: + * WOFF2 file format header. + * + * @fields: + * See + * + * https://www.w3.org/TR/WOFF2/#woff20Header + * + * @note: + * We don't care about the fields `reserved`, `majorVersion` and + * `minorVersion`, so they are not included. The `totalSfntSize` field + * does not necessarily represent the actual size of the uncompressed + * SFNT font stream, so that is not included either. + */ + typedef struct WOFF2_HeaderRec + { + FT_ULong signature; + FT_ULong flavor; + FT_ULong length; + FT_UShort num_tables; + FT_ULong totalCompressedSize; + FT_ULong metaOffset; + FT_ULong metaLength; + FT_ULong metaOrigLength; + FT_ULong privOffset; + FT_ULong privLength; + + FT_ULong uncompressed_size; + FT_ULong header_version; + + } WOFF2_HeaderRec, *WOFF2_Header; + + + /************************************************************************** + * + * @struct: + * WOFF2_TableRec + * + * @description: + * This structure describes a given table of a WOFF2 font. + * + * @fields: + * See + * + * https://www.w3.org/TR/WOFF2/#table_dir_format + */ + typedef struct WOFF2_TableRec_ + { + FT_Byte FlagByte; /* table type and flags */ + FT_ULong Tag; /* table file offset */ + FT_ULong OrigLength; /* uncompressed table length */ + FT_ULong TransformLength; /* transformed length */ + + FT_ULong flags; /* calculated flags */ + FT_ULong src_offset; /* compressed table offset */ + FT_ULong src_length; /* compressed table length */ + + FT_ULong dst_offset; /* uncompressed table offset */ + + } WOFF2_TableRec, *WOFF2_Table; + + FT_END_HEADER #endif /* WOFFTYPES_H_ */ diff --git a/include/freetype/tttags.h b/include/freetype/tttags.h index bd0986eff..7be9e1331 100644 --- a/include/freetype/tttags.h +++ b/include/freetype/tttags.h @@ -107,6 +107,7 @@ FT_BEGIN_HEADER #define TTAG_vmtx FT_MAKE_TAG( 'v', 'm', 't', 'x' ) #define TTAG_VVAR FT_MAKE_TAG( 'V', 'V', 'A', 'R' ) #define TTAG_wOFF FT_MAKE_TAG( 'w', 'O', 'F', 'F' ) +#define TTAG_wOF2 FT_MAKE_TAG( 'w', 'O', 'F', '2' ) /* used by "Keyboard.dfont" on legacy Mac OS X */ #define TTAG_0xA5kbd FT_MAKE_TAG( 0xA5, 'k', 'b', 'd' ) |