static void
mucharmap_block_chapters_model_class_init (MucharmapBlockChaptersModelClass* clazz)
{
	MucharmapChaptersModelClass* chapters_class = MUCHARMAP_CHAPTERS_MODEL_CLASS(clazz);

	_mucharmap_intl_ensure_initialized();

	chapters_class->title = _("Unicode Block");
	chapters_class->character_to_iter = character_to_iter;
	chapters_class->get_codepoint_list = get_codepoint_list;
	chapters_class->get_book_codepoint_list = get_book_codepoint_list;
}
const gchar* mucharmap_get_unicode_category_name(gunichar wc)
{
	_mucharmap_intl_ensure_initialized();

	switch (mucharmap_unichar_type(wc))
    {
		case G_UNICODE_CONTROL: return _("Other, Control");
		case G_UNICODE_FORMAT: return _("Other, Format");
		case G_UNICODE_UNASSIGNED: return _("Other, Not Assigned");
		case G_UNICODE_PRIVATE_USE: return _("Other, Private Use");
		case G_UNICODE_SURROGATE: return _("Other, Surrogate");
		case G_UNICODE_LOWERCASE_LETTER: return _("Letter, Lowercase");
		case G_UNICODE_MODIFIER_LETTER: return _("Letter, Modifier");
		case G_UNICODE_OTHER_LETTER: return _("Letter, Other");
		case G_UNICODE_TITLECASE_LETTER: return _("Letter, Titlecase");
		case G_UNICODE_UPPERCASE_LETTER: return _("Letter, Uppercase");
		case G_UNICODE_COMBINING_MARK: return _("Mark, Spacing Combining");
		case G_UNICODE_ENCLOSING_MARK: return _("Mark, Enclosing");
		case G_UNICODE_NON_SPACING_MARK: return _("Mark, Non-Spacing");
		case G_UNICODE_DECIMAL_NUMBER: return _("Number, Decimal Digit");
		case G_UNICODE_LETTER_NUMBER: return _("Number, Letter");
		case G_UNICODE_OTHER_NUMBER: return _("Number, Other");
		case G_UNICODE_CONNECT_PUNCTUATION: return _("Punctuation, Connector");
		case G_UNICODE_DASH_PUNCTUATION: return _("Punctuation, Dash");
		case G_UNICODE_CLOSE_PUNCTUATION: return _("Punctuation, Close");
		case G_UNICODE_FINAL_PUNCTUATION: return _("Punctuation, Final Quote");
		case G_UNICODE_INITIAL_PUNCTUATION: return _("Punctuation, Initial Quote");
		case G_UNICODE_OTHER_PUNCTUATION: return _("Punctuation, Other");
		case G_UNICODE_OPEN_PUNCTUATION: return _("Punctuation, Open");
		case G_UNICODE_CURRENCY_SYMBOL: return _("Symbol, Currency");
		case G_UNICODE_MODIFIER_SYMBOL: return _("Symbol, Modifier");
		case G_UNICODE_MATH_SYMBOL: return _("Symbol, Math");
		case G_UNICODE_OTHER_SYMBOL: return _("Symbol, Other");
		case G_UNICODE_LINE_SEPARATOR: return _("Separator, Line");
		case G_UNICODE_PARAGRAPH_SEPARATOR: return _("Separator, Paragraph");
		case G_UNICODE_SPACE_SEPARATOR: return _("Separator, Space");
		default: return "";
    }
}
const gchar* mucharmap_get_unicode_name(gunichar wc)
{
	static gchar buf[32];

	_mucharmap_intl_ensure_initialized();

	if ((wc >= 0x3400 && wc <= 0x4DB5) || (wc >= 0x4e00 && wc <= 0x9fcb) || (wc >= 0x20000 && wc <= 0x2A6D6) || (wc >= 0x2a700 && wc <= 0x2b734))
	{
		g_snprintf(buf, sizeof(buf), "CJK UNIFIED IDEOGRAPH-%04X", wc);

		return buf;
	}
	/* FIXME: handle U+F900..U+FAFF CJK COMPATIBILITY IDEOGRAPH U+%04X and
	* U+2F800..U+2FA1D CJK COMPATIBILITY IDEOGRAPH U+%04X here,
	* instead of via mucharmap_get_unicode_data_name below, to save some space?
	*/
	else if (wc >= 0xac00 && wc <= 0xd7af)
	{
		/* compute hangul syllable name as per UAX #15 */
		gint SIndex = wc - SBase;
		gint LIndex, VIndex, TIndex;

		if (SIndex < 0 || SIndex >= SCount)
		{
			return "";
		}

		LIndex = SIndex / NCount;
		VIndex = (SIndex % NCount) / TCount;
		TIndex = SIndex % TCount;

		g_snprintf(buf, sizeof(buf), "HANGUL SYLLABLE %s%s%s", JAMO_L_TABLE[LIndex], JAMO_V_TABLE[VIndex], JAMO_T_TABLE[TIndex]);

		return buf;
	}
	else if (wc >= 0xD800 && wc <= 0xDB7F)
	{
		return _("<Non Private Use High Surrogate>");
	}
	else if (wc >= 0xDB80 && wc <= 0xDBFF)
	{
		return _("<Private Use High Surrogate>");
	}
	else if (wc >= 0xDC00 && wc <= 0xDFFF)
	{
		return _("<Low Surrogate>");
	}
	else if (wc >= 0xE000 && wc <= 0xF8FF)
	{
		return _("<Private Use>");
	}
	else if (wc >= 0xF0000 && wc <= 0xFFFFD)
	{
		return _("<Plane 15 Private Use>");
	}
	else if (wc >= 0x100000 && wc <= 0x10FFFD)
	{
		return _("<Plane 16 Private Use>");
	}
	else
	{
		const gchar* x = mucharmap_get_unicode_data_name(wc);

		if (x == NULL)
		{
			return _("<not assigned>");
		}
		else
		{
			return x;
		}
	}
}
static void
mucharmap_charmap_class_init (MucharmapCharmapClass *klass)
{
  GObjectClass *object_class = G_OBJECT_CLASS (klass);

  _mucharmap_intl_ensure_initialized ();

  object_class->get_property = mucharmap_charmap_get_property;
  object_class->set_property = mucharmap_charmap_set_property;
  object_class->finalize = mucharmap_charmap_finalize;

  mucharmap_charmap_signals[STATUS_MESSAGE] =
	  g_signal_new (I_("status-message"), mucharmap_charmap_get_type (),
	                G_SIGNAL_RUN_FIRST,
	                G_STRUCT_OFFSET (MucharmapCharmapClass, status_message),
	                NULL, NULL, g_cclosure_marshal_VOID__STRING, G_TYPE_NONE,
	                1, G_TYPE_STRING);

  mucharmap_charmap_signals[LINK_CLICKED] =
	  g_signal_new (I_("link-clicked"), mucharmap_charmap_get_type (),
	                G_SIGNAL_RUN_FIRST,
	                G_STRUCT_OFFSET (MucharmapCharmapClass, link_clicked),
	                NULL, NULL, _mucharmap_marshal_VOID__UINT_UINT, G_TYPE_NONE,
	                2, G_TYPE_UINT, G_TYPE_UINT);

  g_object_class_install_property
	(object_class,
	 PROP_CHAPTERS_MODEL,
	 g_param_spec_object ("chapters-model", NULL, NULL,
	                     MUCHARMAP_TYPE_CHAPTERS_MODEL,
	                     G_PARAM_WRITABLE |
	                     G_PARAM_CONSTRUCT |
	                     G_PARAM_STATIC_NAME |
	                     G_PARAM_STATIC_NICK |
	                     G_PARAM_STATIC_BLURB));

  g_object_class_install_property
	(object_class,
	 PROP_ACTIVE_CHAPTER,
	 g_param_spec_string ("active-chapter", NULL, NULL,
	                      NULL,
	                      G_PARAM_READWRITE |
	                      G_PARAM_STATIC_NAME |
	                      G_PARAM_STATIC_NICK |
	                      G_PARAM_STATIC_BLURB));

  g_object_class_install_property
	(object_class,
	 PROP_ACTIVE_CHARACTER,
	 g_param_spec_uint ("active-character", NULL, NULL,
	                    0,
	                    UNICHAR_MAX,
	                    0,
	                    G_PARAM_READWRITE |
	                    G_PARAM_STATIC_NAME |
	                    G_PARAM_STATIC_NICK |
	                    G_PARAM_STATIC_BLURB));

  g_object_class_install_property
	(object_class,
	 PROP_ACTIVE_CODEPOINT_LIST,
	 g_param_spec_object ("active-codepoint-list", NULL, NULL,
	                      MUCHARMAP_TYPE_CODEPOINT_LIST,
	                      G_PARAM_READABLE |
	                      G_PARAM_STATIC_NAME |
	                      G_PARAM_STATIC_NICK |
	                      G_PARAM_STATIC_BLURB));

  g_object_class_install_property
	(object_class,
	 PROP_ACTIVE_PAGE,
	 g_param_spec_uint ("active-page", NULL, NULL,
	                    0,
	                    G_MAXUINT,
	                    0,
	                    G_PARAM_READWRITE |
	                    G_PARAM_STATIC_NAME |
	                    G_PARAM_STATIC_NICK |
	                    G_PARAM_STATIC_BLURB));

  g_object_class_install_property
	(object_class,
	 PROP_FONT_DESC,
	 g_param_spec_boxed ("font-desc", NULL, NULL,
	                     PANGO_TYPE_FONT_DESCRIPTION,
	                     G_PARAM_READWRITE |
	                     G_PARAM_STATIC_NAME |
	                     G_PARAM_STATIC_NICK |
	                     G_PARAM_STATIC_BLURB));

  /**
   * MucharmapCharmap:font-fallback:
   *
   * Whether font fallback is enabled.
   *
   */
  g_object_class_install_property
    (object_class,
     PROP_FONT_FALLBACK,
     g_param_spec_boolean ("font-fallback", NULL, NULL,
                           TRUE,
                           G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));

  g_object_class_install_property
	(object_class,
	 PROP_SNAP_POW2,
	 g_param_spec_boolean ("snap-power-2", NULL, NULL,
	                       FALSE,
	                       G_PARAM_READWRITE |
	                       G_PARAM_STATIC_NAME |
	                       G_PARAM_STATIC_NICK |
	                       G_PARAM_STATIC_BLURB));

  g_type_class_add_private (object_class, sizeof (MucharmapCharmapPrivate));
}