summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorOwen Taylor <otaylor@redhat.com>2000-06-21 16:13:42 +0000
committerOwen Taylor <otaylor@src.gnome.org>2000-06-21 16:13:42 +0000
commit0e6409a158d9dd76a31b9eccf7c4f26c5466d082 (patch)
treedc120946f7efa23c6c91c64aee2686d2637e3970 /examples
parent197a2a68c145d3568cd4f0f2fee3d3b55570134f (diff)
downloadpango-0e6409a158d9dd76a31b9eccf7c4f26c5466d082.tar.gz
Remove tests for libunicode
Wed Jun 21 12:11:56 2000 Owen Taylor <otaylor@redhat.com> * configure.in: Remove tests for libunicode * pango/utils.[ch]: Removed. The functions from here are now in GLib. * **.[ch]: Removed use of libunicode and utils.c in favor of Unicode functions in GLib. Requires latest GLib from CVS.
Diffstat (limited to 'examples')
-rw-r--r--examples/viewer-qt.cc15
-rw-r--r--examples/viewer-qt.h3
-rw-r--r--examples/viewer.c13
3 files changed, 14 insertions, 17 deletions
diff --git a/examples/viewer-qt.cc b/examples/viewer-qt.cc
index ff078e21..b2522063 100644
--- a/examples/viewer-qt.cc
+++ b/examples/viewer-qt.cc
@@ -104,15 +104,12 @@ ViewerPara::draw (QPainter *painter, GC gc, int y)
gc, layout_, 0, devicePt.y());
}
-unicode_char_t
+gunichar
ViewerPara::getChar (int index)
{
- unicode_char_t result;
-
- if (unicode_get_utf8 (((const char *)text_) + index, &result))
- return result;
- else
- return 0;
+ gunichar result;
+
+ return g_utf8_get_char ((const char *)text_ + index);
}
QRect
@@ -319,9 +316,9 @@ ViewerView::contentsMousePressEvent (QMouseEvent *event)
if (y <= event->y() && event->y() < y_end)
{
int index = para->findPoint (event->x(), event->y() - y);
- unicode_char_t wc = para->getChar (index);
+ gunichar wc = para->getChar (index);
- if (index >= 0 && wc)
+ if (index >= 0 && wc != (gunichar)-1)
{
highlight_para_ = para;
highlight_index_ = index;
diff --git a/examples/viewer-qt.h b/examples/viewer-qt.h
index 75261ebb..c03a543d 100644
--- a/examples/viewer-qt.h
+++ b/examples/viewer-qt.h
@@ -24,7 +24,6 @@
#include <qlist.h>
#include <qmainwindow.h>
#include <pango/pango.h>
-#include <unicode.h>
class QComboBox;
class QSpinBox;
@@ -40,7 +39,7 @@ class ViewerPara
int height ();
void draw (QPainter *painter, GC gc, int y);
QRect charBounds (int index);
- unicode_char_t getChar (int index);
+ gunichar getChar (int index);
int findPoint (int x, int y);
private:
diff --git a/examples/viewer.c b/examples/viewer.c
index 84b7b25d..65a251e7 100644
--- a/examples/viewer.c
+++ b/examples/viewer.c
@@ -26,7 +26,6 @@
#include <pango/pango.h>
#include <pango/pangox.h>
-#include <unicode.h>
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
@@ -113,14 +112,16 @@ static GList *
split_paragraphs (char *text)
{
char *p = text;
- unicode_char_t wc;
+ char *next;
+ gunichar wc;
GList *result = NULL;
char *last_para = text;
while (*p)
{
- char *next = unicode_get_utf8 (p, &wc);
- if (!next)
+ wc = g_utf8_get_char (p);
+ next = g_utf8_next_char (p);
+ if (wc == (gunichar)-1)
{
fprintf (stderr, "gscript-viewer: Invalid character in input\n");
g_list_foreach (result, (GFunc)g_free, NULL);
@@ -344,9 +345,9 @@ button_press (GtkWidget *layout, GdkEventButton *event)
if (para)
{
- unicode_char_t wc;
+ gunichar wc;
- unicode_get_utf8 (para->text + offset, &wc);
+ wc = g_utf8_get_char (para->text + offset);
message = g_strdup_printf ("Current char: U%04x", wc);
xor_char (layout, NULL, highlight_para, highlight_offset);