QtBase  v6.3.1
hb-aat-layout-bsln-table.hh
Go to the documentation of this file.
1 /*
2  * Copyright © 2018 Ebrahim Byagowi
3  *
4  * This is part of HarfBuzz, a text shaping library.
5  *
6  * Permission is hereby granted, without written agreement and without
7  * license or royalty fees, to use, copy, modify, and distribute this
8  * software and its documentation for any purpose, provided that the
9  * above copyright notice and the following two paragraphs appear in
10  * all copies of this software.
11  *
12  * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
13  * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
14  * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
15  * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
16  * DAMAGE.
17  *
18  * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
19  * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
20  * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
21  * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
22  * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
23  */
24 
25 #ifndef HB_AAT_LAYOUT_BSLN_TABLE_HH
26 #define HB_AAT_LAYOUT_BSLN_TABLE_HH
27 
28 #include "hb-aat-layout-common.hh"
29 
30 /*
31  * bsln -- Baseline
32  * https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6bsln.html
33  */
34 #define HB_AAT_TAG_bsln HB_TAG('b','s','l','n')
35 
36 
37 namespace AAT {
38 
39 
41 {
43  {
44  TRACE_SANITIZE (this);
45  return_trace (likely (c->check_struct (this)));
46  }
47 
48  protected:
49  // Roman, Ideographic centered, Ideographic low, Hanging and Math
50  // are the default defined ones, but any other maybe accessed also.
51  HBINT16 deltas[32]; /* These are the FUnit distance deltas from
52  * the font's natural baseline to the other
53  * baselines used in the font. */
54  public:
56 };
57 
59 {
61  {
62  TRACE_SANITIZE (this);
63  return_trace (likely (c->check_struct (this) &&
64  lookupTable.sanitize (c)));
65  }
66 
67  protected:
68  HBINT16 deltas[32]; /* ditto */
70  lookupTable; /* Lookup table that maps glyphs to their
71  * baseline values. */
72  public:
74 };
75 
77 {
79  {
80  TRACE_SANITIZE (this);
81  return_trace (likely (c->check_struct (this)));
82  }
83 
84  protected:
85  HBGlyphID16 stdGlyph; /* The specific glyph index number in this
86  * font that is used to set the baseline values.
87  * This is the standard glyph.
88  * This glyph must contain a set of control points
89  * (whose numbers are contained in the ctlPoints field)
90  * that are used to determine baseline distances. */
91  HBUINT16 ctlPoints[32]; /* Set of control point numbers,
92  * associated with the standard glyph.
93  * A value of 0xFFFF means there is no corresponding
94  * control point in the standard glyph. */
95  public:
97 };
98 
100 {
102  {
103  TRACE_SANITIZE (this);
104  return_trace (likely (c->check_struct (this) && lookupTable.sanitize (c)));
105  }
106 
107  protected:
108  HBGlyphID16 stdGlyph; /* ditto */
109  HBUINT16 ctlPoints[32]; /* ditto */
111  lookupTable; /* Lookup table that maps glyphs to their
112  * baseline values. */
113  public:
115 };
116 
117 struct bsln
118 {
119  static constexpr hb_tag_t tableTag = HB_AAT_TAG_bsln;
120 
122  {
123  TRACE_SANITIZE (this);
124  if (unlikely (!(c->check_struct (this) && defaultBaseline < 32)))
125  return_trace (false);
126 
127  switch (format)
128  {
129  case 0: return_trace (parts.format0.sanitize (c));
130  case 1: return_trace (parts.format1.sanitize (c));
131  case 2: return_trace (parts.format2.sanitize (c));
132  case 3: return_trace (parts.format3.sanitize (c));
133  default:return_trace (true);
134  }
135  }
136 
137  protected:
138  FixedVersion<>version; /* Version number of the Baseline table. */
139  HBUINT16 format; /* Format of the baseline table. Only one baseline
140  * format may be selected for the font. */
141  HBUINT16 defaultBaseline;/* Default baseline value for all glyphs.
142  * This value can be from 0 through 31. */
143  union {
144  // Distance-Based Formats
147  // Control Point-based Formats
150  } parts;
151  public:
153 };
154 
155 } /* namespace AAT */
156 
157 
158 #endif /* HB_AAT_LAYOUT_BSLN_TABLE_HH */
#define HB_AAT_TAG_bsln
#define TRACE_SANITIZE(this)
Definition: hb-debug.hh:414
#define return_trace(RET)
Definition: hb-debug.hh:349
#define likely(expr)
Definition: hb.hh:250
#define unlikely(expr)
Definition: hb.hh:251
GLint GLsizei GLsizei GLenum format
const GLubyte * c
Definition: qopenglext.h:12701
uint32_t hb_tag_t
Definition: hb-common.h:157
bool sanitize(hb_sanitize_context_t *c) const
bool sanitize(hb_sanitize_context_t *c) const
bool sanitize(hb_sanitize_context_t *c) const
bool sanitize(hb_sanitize_context_t *c) const
BaselineTableFormat3Part format3
BaselineTableFormat1Part format1
static constexpr hb_tag_t tableTag
bool sanitize(hb_sanitize_context_t *c) const
union AAT::bsln::@70 parts
DEFINE_SIZE_MIN(8)
BaselineTableFormat0Part format0
BaselineTableFormat2Part format2