godot/thirdparty/harfbuzz/src/hb-unicode.hh

/*
 * Copyright © 2009  Red Hat, Inc.
 * Copyright © 2011  Codethink Limited
 * Copyright © 2010,2011,2012  Google, Inc.
 *
 *  This is part of HarfBuzz, a text shaping library.
 *
 * Permission is hereby granted, without written agreement and without
 * license or royalty fees, to use, copy, modify, and distribute this
 * software and its documentation for any purpose, provided that the
 * above copyright notice and the following two paragraphs appear in
 * all copies of this software.
 *
 * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
 * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
 * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
 * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
 * DAMAGE.
 *
 * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
 * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
 * FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
 * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
 * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
 *
 * Red Hat Author(s): Behdad Esfahbod
 * Codethink Author(s): Ryan Lortie
 * Google Author(s): Behdad Esfahbod
 */

#ifndef HB_UNICODE_HH
#define HB_UNICODE_HH

#include "hb.hh"


// Hack. See: https://github.com/harfbuzz/harfbuzz/pull/4529#discussion_r1769638033
#define _HB_UNICODE_GENERAL_CATEGORY_VARIATION_SELECTOR

extern HB_INTERNAL const uint8_t _hb_modified_combining_class[256];

/*
 * hb_unicode_funcs_t
 */

#define HB_UNICODE_FUNCS_IMPLEMENT_CALLBACKS

/* Simple callbacks are those taking a hb_codepoint_t and returning a hb_codepoint_t */
#define HB_UNICODE_FUNCS_IMPLEMENT_CALLBACKS_SIMPLE

struct hb_unicode_funcs_t
{};
DECLARE_NULL_INSTANCE();


/*
 * Modified combining marks
 */

/* Hebrew
 *
 * We permute the "fixed-position" classes 10-26 into the order
 * described in the SBL Hebrew manual:
 *
 * https://www.sbl-site.org/Fonts/SBLHebrewUserManual1.5x.pdf
 *
 * (as recommended by:
 *  https://forum.fontlab.com/archive-old-microsoft-volt-group/vista-and-diacritic-ordering/msg22823/)
 *
 * More details here:
 * https://bugzilla.mozilla.org/show_bug.cgi?id=662055
 */
#define HB_MODIFIED_COMBINING_CLASS_CCC10
#define HB_MODIFIED_COMBINING_CLASS_CCC11
#define HB_MODIFIED_COMBINING_CLASS_CCC12
#define HB_MODIFIED_COMBINING_CLASS_CCC13
#define HB_MODIFIED_COMBINING_CLASS_CCC14
#define HB_MODIFIED_COMBINING_CLASS_CCC15
#define HB_MODIFIED_COMBINING_CLASS_CCC16
#define HB_MODIFIED_COMBINING_CLASS_CCC17
#define HB_MODIFIED_COMBINING_CLASS_CCC18
#define HB_MODIFIED_COMBINING_CLASS_CCC19
#define HB_MODIFIED_COMBINING_CLASS_CCC20
#define HB_MODIFIED_COMBINING_CLASS_CCC21
#define HB_MODIFIED_COMBINING_CLASS_CCC22
#define HB_MODIFIED_COMBINING_CLASS_CCC23
#define HB_MODIFIED_COMBINING_CLASS_CCC24
#define HB_MODIFIED_COMBINING_CLASS_CCC25
#define HB_MODIFIED_COMBINING_CLASS_CCC26

/*
 * Arabic
 *
 * Modify to move Shadda (ccc=33) before other marks.  See:
 * https://unicode.org/faq/normalization.html#8
 * https://unicode.org/faq/normalization.html#9
 */
#define HB_MODIFIED_COMBINING_CLASS_CCC27
#define HB_MODIFIED_COMBINING_CLASS_CCC28
#define HB_MODIFIED_COMBINING_CLASS_CCC29
#define HB_MODIFIED_COMBINING_CLASS_CCC30
#define HB_MODIFIED_COMBINING_CLASS_CCC31
#define HB_MODIFIED_COMBINING_CLASS_CCC32
#define HB_MODIFIED_COMBINING_CLASS_CCC33
#define HB_MODIFIED_COMBINING_CLASS_CCC34
#define HB_MODIFIED_COMBINING_CLASS_CCC35

/* Syriac */
#define HB_MODIFIED_COMBINING_CLASS_CCC36

/* Telugu
 *
 * Modify Telugu length marks (ccc=84, ccc=91).
 * These are the only matras in the main Indic scripts range that have
 * a non-zero ccc.  That makes them reorder with the Halant (ccc=9).
 * Assign 4 and 5, which are otherwise unassigned.
 */
#define HB_MODIFIED_COMBINING_CLASS_CCC84
#define HB_MODIFIED_COMBINING_CLASS_CCC91

/* Thai
 *
 * Modify U+0E38 and U+0E39 (ccc=103) to be reordered before U+0E3A (ccc=9).
 * Assign 3, which is unassigned otherwise.
 * Uniscribe does this reordering too.
 */
#define HB_MODIFIED_COMBINING_CLASS_CCC103
#define HB_MODIFIED_COMBINING_CLASS_CCC107

/* Lao */
#define HB_MODIFIED_COMBINING_CLASS_CCC118
#define HB_MODIFIED_COMBINING_CLASS_CCC122

/* Tibetan
 *
 * In case of multiple vowel-signs, use u first (but after achung)
 * this allows Dzongkha multi-vowel shortcuts to render correctly
 */
#define HB_MODIFIED_COMBINING_CLASS_CCC129
#define HB_MODIFIED_COMBINING_CLASS_CCC130
#define HB_MODIFIED_COMBINING_CLASS_CCC132

/* Misc */

#define HB_UNICODE_GENERAL_CATEGORY_IS_MARK(gen_cat)

#define HB_UNICODE_GENERAL_CATEGORY_IS_LETTER(gen_cat)

/*
 * Ranges, used for bsearch tables.
 */

struct hb_unicode_range_t
{};

/*
 * Emoji.
 */

HB_INTERNAL bool
_hb_unicode_is_emoji_Extended_Pictographic (hb_codepoint_t cp);


extern "C" HB_INTERNAL hb_unicode_funcs_t *hb_ucd_get_unicode_funcs ();


#endif /* HB_UNICODE_HH */