gfx/harfbuzz/src/hb-tt-font.cc

Fri, 16 Jan 2015 18:13:44 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Fri, 16 Jan 2015 18:13:44 +0100
branch
TOR_BUG_9701
changeset 14
925c144e1f1f
permissions
-rw-r--r--

Integrate suggestion from review to improve consistency with existing code.

     1 /*
     2  * Copyright © 2011  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  */
    27 #include "hb-font-private.hh" /* Shall be first since may include windows.h */
    29 #include "hb-open-type-private.hh"
    31 #include "hb-ot-hhea-table.hh"
    32 #include "hb-ot-hmtx-table.hh"
    34 #include <string.h>
    38 #if 0
    39 struct hb_tt_font_t
    40 {
    41   const struct hhea *hhea;
    42   hb_blob_t *hhea_blob;
    43 };
    46 static hb_tt_font_t *
    47 _hb_tt_font_create (hb_font_t *font)
    48 {
    49   /* TODO Remove this object altogether */
    50   hb_tt_font_t *tt = (hb_tt_font_t *) calloc (1, sizeof (hb_tt_font_t));
    52   tt->hhea_blob = Sanitizer<hhea>::sanitize (font->face->reference_table (HB_OT_TAG_hhea));
    53   tt->hhea = Sanitizer<hhea>::lock_instance (tt->hhea_blob);
    55   return tt;
    56 }
    58 static void
    59 _hb_tt_font_destroy (hb_tt_font_t *tt)
    60 {
    61   hb_blob_destroy (tt->hhea_blob);
    63   free (tt);
    64 }
    66 static inline const hhea&
    67 _get_hhea (hb_face_t *face)
    68 {
    69   return likely (face->tt && face->tt->hhea) ? *face->tt->hhea : Null(hhea);
    70 }
    73 /*
    74  * hb_tt_font_funcs_t
    75  */
    77 #endif

mercurial