| 1 | /**************************************************************************** |
| 2 | * |
| 3 | * sfwoff2.h |
| 4 | * |
| 5 | * WOFFF2 format management (specification). |
| 6 | * |
| 7 | * Copyright (C) 2019-2023 by |
| 8 | * Nikhil Ramakrishnan, David Turner, Robert Wilhelm, and Werner Lemberg. |
| 9 | * |
| 10 | * This file is part of the FreeType project, and may only be used, |
| 11 | * modified, and distributed under the terms of the FreeType project |
| 12 | * license, LICENSE.TXT. By continuing to use, modify, or distribute |
| 13 | * this file you indicate that you have read the license and |
| 14 | * understand and accept it fully. |
| 15 | * |
| 16 | */ |
| 17 | |
| 18 | |
| 19 | #ifndef SFWOFF2_H_ |
| 20 | #define SFWOFF2_H_ |
| 21 | |
| 22 | |
| 23 | #include <freetype/internal/sfnt.h> |
| 24 | #include <freetype/internal/ftobjs.h> |
| 25 | |
| 26 | |
| 27 | FT_BEGIN_HEADER |
| 28 | |
| 29 | #ifdef FT_CONFIG_OPTION_USE_BROTLI |
| 30 | |
| 31 | /* Leave the first byte open to store `flag_byte'. */ |
| 32 | #define WOFF2_FLAGS_TRANSFORM 1 << 8 |
| 33 | |
| 34 | #define 12 |
| 35 | #define WOFF2_SFNT_ENTRY_SIZE 16 |
| 36 | |
| 37 | /* Suggested maximum size for output. */ |
| 38 | #define WOFF2_DEFAULT_MAX_SIZE 30 * 1024 * 1024 |
| 39 | |
| 40 | /* 98% of Google Fonts have no glyph above 5k bytes. */ |
| 41 | #define WOFF2_DEFAULT_GLYPH_BUF 5120 |
| 42 | |
| 43 | /* Composite glyph flags. */ |
| 44 | /* See `CompositeGlyph.java' in `sfntly' for full definitions. */ |
| 45 | #define FLAG_ARG_1_AND_2_ARE_WORDS 1 << 0 |
| 46 | #define FLAG_WE_HAVE_A_SCALE 1 << 3 |
| 47 | #define FLAG_MORE_COMPONENTS 1 << 5 |
| 48 | #define FLAG_WE_HAVE_AN_X_AND_Y_SCALE 1 << 6 |
| 49 | #define FLAG_WE_HAVE_A_TWO_BY_TWO 1 << 7 |
| 50 | #define FLAG_WE_HAVE_INSTRUCTIONS 1 << 8 |
| 51 | |
| 52 | /* Simple glyph flags */ |
| 53 | #define GLYF_ON_CURVE 1 << 0 |
| 54 | #define GLYF_X_SHORT 1 << 1 |
| 55 | #define GLYF_Y_SHORT 1 << 2 |
| 56 | #define GLYF_REPEAT 1 << 3 |
| 57 | #define GLYF_THIS_X_IS_SAME 1 << 4 |
| 58 | #define GLYF_THIS_Y_IS_SAME 1 << 5 |
| 59 | #define GLYF_OVERLAP_SIMPLE 1 << 6 |
| 60 | |
| 61 | /* Other constants */ |
| 62 | #define CONTOUR_OFFSET_END_POINT 10 |
| 63 | |
| 64 | |
| 65 | FT_LOCAL( FT_Error ) |
| 66 | woff2_open_font( FT_Stream stream, |
| 67 | TT_Face face, |
| 68 | FT_Int* face_index, |
| 69 | FT_Long* num_faces ); |
| 70 | |
| 71 | #endif /* FT_CONFIG_OPTION_USE_BROTLI */ |
| 72 | |
| 73 | FT_END_HEADER |
| 74 | |
| 75 | #endif /* SFWOFF2_H_ */ |
| 76 | |
| 77 | |
| 78 | /* END */ |
| 79 | |