Blame glib/gunibreak.c

Packit ae235b
/* gunibreak.c - line break properties
Packit ae235b
 *
Packit ae235b
 *  Copyright 2000 Red Hat, Inc.
Packit ae235b
 *
Packit ae235b
 * This library is free software; you can redistribute it and/or
Packit ae235b
 * modify it under the terms of the GNU Lesser General Public
Packit ae235b
 * License as published by the Free Software Foundation; either
Packit ae235b
 * version 2.1 of the License, or (at your option) any later version.
Packit ae235b
 *
Packit ae235b
 * This library is distributed in the hope that it will be useful,
Packit ae235b
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit ae235b
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit ae235b
 * Lesser General Public License for more details.
Packit ae235b
 *
Packit ae235b
 * You should have received a copy of the GNU Lesser General Public License
Packit ae235b
 * along with this library; if not, see <http://www.gnu.org/licenses/>.
Packit ae235b
 */
Packit ae235b
Packit ae235b
#include "config.h"
Packit ae235b
Packit ae235b
#include <stdlib.h>
Packit ae235b
Packit ae235b
#include "gunibreak.h"
Packit ae235b
Packit ae235b
#define TPROP_PART1(Page, Char) \
Packit ae235b
  ((break_property_table_part1[Page] >= G_UNICODE_MAX_TABLE_INDEX) \
Packit ae235b
   ? (break_property_table_part1[Page] - G_UNICODE_MAX_TABLE_INDEX) \
Packit ae235b
   : (break_property_data[break_property_table_part1[Page]][Char]))
Packit ae235b
Packit ae235b
#define TPROP_PART2(Page, Char) \
Packit ae235b
  ((break_property_table_part2[Page] >= G_UNICODE_MAX_TABLE_INDEX) \
Packit ae235b
   ? (break_property_table_part2[Page] - G_UNICODE_MAX_TABLE_INDEX) \
Packit ae235b
   : (break_property_data[break_property_table_part2[Page]][Char]))
Packit ae235b
Packit ae235b
#define PROP(Char) \
Packit ae235b
  (((Char) <= G_UNICODE_LAST_CHAR_PART1) \
Packit ae235b
   ? TPROP_PART1 ((Char) >> 8, (Char) & 0xff) \
Packit ae235b
   : (((Char) >= 0xe0000 && (Char) <= G_UNICODE_LAST_CHAR) \
Packit ae235b
      ? TPROP_PART2 (((Char) - 0xe0000) >> 8, (Char) & 0xff) \
Packit ae235b
      : G_UNICODE_BREAK_UNKNOWN))
Packit ae235b
Packit ae235b
/**
Packit ae235b
 * g_unichar_break_type:
Packit ae235b
 * @c: a Unicode character
Packit ae235b
 * 
Packit ae235b
 * Determines the break type of @c. @c should be a Unicode character
Packit ae235b
 * (to derive a character from UTF-8 encoded text, use
Packit ae235b
 * g_utf8_get_char()). The break type is used to find word and line
Packit ae235b
 * breaks ("text boundaries"), Pango implements the Unicode boundary
Packit ae235b
 * resolution algorithms and normally you would use a function such
Packit ae235b
 * as pango_break() instead of caring about break types yourself.
Packit ae235b
 * 
Packit ae235b
 * Returns: the break type of @c
Packit ae235b
 **/
Packit ae235b
GUnicodeBreakType
Packit ae235b
g_unichar_break_type (gunichar c)
Packit ae235b
{
Packit ae235b
  return PROP (c);
Packit ae235b
}