w32tex
About: TeX Live provides a comprehensive TeX system including all the major TeX-related programs, macro packages, and fonts that are free software. Windows sources.
  Fossies Dox: w32tex-src.tar.xz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

hb-face.hh
Go to the documentation of this file.
1 /*
2  * Copyright © 2009 Red Hat, Inc.
3  * Copyright © 2011 Google, Inc.
4  *
5  * This is part of HarfBuzz, a text shaping library.
6  *
7  * Permission is hereby granted, without written agreement and without
8  * license or royalty fees, to use, copy, modify, and distribute this
9  * software and its documentation for any purpose, provided that the
10  * above copyright notice and the following two paragraphs appear in
11  * all copies of this software.
12  *
13  * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
14  * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
15  * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
16  * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
17  * DAMAGE.
18  *
19  * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
20  * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
21  * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
22  * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
23  * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
24  *
25  * Red Hat Author(s): Behdad Esfahbod
26  * Google Author(s): Behdad Esfahbod
27  */
28 
29 #ifndef HB_FACE_HH
30 #define HB_FACE_HH
31 
32 #include "hb.hh"
33 
34 #include "hb-shaper.hh"
35 #include "hb-shape-plan.hh"
36 #include "hb-ot-face.hh"
37 
38 
39 /*
40  * hb_face_t
41  */
42 
43 #define HB_SHAPER_IMPLEMENT(shaper) HB_SHAPER_DATA_INSTANTIATE_SHAPERS(shaper, face);
44 #include "hb-shaper-list.hh"
45 #undef HB_SHAPER_IMPLEMENT
46 
47 struct hb_face_t
48 {
50 
52  void *user_data;
54 
55  unsigned int index; /* Face index in a collection, zero-based. */
56  mutable hb_atomic_int_t upem; /* Units-per-EM. */
57  mutable hb_atomic_int_t num_glyphs; /* Number of glyphs. */
58 
59  hb_shaper_object_dataset_t<hb_face_t> data;/* Various shaper data. */
60  hb_ot_face_t table; /* All the face's tables. */
61 
62  /* Cache */
63  struct plan_node_t
64  {
67  };
69 
71  {
72  hb_blob_t *blob;
73 
75  return hb_blob_get_empty ();
76 
77  blob = reference_table_func (/*XXX*/const_cast<hb_face_t *> (this), tag, user_data);
78  if (unlikely (!blob))
79  return hb_blob_get_empty ();
80 
81  return blob;
82  }
83 
84  HB_PURE_FUNC unsigned int get_upem () const
85  {
86  unsigned int ret = upem.get_relaxed ();
87  if (unlikely (!ret))
88  {
89  return load_upem ();
90  }
91  return ret;
92  }
93 
94  unsigned int get_num_glyphs () const
95  {
96  unsigned int ret = num_glyphs.get_relaxed ();
97  if (unlikely (ret == UINT_MAX))
98  return load_num_glyphs ();
99  return ret;
100  }
101 
102  private:
103  HB_INTERNAL unsigned int load_upem () const;
104  HB_INTERNAL unsigned int load_num_glyphs () const;
105 };
107 
108 
109 #endif /* HB_FACE_HH */
#define unlikely(x)
Definition: jbig2arith.cc:116
#define UINT_MAX
Definition: c-minmax.h:56
static int ret
Definition: convert.c:72
hb_blob_t * hb_blob_get_empty()
Definition: hb-blob.cc:190
void(* hb_destroy_func_t)(void *user_data)
Definition: hb-common.h:690
uint32_t hb_tag_t
Definition: hb-common.h:147
hb_blob_t *(* hb_reference_table_func_t)(hb_face_t *face, hb_tag_t tag, void *user_data)
Definition: hb-face.h:61
#define DECLARE_NULL_INSTANCE(Type)
Definition: hb-null.hh:112
#define HB_PURE_FUNC
Definition: hb.hh:251
#define HB_INTERNAL
Definition: hb.hh:265
int get_relaxed() const
Definition: hb-atomic.hh:267
hb_shape_plan_t * shape_plan
Definition: hb-face.hh:65
plan_node_t * next
Definition: hb-face.hh:66
hb_shaper_object_dataset_t< hb_face_t > data
Definition: hb-face.hh:59
hb_ot_face_t table
Definition: hb-face.hh:60
hb_atomic_ptr_t< plan_node_t > shape_plans
Definition: hb-face.hh:68
hb_reference_table_func_t reference_table_func
Definition: hb-face.hh:51
unsigned int get_upem() const
Definition: hb-face.hh:84
hb_destroy_func_t destroy
Definition: hb-face.hh:53
unsigned int index
Definition: hb-face.hh:55
hb_blob_t * reference_table(hb_tag_t tag) const
Definition: hb-face.hh:70
void * user_data
Definition: hb-face.hh:52
unsigned int load_num_glyphs() const
Definition: hb-static.cc:58
hb_atomic_int_t num_glyphs
Definition: hb-face.hh:57
hb_object_header_t header
Definition: hb-face.hh:49
hb_atomic_int_t upem
Definition: hb-face.hh:56
unsigned int load_upem() const
Definition: hb-static.cc:72
unsigned int get_num_glyphs() const
Definition: hb-face.hh:94
Definition: xmlparse.c:179