Hash :
5367e0ca
Author :
Date :
2019-08-05T01:53:00
[sfnt] Support `face->num_faces' for WOFF2 fonts. Set correct value of `face->num_faces' for WOFF2 fonts. This is being handled separately because we only load the tables for the requested font face in `woff2_open_font' and create a single-face sfnt stream. The full discussion is at: https://lists.gnu.org/archive/html/freetype-devel/2019-08/msg00000.html * src/sfnt/sfobjs.c (sfnt_open_font): Add parameter `woff2_num_faces'. (sfnt_init_face): Introduce variable `woff2_num_faces', and change `face->root.num_faces' if `woff2_num_faces' is set. * src/sfnt/sfwoff2.c (woff2_open_font): Validate requested face index and handle negative face indices. * src/sfnt/sfwoff2.h (woff2_open_font): Add parameter `num_faces' to declaration.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76
/****************************************************************************
*
* sfwoff2.h
*
* WOFFF2 format management (specification).
*
* 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.
*
*/
#ifndef SFWOFF2_H_
#define SFWOFF2_H_
#include <ft2build.h>
#include FT_INTERNAL_SFNT_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
/* Suggested max size for output. */
#define WOFF2_DEFAULT_MAX_SIZE 30 * 1024 * 1024
/* 98% of Google Fonts have no glyph above 5k bytes. */
#define WOFF2_DEFAULT_GLYPH_BUF 5120
/* Composite glyph flags */
/* See CompositeGlyph.java in `sfntly' for full definitions */
#define FLAG_ARG_1_AND_2_ARE_WORDS 1 << 0
#define FLAG_WE_HAVE_A_SCALE 1 << 3
#define FLAG_MORE_COMPONENTS 1 << 5
#define FLAG_WE_HAVE_AN_X_AND_Y_SCALE 1 << 6
#define FLAG_WE_HAVE_A_TWO_BY_TWO 1 << 7
#define FLAG_WE_HAVE_INSTRUCTIONS 1 << 8
/* Simple glyph flags */
#define GLYF_ON_CURVE 1 << 0
#define GLYF_X_SHORT 1 << 1
#define GLYF_Y_SHORT 1 << 2
#define GLYF_REPEAT 1 << 3
#define GLYF_THIS_X_IS_SAME 1 << 4
#define GLYF_THIS_Y_IS_SAME 1 << 5
/* Other constants */
#define CONTOUR_OFFSET_END_POINT 10
FT_LOCAL( FT_Error )
woff2_open_font( FT_Stream stream,
TT_Face face,
FT_Int* face_index,
FT_Long* num_faces );
FT_END_HEADER
#endif /* SFWOFF2_H_ */
/* END */