From d5d8909e11e0c613f7a1dfba3a20a405ae7b4da4 Mon Sep 17 00:00:00 2001 From: wl Date: Mon, 13 Dec 2010 15:30:19 +0000 Subject: Implement support for character classes. This patch uses standard C++ headers, contrary to the rest of groff. Ideally, everything in groff should be updated to do the same. * src/include/font.h (glyph_to_unicode): New function. * src/libs/libgroff/font.cpp (glyph_to_unicode): Implement it. (font::contains, font::get_code): Use it. * src/roff/troff/charinfo.h: Include and . (charinfo): New members `ranges' and `nested_classes'. New member functions `get_unicode_code' and `get_flags'. New member functions `add_to_class', `is_class', and `contains'. (charinfo::overlaps_horizontally, charinfo::overlaps_vertically, charinfo::can_break_before, charinfo::can_break_after, charinfo::can_break_after, charinfo::ends_sentence, charinfo::transparent,, charinfo:ignore_hcodes): Use `get_flags', which handles character classes also. * src/roff/troff/input.cpp (char_class_dictionary): New global variable. (define_class): New function. (init_input_requests): Register `class'. (charinfo::get_unicode_code, charinfo::get_flags, charinfo::contains): Implement it. * NEWS, doc/groff.texinfo (Character Classes), man/groff_diff.man, man/groff.man: Document it. --- src/include/font.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/include') diff --git a/src/include/font.h b/src/include/font.h index 944250b9..75d2ef16 100644 --- a/src/include/font.h +++ b/src/include/font.h @@ -1,5 +1,5 @@ // -*- C++ -*- -/* Copyright (C) 1989, 1990, 1991, 1992, 2002, 2004, 2006, 2009 +/* Copyright (C) 1989, 1990, 1991, 1992, 2002, 2004, 2006, 2009, 2010 Free Software Foundation, Inc. Written by James Clark (jjc@jclark.com) @@ -73,6 +73,9 @@ inline int glyph_to_number(glyph *); // Convert the given glyph back to // a numbered character. inline int glyph_to_index(glyph *); // Return the unique index that is // associated with the given glyph. It is >= 0. +extern int glyph_to_unicode(glyph *); // Convert the given glyph to its + // Unicode codepoint. Return -1 if it does not + // designate a Unicode character. inline int glyph_to_number(glyph *g) { -- cgit v1.2.1