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-static.cc
Go to the documentation of this file.
1 /*
2  * Copyright © 2018 Google, Inc.
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  * Google Author(s): Behdad Esfahbod
25  */
26 
27 #include "hb.hh"
28 
29 #include "hb-open-type.hh"
30 #include "hb-face.hh"
31 
32 #include "hb-aat-layout-common.hh"
34 #include "hb-ot-layout-common.hh"
35 #include "hb-ot-cmap-table.hh"
36 #include "hb-ot-head-table.hh"
37 #include "hb-ot-maxp-table.hh"
38 
39 #ifndef HB_NO_VISIBILITY
41 
42 uint64_t const _hb_NullPool[(HB_NULL_POOL_SIZE + sizeof (uint64_t) - 1) / sizeof (uint64_t)] = {};
43 /*thread_local*/ uint64_t _hb_CrapPool[(HB_NULL_POOL_SIZE + sizeof (uint64_t) - 1) / sizeof (uint64_t)] = {};
44 
45 DEFINE_NULL_NAMESPACE_BYTES (OT, Index) = {0xFF,0xFF};
46 DEFINE_NULL_NAMESPACE_BYTES (OT, LangSys) = {0x00,0x00, 0xFF,0xFF, 0x00,0x00};
47 DEFINE_NULL_NAMESPACE_BYTES (OT, RangeRecord) = {0x00,0x01, 0x00,0x00, 0x00, 0x00};
48 DEFINE_NULL_NAMESPACE_BYTES (OT, CmapSubtableLongGroup) = {0x00,0x00,0x00,0x01, 0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00};
49 DEFINE_NULL_NAMESPACE_BYTES (AAT, SettingName) = {0xFF,0xFF, 0xFF,0xFF};
50 /* Hand-coded because Lookup is a template. Sad. */
51 const unsigned char _hb_Null_AAT_Lookup[2] = {0xFF, 0xFF};
52 
53 
54 
55 /* hb_face_t */
56 
57 unsigned int
59 {
61  c.set_num_glyphs (0); /* So we don't recurse ad infinitum. */
62  hb_blob_t *maxp_blob = c.reference_table<OT::maxp> (this);
63  const OT::maxp *maxp_table = maxp_blob->as<OT::maxp> ();
64 
65  unsigned int ret = maxp_table->get_num_glyphs ();
67  hb_blob_destroy (maxp_blob);
68  return ret;
69 }
70 
71 unsigned int
73 {
74  unsigned int ret = table.head->get_upem ();
76  return ret;
77 }
78 
79 
80 /* hb_user_data_array_t */
81 
82 bool
84  void * data,
85  hb_destroy_func_t destroy,
87 {
88  if (!key)
89  return false;
90 
91  if (replace) {
92  if (!data && !destroy) {
93  items.remove (key, lock);
94  return true;
95  }
96  }
97  hb_user_data_item_t item = {key, data, destroy};
98  bool ret = !!items.replace_or_insert (item, lock, (bool) replace);
99 
100  return ret;
101 }
102 
103 void *
105 {
106  hb_user_data_item_t item = {nullptr, nullptr, nullptr};
107 
108  return items.find (key, &item, lock) ? item.data : nullptr;
109 }
110 
111 
112 #endif
static int item
Definition: brushtopbm.c:66
struct rect data
Definition: dvipdfm.c:64
void replace(char *, char *)
Definition: dvispc.c:2100
#define c(n)
Definition: gpos-common.c:150
unsigned __int64 uint64_t
Definition: stdint.h:90
static int ret
Definition: convert.c:72
Definition: hb-iter.hh:336
void hb_blob_destroy(hb_blob_t *blob)
Definition: hb-blob.cc:226
void(* hb_destroy_func_t)(void *user_data)
Definition: hb-common.h:690
int hb_bool_t
Definition: hb-common.h:97
#define DEFINE_NULL_NAMESPACE_BYTES(Namespace, Type)
Definition: hb-null.hh:108
#define HB_NULL_POOL_SIZE
Definition: hb-null.hh:40
const unsigned char _hb_Null_AAT_Lookup[2]
Definition: hb-static.cc:51
uint64_t const _hb_NullPool[(384+sizeof(uint64_t) - 1)/sizeof(uint64_t)]
Definition: hb-static.cc:42
uint64_t _hb_CrapPool[(384+sizeof(uint64_t) - 1)/sizeof(uint64_t)]
Definition: hb-static.cc:43
#define uint64_t
Definition: stdint.in.h:215
void set_relaxed(int v_)
Definition: hb-atomic.hh:265
const Type * as() const
Definition: hb-blob.hh:59
unsigned int load_num_glyphs() const
Definition: hb-static.cc:58
hb_atomic_int_t num_glyphs
Definition: hb-face.hh:57
hb_atomic_int_t upem
Definition: hb-face.hh:56
unsigned int load_upem() const
Definition: hb-static.cc:72
void * get(hb_user_data_key_t *key)
Definition: hb-static.cc:104
hb_lockable_set_t< hb_user_data_item_t, hb_mutex_t > items
Definition: hb-object.hh:178
bool set(hb_user_data_key_t *key, void *data, hb_destroy_func_t destroy, hb_bool_t replace)
Definition: hb-static.cc:83
Definition: table.h:30
#define key
Definition: tex2xindy.c:753
static TTF_MAXP * maxp_table
Definition: ttf.c:80