shithub: freetype+ttf2subf

Download patch

ref: b45c7dd5e2719da00a724bbb29fbc2b882060ade
parent: 2fa573c1b038a32b7c6f5c76477f9b66a47cc425
author: Nikhil Ramakrishnan <[email protected]>
date: Sun Jun 16 13:55:59 EDT 2019

[sfnt] Add WOFF2 constants.

Add constants required for WOFF2, and known table tags as defined in
the specification.  See

  https://www.w3.org/TR/WOFF2/#table_dir_format

for details.

* src/sfnt/woff2tags.c, src/sfnt/woff2tags.h: New files.

git/fs: mount .git/fs: mount/attach disallowed
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,18 @@
 2019-08-27  Nikhil Ramakrishnan  <[email protected]>
 
+	[sfnt] Add WOFF2 constants.
+
+	Add constants required for WOFF2, and known table tags as defined in
+	the specification.  See
+
+	  https://www.w3.org/TR/WOFF2/#table_dir_format
+
+	for details.
+
+	* src/sfnt/woff2tags.c, src/sfnt/woff2tags.h: New files.
+
+2019-08-27  Nikhil Ramakrishnan  <[email protected]>
+
 	[sfnt] Read WOFF 2 header.
 
 	Check for WOFF2 tag, call `woff2_open_font', and implement it to read
--- /dev/null
+++ b/src/sfnt/woff2tags.c
@@ -1,0 +1,90 @@
+/****************************************************************************
+ *
+ * woff2tags.c
+ *
+ *   WOFF2 Font table tags (base).
+ *
+ * Copyright (C) 2019 by
+ * Nikhil Ramakrishnan, David Turner, Robert Wilhelm, and Werner Lemberg.
+ *
+ * This file is part of the FreeType project, and may only be used,
+ * modified, and distributed under the terms of the FreeType project
+ * license, LICENSE.TXT.  By continuing to use, modify, or distribute
+ * this file you indicate that you have read the license and
+ * understand and accept it fully.
+ *
+ */
+
+#include <ft2build.h>
+#include "sfwoff.h"
+#include FT_TRUETYPE_TAGS_H
+
+/* Known table tags in the order given in WOFF2 specification. */
+const FT_ULong KnownTags[63] = {
+  FT_MAKE_TAG('c', 'm', 'a', 'p'),  /*  0  */
+  FT_MAKE_TAG('h', 'e', 'a', 'd'),  /*  1  */
+  FT_MAKE_TAG('h', 'h', 'e', 'a'),  /*  2  */
+  FT_MAKE_TAG('h', 'm', 't', 'x'),  /*  3  */
+  FT_MAKE_TAG('m', 'a', 'x', 'p'),  /*  4  */
+  FT_MAKE_TAG('n', 'a', 'm', 'e'),  /*  5  */
+  FT_MAKE_TAG('O', 'S', '/', '2'),  /*  6  */
+  FT_MAKE_TAG('p', 'o', 's', 't'),  /*  7  */
+  FT_MAKE_TAG('c', 'v', 't', ' '),  /*  8  */
+  FT_MAKE_TAG('f', 'p', 'g', 'm'),  /*  9  */
+  FT_MAKE_TAG('g', 'l', 'y', 'f'),  /*  10 */
+  FT_MAKE_TAG('l', 'o', 'c', 'a'),  /*  11 */
+  FT_MAKE_TAG('p', 'r', 'e', 'p'),  /*  12 */
+  FT_MAKE_TAG('C', 'F', 'F', ' '),  /*  13 */
+  FT_MAKE_TAG('V', 'O', 'R', 'G'),  /*  14 */
+  FT_MAKE_TAG('E', 'B', 'D', 'T'),  /*  15 */
+  FT_MAKE_TAG('E', 'B', 'L', 'C'),  /*  16 */
+  FT_MAKE_TAG('g', 'a', 's', 'p'),  /*  17 */
+  FT_MAKE_TAG('h', 'd', 'm', 'x'),  /*  18 */
+  FT_MAKE_TAG('k', 'e', 'r', 'n'),  /*  19 */
+  FT_MAKE_TAG('L', 'T', 'S', 'H'),  /*  20 */
+  FT_MAKE_TAG('P', 'C', 'L', 'T'),  /*  21 */
+  FT_MAKE_TAG('V', 'D', 'M', 'X'),  /*  22 */
+  FT_MAKE_TAG('v', 'h', 'e', 'a'),  /*  23 */
+  FT_MAKE_TAG('v', 'm', 't', 'x'),  /*  24 */
+  FT_MAKE_TAG('B', 'A', 'S', 'E'),  /*  25 */
+  FT_MAKE_TAG('G', 'D', 'E', 'F'),  /*  26 */
+  FT_MAKE_TAG('G', 'P', 'O', 'S'),  /*  27 */
+  FT_MAKE_TAG('G', 'S', 'U', 'B'),  /*  28 */
+  FT_MAKE_TAG('E', 'B', 'S', 'C'),  /*  29 */
+  FT_MAKE_TAG('J', 'S', 'T', 'F'),  /*  30 */
+  FT_MAKE_TAG('M', 'A', 'T', 'H'),  /*  31 */
+  FT_MAKE_TAG('C', 'B', 'D', 'T'),  /*  32 */
+  FT_MAKE_TAG('C', 'B', 'L', 'C'),  /*  33 */
+  FT_MAKE_TAG('C', 'O', 'L', 'R'),  /*  34 */
+  FT_MAKE_TAG('C', 'P', 'A', 'L'),  /*  35 */
+  FT_MAKE_TAG('S', 'V', 'G', ' '),  /*  36 */
+  FT_MAKE_TAG('s', 'b', 'i', 'x'),  /*  37 */
+  FT_MAKE_TAG('a', 'c', 'n', 't'),  /*  38 */
+  FT_MAKE_TAG('a', 'v', 'a', 'r'),  /*  39 */
+  FT_MAKE_TAG('b', 'd', 'a', 't'),  /*  40 */
+  FT_MAKE_TAG('b', 'l', 'o', 'c'),  /*  41 */
+  FT_MAKE_TAG('b', 's', 'l', 'n'),  /*  42 */
+  FT_MAKE_TAG('c', 'v', 'a', 'r'),  /*  43 */
+  FT_MAKE_TAG('f', 'd', 's', 'c'),  /*  44 */
+  FT_MAKE_TAG('f', 'e', 'a', 't'),  /*  45 */
+  FT_MAKE_TAG('f', 'm', 't', 'x'),  /*  46 */
+  FT_MAKE_TAG('f', 'v', 'a', 'r'),  /*  47 */
+  FT_MAKE_TAG('g', 'v', 'a', 'r'),  /*  48 */
+  FT_MAKE_TAG('h', 's', 't', 'y'),  /*  49 */
+  FT_MAKE_TAG('j', 'u', 's', 't'),  /*  50 */
+  FT_MAKE_TAG('l', 'c', 'a', 'r'),  /*  51 */
+  FT_MAKE_TAG('m', 'o', 'r', 't'),  /*  52 */
+  FT_MAKE_TAG('m', 'o', 'r', 'x'),  /*  53 */
+  FT_MAKE_TAG('o', 'p', 'b', 'd'),  /*  54 */
+  FT_MAKE_TAG('p', 'r', 'o', 'p'),  /*  55 */
+  FT_MAKE_TAG('t', 'r', 'a', 'k'),  /*  56 */
+  FT_MAKE_TAG('Z', 'a', 'p', 'f'),  /*  57 */
+  FT_MAKE_TAG('S', 'i', 'l', 'f'),  /*  58 */
+  FT_MAKE_TAG('G', 'l', 'a', 't'),  /*  59 */
+  FT_MAKE_TAG('G', 'l', 'o', 'c'),  /*  60 */
+  FT_MAKE_TAG('F', 'e', 'a', 't'),  /*  61 */
+  FT_MAKE_TAG('S', 'i', 'l', 'l'),  /*  62 */
+};
+
+
+/* END */
--- /dev/null
+++ b/src/sfnt/woff2tags.h
@@ -1,0 +1,44 @@
+/****************************************************************************
+ *
+ * woff2tags.h
+ *
+ *   WOFFF2 Font table tags (specification).
+ *
+ * Copyright (C) 1996-2019 by
+ * Nikhil Ramakrishnan, David Turner, Robert Wilhelm, and Werner Lemberg.
+ *
+ * This file is part of the FreeType project, and may only be used,
+ * modified, and distributed under the terms of the FreeType project
+ * license, LICENSE.TXT.  By continuing to use, modify, or distribute
+ * this file you indicate that you have read the license and
+ * understand and accept it fully.
+ *
+ */
+
+
+#ifndef WOFF2TAGS_H
+#define WOFF2TAGS_H
+
+
+#include <ft2build.h>
+#include FT_INTERNAL_OBJECTS_H
+
+
+FT_BEGIN_HEADER
+
+
+/* Leave the first byte open to store flag_byte. */
+#define WOFF2_FLAGS_TRANSFORM   1 << 8
+
+#define WOFF2_SFNT_HEADER_SIZE  12
+#define WOFF2_SFNT_ENTRY_SIZE   16
+
+/* Known table tags. */
+extern const FT_ULong KnownTags[];
+
+FT_END_HEADER
+
+#endif /* WOFF2TAGS_H */
+
+
+/* END */