src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-name.cc
author phh
Sat, 30 Nov 2019 14:33:05 -0800
changeset 59330 5b96c12f909d
parent 54232 7c11a7cc7c1d
permissions -rw-r--r--
8234541: C1 emits an empty message when it inlines successfully Summary: Use "inline" as the message when successfull Reviewed-by: thartmann, mdoerr Contributed-by: navy.xliu@gmail.com
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
54232
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
     1
/*
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
     2
 * Copyright © 2018  Google, Inc.
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
     3
 *
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
     4
 *  This is part of HarfBuzz, a text shaping library.
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
     5
 *
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
     6
 * Permission is hereby granted, without written agreement and without
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
     7
 * license or royalty fees, to use, copy, modify, and distribute this
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
     8
 * software and its documentation for any purpose, provided that the
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
     9
 * above copyright notice and the following two paragraphs appear in
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
    10
 * all copies of this software.
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
    11
 *
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
    12
 * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
    13
 * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
    14
 * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
    15
 * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
    16
 * DAMAGE.
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
    17
 *
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
    18
 * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
    19
 * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
    20
 * FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
    21
 * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
    22
 * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
    23
 *
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
    24
 * Google Author(s): Behdad Esfahbod
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
    25
 */
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
    26
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
    27
#include "hb.hh"
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
    28
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
    29
#include "hb-ot-name-table.hh"
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
    30
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
    31
#include "hb-ot-face.hh"
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
    32
#include "hb-utf.hh"
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
    33
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
    34
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
    35
/**
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
    36
 * SECTION:hb-ot-name
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
    37
 * @title: hb-ot-name
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
    38
 * @short_description: OpenType font name information
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
    39
 * @include: hb-ot.h
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
    40
 *
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
    41
 * Functions for fetching name strings from OpenType fonts.
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
    42
 **/
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
    43
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
    44
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
    45
/**
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
    46
 * hb_ot_name_list_names:
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
    47
 * @face: font face.
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
    48
 * @num_entries: (out) (allow-none): number of returned entries.
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
    49
 *
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
    50
 * Enumerates all available name IDs and language combinations. Returned
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
    51
 * array is owned by the @face and should not be modified.  It can be
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
    52
 * used as long as @face is alive.
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
    53
 *
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
    54
 * Returns: (out) (transfer none) (array length=num_entries): Array of available name entries.
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
    55
 * Since: 2.1.0
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
    56
 **/
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
    57
const hb_ot_name_entry_t *
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
    58
hb_ot_name_list_names (hb_face_t    *face,
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
    59
                       unsigned int *num_entries /* OUT */)
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
    60
{
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
    61
  const OT::name_accelerator_t &name = *face->table.name;
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
    62
  if (num_entries) *num_entries = name.names.length;
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
    63
  return (const hb_ot_name_entry_t *) name.names;
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
    64
}
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
    65
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
    66
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
    67
template <typename in_utf_t, typename out_utf_t>
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
    68
static inline unsigned int
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
    69
hb_ot_name_convert_utf (hb_bytes_t                       bytes,
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
    70
                        unsigned int                    *text_size /* IN/OUT */,
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
    71
                        typename out_utf_t::codepoint_t *text /* OUT */)
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
    72
{
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
    73
  unsigned int src_len = bytes.length / sizeof (typename in_utf_t::codepoint_t);
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
    74
  const typename in_utf_t::codepoint_t *src = (const typename in_utf_t::codepoint_t *) bytes.arrayZ;
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
    75
  const typename in_utf_t::codepoint_t *src_end = src + src_len;
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
    76
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
    77
  typename out_utf_t::codepoint_t *dst = text;
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
    78
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
    79
  hb_codepoint_t unicode;
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
    80
  const hb_codepoint_t replacement = HB_BUFFER_REPLACEMENT_CODEPOINT_DEFAULT;
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
    81
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
    82
  if (text_size && *text_size)
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
    83
  {
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
    84
    (*text_size)--; /* Same room for NUL-termination. */
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
    85
    const typename out_utf_t::codepoint_t *dst_end = text + *text_size;
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
    86
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
    87
    while (src < src_end && dst < dst_end)
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
    88
    {
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
    89
      const typename in_utf_t::codepoint_t *src_next = in_utf_t::next (src, src_end, &unicode, replacement);
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
    90
      typename out_utf_t::codepoint_t *dst_next = out_utf_t::encode (dst, dst_end, unicode);
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
    91
      if (dst_next == dst)
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
    92
        break; /* Out-of-room. */
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
    93
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
    94
      dst = dst_next;
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
    95
      src = src_next;
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
    96
    };
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
    97
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
    98
    *text_size = dst - text;
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
    99
    *dst = 0; /* NUL-terminate. */
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
   100
  }
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
   101
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
   102
  /* Accumulate length of rest. */
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
   103
  unsigned int dst_len = dst - text;
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
   104
  while (src < src_end)
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
   105
  {
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
   106
    src = in_utf_t::next (src, src_end, &unicode, replacement);
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
   107
    dst_len += out_utf_t::encode_len (unicode);
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
   108
  };
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
   109
  return dst_len;
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
   110
}
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
   111
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
   112
template <typename utf_t>
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
   113
static inline unsigned int
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
   114
hb_ot_name_get_utf (hb_face_t       *face,
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
   115
                    hb_ot_name_id_t  name_id,
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
   116
                    hb_language_t    language,
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
   117
                    unsigned int    *text_size /* IN/OUT */,
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
   118
                    typename utf_t::codepoint_t *text /* OUT */)
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
   119
{
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
   120
  const OT::name_accelerator_t &name = *face->table.name;
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
   121
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
   122
  if (!language)
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
   123
    language = hb_language_from_string ("en", 2);
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
   124
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
   125
  unsigned int width;
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
   126
  int idx = name.get_index (name_id, language, &width);
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
   127
  if (idx != -1)
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
   128
  {
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
   129
    hb_bytes_t bytes = name.get_name (idx);
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
   130
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
   131
    if (width == 2) /* UTF16-BE */
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
   132
      return hb_ot_name_convert_utf<hb_utf16_be_t, utf_t> (bytes, text_size, text);
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
   133
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
   134
    if (width == 1) /* ASCII */
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
   135
      return hb_ot_name_convert_utf<hb_ascii_t, utf_t> (bytes, text_size, text);
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
   136
  }
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
   137
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
   138
  if (text_size)
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
   139
  {
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
   140
    if (*text_size)
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
   141
      *text = 0;
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
   142
    *text_size = 0;
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
   143
  }
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
   144
  return 0;
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
   145
}
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
   146
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
   147
/**
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
   148
 * hb_ot_name_get_utf8:
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
   149
 * @face: font face.
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
   150
 * @name_id: OpenType name identifier to fetch.
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
   151
 * @language: language to fetch the name for.
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
   152
 * @text_size: (inout) (allow-none): input size of @text buffer, and output size of
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
   153
 *                                   text written to buffer.
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
   154
 * @text: (out caller-allocates) (array length=text_size): buffer to write fetched name into.
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
   155
 *
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
   156
 * Fetches a font name from the OpenType 'name' table.
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
   157
 * If @language is #HB_LANGUAGE_INVALID, English ("en") is assumed.
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
   158
 * Returns string in UTF-8 encoding.
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
   159
 *
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
   160
 * Returns: full length of the requested string, or 0 if not found.
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
   161
 * Since: 2.1.0
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
   162
 **/
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
   163
unsigned int
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
   164
hb_ot_name_get_utf8 (hb_face_t       *face,
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
   165
                     hb_ot_name_id_t  name_id,
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
   166
                     hb_language_t    language,
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
   167
                     unsigned int    *text_size /* IN/OUT */,
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
   168
                     char            *text      /* OUT */)
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
   169
{
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
   170
  return hb_ot_name_get_utf<hb_utf8_t> (face, name_id, language, text_size,
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
   171
                                        (hb_utf8_t::codepoint_t *) text);
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
   172
}
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
   173
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
   174
/**
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
   175
 * hb_ot_name_get_utf16:
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
   176
 * @face: font face.
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
   177
 * @name_id: OpenType name identifier to fetch.
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
   178
 * @language: language to fetch the name for.
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
   179
 * @text_size: (inout) (allow-none): input size of @text buffer, and output size of
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
   180
 *                                   text written to buffer.
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
   181
 * @text: (out caller-allocates) (array length=text_size): buffer to write fetched name into.
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
   182
 *
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
   183
 * Fetches a font name from the OpenType 'name' table.
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
   184
 * If @language is #HB_LANGUAGE_INVALID, English ("en") is assumed.
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
   185
 * Returns string in UTF-16 encoding.
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
   186
 *
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
   187
 * Returns: full length of the requested string, or 0 if not found.
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
   188
 * Since: 2.1.0
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
   189
 **/
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
   190
unsigned int
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
   191
hb_ot_name_get_utf16 (hb_face_t       *face,
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
   192
                      hb_ot_name_id_t  name_id,
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
   193
                      hb_language_t    language,
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
   194
                      unsigned int    *text_size /* IN/OUT */,
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
   195
                      uint16_t        *text      /* OUT */)
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
   196
{
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
   197
  return hb_ot_name_get_utf<hb_utf16_t> (face, name_id, language, text_size, text);
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
   198
}
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
   199
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
   200
/**
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
   201
 * hb_ot_name_get_utf32:
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
   202
 * @face: font face.
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
   203
 * @name_id: OpenType name identifier to fetch.
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
   204
 * @language: language to fetch the name for.
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
   205
 * @text_size: (inout) (allow-none): input size of @text buffer, and output size of
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
   206
 *                                   text written to buffer.
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
   207
 * @text: (out caller-allocates) (array length=text_size): buffer to write fetched name into.
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
   208
 *
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
   209
 * Fetches a font name from the OpenType 'name' table.
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
   210
 * If @language is #HB_LANGUAGE_INVALID, English ("en") is assumed.
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
   211
 * Returns string in UTF-32 encoding.
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
   212
 *
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
   213
 * Returns: full length of the requested string, or 0 if not found.
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
   214
 * Since: 2.1.0
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
   215
 **/
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
   216
unsigned int
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
   217
hb_ot_name_get_utf32 (hb_face_t       *face,
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
   218
                      hb_ot_name_id_t  name_id,
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
   219
                      hb_language_t    language,
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
   220
                      unsigned int    *text_size /* IN/OUT */,
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
   221
                      uint32_t        *text      /* OUT */)
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
   222
{
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
   223
  return hb_ot_name_get_utf<hb_utf32_t> (face, name_id, language, text_size, text);
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents:
diff changeset
   224
}