gfx/harfbuzz/src/hb-blob.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/gfx/harfbuzz/src/hb-blob.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,127 @@
     1.4 +/*
     1.5 + * Copyright © 2009  Red Hat, Inc.
     1.6 + *
     1.7 + *  This is part of HarfBuzz, a text shaping library.
     1.8 + *
     1.9 + * Permission is hereby granted, without written agreement and without
    1.10 + * license or royalty fees, to use, copy, modify, and distribute this
    1.11 + * software and its documentation for any purpose, provided that the
    1.12 + * above copyright notice and the following two paragraphs appear in
    1.13 + * all copies of this software.
    1.14 + *
    1.15 + * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
    1.16 + * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
    1.17 + * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
    1.18 + * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
    1.19 + * DAMAGE.
    1.20 + *
    1.21 + * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
    1.22 + * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
    1.23 + * FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
    1.24 + * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
    1.25 + * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
    1.26 + *
    1.27 + * Red Hat Author(s): Behdad Esfahbod
    1.28 + */
    1.29 +
    1.30 +#ifndef HB_H_IN
    1.31 +#error "Include <hb.h> instead."
    1.32 +#endif
    1.33 +
    1.34 +#ifndef HB_BLOB_H
    1.35 +#define HB_BLOB_H
    1.36 +
    1.37 +#include "hb-common.h"
    1.38 +
    1.39 +HB_BEGIN_DECLS
    1.40 +
    1.41 +
    1.42 +/*
    1.43 + * Note re various memory-modes:
    1.44 + *
    1.45 + * - In no case shall the HarfBuzz client modify memory
    1.46 + *   that is passed to HarfBuzz in a blob.  If there is
    1.47 + *   any such possibility, MODE_DUPLICATE should be used
    1.48 + *   such that HarfBuzz makes a copy immediately,
    1.49 + *
    1.50 + * - Use MODE_READONLY otherse, unless you really really
    1.51 + *   really know what you are doing,
    1.52 + *
    1.53 + * - MODE_WRITABLE is appropriate if you relaly made a
    1.54 + *   copy of data solely for the purpose of passing to
    1.55 + *   HarfBuzz and doing that just once (no reuse!),
    1.56 + *
    1.57 + * - If the font is mmap()ed, it's ok to use
    1.58 + *   READONLY_MAY_MAKE_WRITABLE, however, there were
    1.59 + *   design problems with that mode, so HarfBuzz do not
    1.60 + *   really use it anymore.  If not sure, use MODE_READONLY.
    1.61 + */
    1.62 +typedef enum {
    1.63 +  HB_MEMORY_MODE_DUPLICATE,
    1.64 +  HB_MEMORY_MODE_READONLY,
    1.65 +  HB_MEMORY_MODE_WRITABLE,
    1.66 +  HB_MEMORY_MODE_READONLY_MAY_MAKE_WRITABLE
    1.67 +} hb_memory_mode_t;
    1.68 +
    1.69 +typedef struct hb_blob_t hb_blob_t;
    1.70 +
    1.71 +hb_blob_t *
    1.72 +hb_blob_create (const char        *data,
    1.73 +		unsigned int       length,
    1.74 +		hb_memory_mode_t   mode,
    1.75 +		void              *user_data,
    1.76 +		hb_destroy_func_t  destroy);
    1.77 +
    1.78 +/* Always creates with MEMORY_MODE_READONLY.
    1.79 + * Even if the parent blob is writable, we don't
    1.80 + * want the user of the sub-blob to be able to
    1.81 + * modify the parent data as that data may be
    1.82 + * shared among multiple sub-blobs.
    1.83 + */
    1.84 +hb_blob_t *
    1.85 +hb_blob_create_sub_blob (hb_blob_t    *parent,
    1.86 +			 unsigned int  offset,
    1.87 +			 unsigned int  length);
    1.88 +
    1.89 +hb_blob_t *
    1.90 +hb_blob_get_empty (void);
    1.91 +
    1.92 +hb_blob_t *
    1.93 +hb_blob_reference (hb_blob_t *blob);
    1.94 +
    1.95 +void
    1.96 +hb_blob_destroy (hb_blob_t *blob);
    1.97 +
    1.98 +hb_bool_t
    1.99 +hb_blob_set_user_data (hb_blob_t          *blob,
   1.100 +		       hb_user_data_key_t *key,
   1.101 +		       void *              data,
   1.102 +		       hb_destroy_func_t   destroy,
   1.103 +		       hb_bool_t           replace);
   1.104 +
   1.105 +
   1.106 +void *
   1.107 +hb_blob_get_user_data (hb_blob_t          *blob,
   1.108 +		       hb_user_data_key_t *key);
   1.109 +
   1.110 +
   1.111 +void
   1.112 +hb_blob_make_immutable (hb_blob_t *blob);
   1.113 +
   1.114 +hb_bool_t
   1.115 +hb_blob_is_immutable (hb_blob_t *blob);
   1.116 +
   1.117 +
   1.118 +unsigned int
   1.119 +hb_blob_get_length (hb_blob_t *blob);
   1.120 +
   1.121 +const char *
   1.122 +hb_blob_get_data (hb_blob_t *blob, unsigned int *length);
   1.123 +
   1.124 +char *
   1.125 +hb_blob_get_data_writable (hb_blob_t *blob, unsigned int *length);
   1.126 +
   1.127 +
   1.128 +HB_END_DECLS
   1.129 +
   1.130 +#endif /* HB_BLOB_H */

mercurial