|
Packit |
874993 |
/*
|
|
Packit |
874993 |
* Copyright © 2010 Red Hat, Inc.
|
|
Packit |
874993 |
* Copyright © 2012 Google, Inc.
|
|
Packit |
874993 |
*
|
|
Packit |
874993 |
* This is part of HarfBuzz, a text shaping library.
|
|
Packit |
874993 |
*
|
|
Packit |
874993 |
* Permission is hereby granted, without written agreement and without
|
|
Packit |
874993 |
* license or royalty fees, to use, copy, modify, and distribute this
|
|
Packit |
874993 |
* software and its documentation for any purpose, provided that the
|
|
Packit |
874993 |
* above copyright notice and the following two paragraphs appear in
|
|
Packit |
874993 |
* all copies of this software.
|
|
Packit |
874993 |
*
|
|
Packit |
874993 |
* IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
|
|
Packit |
874993 |
* DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
|
|
Packit |
874993 |
* ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
|
|
Packit |
874993 |
* IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
|
Packit |
874993 |
* DAMAGE.
|
|
Packit |
874993 |
*
|
|
Packit |
874993 |
* THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
|
|
Packit |
874993 |
* BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
|
Packit |
874993 |
* FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
|
|
Packit |
874993 |
* ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
|
|
Packit |
874993 |
* PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
|
|
Packit |
874993 |
*
|
|
Packit |
874993 |
* Red Hat Author(s): Behdad Esfahbod
|
|
Packit |
874993 |
* Google Author(s): Behdad Esfahbod
|
|
Packit |
874993 |
*/
|
|
Packit |
874993 |
|
|
Packit |
874993 |
#ifndef HB_OT_HEAD_TABLE_HH
|
|
Packit |
874993 |
#define HB_OT_HEAD_TABLE_HH
|
|
Packit |
874993 |
|
|
Packit |
874993 |
#include "hb-open-type-private.hh"
|
|
Packit |
874993 |
|
|
Packit |
874993 |
|
|
Packit |
874993 |
namespace OT {
|
|
Packit |
874993 |
|
|
Packit |
874993 |
|
|
Packit |
874993 |
/*
|
|
Packit |
874993 |
* head -- Font Header
|
|
Packit |
874993 |
*/
|
|
Packit |
874993 |
|
|
Packit |
874993 |
#define HB_OT_TAG_head HB_TAG('h','e','a','d')
|
|
Packit |
874993 |
|
|
Packit |
874993 |
struct head
|
|
Packit |
874993 |
{
|
|
Packit |
874993 |
static const hb_tag_t tableTag = HB_OT_TAG_head;
|
|
Packit |
874993 |
|
|
Packit |
874993 |
inline unsigned int get_upem (void) const
|
|
Packit |
874993 |
{
|
|
Packit |
874993 |
unsigned int upem = unitsPerEm;
|
|
Packit |
874993 |
/* If no valid head table found, assume 1000, which matches typical Type1 usage. */
|
|
Packit |
874993 |
return 16 <= upem && upem <= 16384 ? upem : 1000;
|
|
Packit |
874993 |
}
|
|
Packit |
874993 |
|
|
Packit |
874993 |
inline bool sanitize (hb_sanitize_context_t *c) const
|
|
Packit |
874993 |
{
|
|
Packit |
874993 |
TRACE_SANITIZE (this);
|
|
Packit |
874993 |
return_trace (c->check_struct (this) &&
|
|
Packit |
874993 |
version.major == 1 &&
|
|
Packit |
874993 |
magicNumber == 0x5F0F3CF5u);
|
|
Packit |
874993 |
}
|
|
Packit |
874993 |
|
|
Packit |
874993 |
protected:
|
|
Packit |
874993 |
FixedVersion<>version; /* Version of the head table--currently
|
|
Packit |
874993 |
* 0x00010000u for version 1.0. */
|
|
Packit |
874993 |
FixedVersion<>fontRevision; /* Set by font manufacturer. */
|
|
Packit |
874993 |
ULONG checkSumAdjustment; /* To compute: set it to 0, sum the
|
|
Packit |
874993 |
* entire font as ULONG, then store
|
|
Packit |
874993 |
* 0xB1B0AFBAu - sum. */
|
|
Packit |
874993 |
ULONG magicNumber; /* Set to 0x5F0F3CF5u. */
|
|
Packit |
874993 |
USHORT flags; /* Bit 0: Baseline for font at y=0;
|
|
Packit |
874993 |
* Bit 1: Left sidebearing point at x=0;
|
|
Packit |
874993 |
* Bit 2: Instructions may depend on point size;
|
|
Packit |
874993 |
* Bit 3: Force ppem to integer values for all
|
|
Packit |
874993 |
* internal scaler math; may use fractional
|
|
Packit |
874993 |
* ppem sizes if this bit is clear;
|
|
Packit |
874993 |
* Bit 4: Instructions may alter advance width
|
|
Packit |
874993 |
* (the advance widths might not scale linearly);
|
|
Packit |
874993 |
|
|
Packit |
874993 |
* Bits 5-10: These should be set according to
|
|
Packit |
874993 |
* Apple's specification. However, they are not
|
|
Packit |
874993 |
* implemented in OpenType.
|
|
Packit |
874993 |
* Bit 5: This bit should be set in fonts that are
|
|
Packit |
874993 |
* intended to e laid out vertically, and in
|
|
Packit |
874993 |
* which the glyphs have been drawn such that an
|
|
Packit |
874993 |
* x-coordinate of 0 corresponds to the desired
|
|
Packit |
874993 |
* vertical baseline.
|
|
Packit |
874993 |
* Bit 6: This bit must be set to zero.
|
|
Packit |
874993 |
* Bit 7: This bit should be set if the font
|
|
Packit |
874993 |
* requires layout for correct linguistic
|
|
Packit |
874993 |
* rendering (e.g. Arabic fonts).
|
|
Packit |
874993 |
* Bit 8: This bit should be set for a GX font
|
|
Packit |
874993 |
* which has one or more metamorphosis effects
|
|
Packit |
874993 |
* designated as happening by default.
|
|
Packit |
874993 |
* Bit 9: This bit should be set if the font
|
|
Packit |
874993 |
* contains any strong right-to-left glyphs.
|
|
Packit |
874993 |
* Bit 10: This bit should be set if the font
|
|
Packit |
874993 |
* contains Indic-style rearrangement effects.
|
|
Packit |
874993 |
|
|
Packit |
874993 |
* Bit 11: Font data is 'lossless,' as a result
|
|
Packit |
874993 |
* of having been compressed and decompressed
|
|
Packit |
874993 |
* with the Agfa MicroType Express engine.
|
|
Packit |
874993 |
* Bit 12: Font converted (produce compatible metrics)
|
|
Packit |
874993 |
* Bit 13: Font optimized for ClearType™.
|
|
Packit |
874993 |
* Note, fonts that rely on embedded bitmaps (EBDT)
|
|
Packit |
874993 |
* for rendering should not be considered optimized
|
|
Packit |
874993 |
* for ClearType, and therefore should keep this bit
|
|
Packit |
874993 |
* cleared.
|
|
Packit |
874993 |
* Bit 14: Last Resort font. If set, indicates that
|
|
Packit |
874993 |
* the glyphs encoded in the cmap subtables are simply
|
|
Packit |
874993 |
* generic symbolic representations of code point
|
|
Packit |
874993 |
* ranges and don’t truly represent support for those
|
|
Packit |
874993 |
* code points. If unset, indicates that the glyphs
|
|
Packit |
874993 |
* encoded in the cmap subtables represent proper
|
|
Packit |
874993 |
* support for those code points.
|
|
Packit |
874993 |
* Bit 15: Reserved, set to 0. */
|
|
Packit |
874993 |
USHORT unitsPerEm; /* Valid range is from 16 to 16384. This value
|
|
Packit |
874993 |
* should be a power of 2 for fonts that have
|
|
Packit |
874993 |
* TrueType outlines. */
|
|
Packit |
874993 |
LONGDATETIME created; /* Number of seconds since 12:00 midnight,
|
|
Packit |
874993 |
January 1, 1904. 64-bit integer */
|
|
Packit |
874993 |
LONGDATETIME modified; /* Number of seconds since 12:00 midnight,
|
|
Packit |
874993 |
January 1, 1904. 64-bit integer */
|
|
Packit |
874993 |
SHORT xMin; /* For all glyph bounding boxes. */
|
|
Packit |
874993 |
SHORT yMin; /* For all glyph bounding boxes. */
|
|
Packit |
874993 |
SHORT xMax; /* For all glyph bounding boxes. */
|
|
Packit |
874993 |
SHORT yMax; /* For all glyph bounding boxes. */
|
|
Packit |
874993 |
USHORT macStyle; /* Bit 0: Bold (if set to 1);
|
|
Packit |
874993 |
* Bit 1: Italic (if set to 1)
|
|
Packit |
874993 |
* Bit 2: Underline (if set to 1)
|
|
Packit |
874993 |
* Bit 3: Outline (if set to 1)
|
|
Packit |
874993 |
* Bit 4: Shadow (if set to 1)
|
|
Packit |
874993 |
* Bit 5: Condensed (if set to 1)
|
|
Packit |
874993 |
* Bit 6: Extended (if set to 1)
|
|
Packit |
874993 |
* Bits 7-15: Reserved (set to 0). */
|
|
Packit |
874993 |
USHORT lowestRecPPEM; /* Smallest readable size in pixels. */
|
|
Packit |
874993 |
SHORT fontDirectionHint; /* Deprecated (Set to 2).
|
|
Packit |
874993 |
* 0: Fully mixed directional glyphs;
|
|
Packit |
874993 |
* 1: Only strongly left to right;
|
|
Packit |
874993 |
* 2: Like 1 but also contains neutrals;
|
|
Packit |
874993 |
* -1: Only strongly right to left;
|
|
Packit |
874993 |
* -2: Like -1 but also contains neutrals. */
|
|
Packit |
874993 |
public:
|
|
Packit |
874993 |
SHORT indexToLocFormat; /* 0 for short offsets, 1 for long. */
|
|
Packit |
874993 |
SHORT glyphDataFormat; /* 0 for current format. */
|
|
Packit |
874993 |
|
|
Packit |
874993 |
DEFINE_SIZE_STATIC (54);
|
|
Packit |
874993 |
};
|
|
Packit |
874993 |
|
|
Packit |
874993 |
|
|
Packit |
874993 |
} /* namespace OT */
|
|
Packit |
874993 |
|
|
Packit |
874993 |
|
|
Packit |
874993 |
#endif /* HB_OT_HEAD_TABLE_HH */
|