1 /*
   2  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   3  *
   4  * This code is free software; you can redistribute it and/or modify it
   5  * under the terms of the GNU General Public License version 2 only, as
   6  * published by the Free Software Foundation.  Oracle designates this
   7  * particular file as subject to the "Classpath" exception as provided
   8  * by Oracle in the LICENSE file that accompanied this code.
   9  *
  10  * This code is distributed in the hope that it will be useful, but WITHOUT
  11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  12  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  13  * version 2 for more details (a copy is included in the LICENSE file that
  14  * accompanied this code).
  15  *
  16  * You should have received a copy of the GNU General Public License version
  17  * 2 along with this work; if not, write to the Free Software Foundation,
  18  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  19  *
  20  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  21  * or visit www.oracle.com if you need additional information or have any
  22  * questions.
  23  */
  24 
  25 // This file is available under and governed by the GNU General Public
  26 // License version 2 only, as published by the Free Software Foundation.
  27 // However, the following notice accompanied the original version of this
  28 // file:
  29 //
  30 /*
  31  * Copyright © 2015  Google, Inc.
  32  *
  33  *  This is part of HarfBuzz, a text shaping library.
  34  *
  35  * Permission is hereby granted, without written agreement and without
  36  * license or royalty fees, to use, copy, modify, and distribute this
  37  * software and its documentation for any purpose, provided that the
  38  * above copyright notice and the following two paragraphs appear in
  39  * all copies of this software.
  40  *
  41  * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
  42  * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
  43  * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
  44  * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
  45  * DAMAGE.
  46  *
  47  * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
  48  * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
  49  * FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
  50  * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
  51  * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
  52  *
  53  * Google Author(s): Behdad Esfahbod
  54  */
  55 
  56 #ifndef HB_OT_GLYF_TABLE_HH
  57 #define HB_OT_GLYF_TABLE_HH
  58 
  59 #include "hb-open-type-private.hh"
  60 
  61 
  62 namespace OT {
  63 
  64 
  65 /*
  66  * loca -- Index to Location
  67  */
  68 
  69 #define HB_OT_TAG_loca HB_TAG('l','o','c','a')
  70 
  71 
  72 struct loca
  73 {
  74   static const hb_tag_t tableTag = HB_OT_TAG_loca;
  75 
  76   inline bool sanitize (hb_sanitize_context_t *c) const
  77   {
  78     TRACE_SANITIZE (this);
  79     return_trace (true);
  80   }
  81 
  82   public:
  83   union {
  84     USHORT      shortsZ[VAR];           /* Location offset divided by 2. */
  85     ULONG       longsZ[VAR];            /* Location offset. */
  86   } u;
  87   DEFINE_SIZE_ARRAY (0, u.longsZ);
  88 };
  89 
  90 
  91 /*
  92  * glyf -- TrueType Glyph Data
  93  */
  94 
  95 #define HB_OT_TAG_glyf HB_TAG('g','l','y','f')
  96 
  97 
  98 struct glyf
  99 {
 100   static const hb_tag_t tableTag = HB_OT_TAG_glyf;
 101 
 102   inline bool sanitize (hb_sanitize_context_t *c) const
 103   {
 104     TRACE_SANITIZE (this);
 105     /* We don't check for anything specific here.  The users of the
 106      * struct do all the hard work... */
 107     return_trace (true);
 108   }
 109 
 110   public:
 111   BYTE          dataX[VAR];             /* Glyphs data. */
 112 
 113   DEFINE_SIZE_ARRAY (0, dataX);
 114 };
 115 
 116 struct glyfGlyphHeader
 117 {
 118   SHORT         numberOfContours;       /* If the number of contours is
 119                                          * greater than or equal to zero,
 120                                          * this is a simple glyph; if negative,
 121                                          * this is a composite glyph. */
 122   SHORT         xMin;                   /* Minimum x for coordinate data. */
 123   SHORT         yMin;                   /* Minimum y for coordinate data. */
 124   SHORT         xMax;                   /* Maximum x for coordinate data. */
 125   SHORT         yMax;                   /* Maximum y for coordinate data. */
 126 
 127   DEFINE_SIZE_STATIC (10);
 128 };
 129 
 130 } /* namespace OT */
 131 
 132 
 133 #endif /* HB_OT_GLYF_TABLE_HH */