nanogui: Thread: Prolem in Microwin TrueType font display


[<<] [<] Page 1 of 1 [>] [>>]
Subject: Prolem in Microwin TrueType font display
From: "Wong ShingYuen" ####@####.####
Date: 31 Jan 2002 05:19:46 -0000
Message-Id: <F1084XtliS01qCcWNYg00006c81@hotmail.com>

Dear all,

I have compile the microwin with multibyte patch. When I run a simple 
displaying Chinese TrueType Font example in iPAQ, I meet the Segmentation 
fault. I have try in Destop RedHat Linux and it work! I don't why the 
Segmentation fault occur in iPAQ. Could anyone tell me the reason or Have 
you meet such of this kind problem before?

Thank a lot!


Cheer,
Gary

-------------------------------------------------------------------------------

---Error Message---

nxclient: bad readblock -1
nxclient 141: Corrupted packet
nxclient: bad readblock -1
nxclient 143: Corrupted packet
[1] 140 Segmentation fault    ./nanoX 
[2] 141 Broken pipe           ./nanowm

-----------------------------------------------------------------------------

---font.c---

#include <stdio.h>
#define MWINCLUDECOLORS
#include "nano-X.h"

 GR_WINDOW_ID  wid;
 GR_GC_ID      gc;
 GR_FONT_ID    font_a, font_b, font_c, font_d;
        
 void event_handler (GR_EVENT *event);

 int main (void)
 {
     if (GrOpen() < 0)
     {
         fprintf (stderr, "GrOpen failed");
         exit (1);
     }

     gc = GrNewGC();
     GrSetGCUseBackground (gc, GR_FALSE);
     GrSetGCForeground (gc, RED);
  
     wid = GrNewWindowEx (GR_WM_PROPS_APPFRAME |
                          GR_WM_PROPS_CAPTION  |
                          GR_WM_PROPS_CLOSEBOX,
                          "Font Test Window",
                          GR_ROOT_WINDOW_ID, 50, 50, 
                          200, 130, WHITE);

     GrSelectEvents (wid, GR_EVENT_MASK_EXPOSURE | 
                          GR_EVENT_MASK_CLOSE_REQ);

     font_a = GrCreateFont ("arial", 12, NULL);

     font_b = GrCreateFont ("comic", 12, NULL);

     font_d = GrCreateFont ("bsmi00lp", 12, NULL);
     font_c = GrCreateFont ("bkai00mp", 12, NULL);

     GrMapWindow (wid);
     GrMainLoop (event_handler);
     return 0;
 }

 void event_handler (GR_EVENT *event)
 {

     switch (event->type)
     {
     case GR_EVENT_TYPE_EXPOSURE:

         GrSetGCFont (gc, font_a);
         GrText (wid, gc, 20, 20, "Arial 12",  -1, GR_TFASCII);

         GrSetGCFont (gc, font_b);
         GrText (wid, gc, 20, 40, "Comic 12",  -1, GR_TFASCII);

         GrSetGCFont (gc, font_c);
         GrText (wid, gc, 20, 70, "中文字",  -1, GR_TFASCII | MWTF_BIG5);

         GrSetGCFont (gc, font_d);
         GrText (wid, gc, 20, 100, "中文字", -1, GR_TFASCII | MWTF_BIG5);
         break;
        
     case GR_EVENT_TYPE_CLOSE_REQ:
         GrClose();
         exit (0);
     }
 }


_________________________________________________________________
使用 MSN Messenger,與朋友在線上聊天:http://messenger.microsoft.com/tc。 

[<<] [<] Page 1 of 1 [>] [>>]


Powered by ezmlm-browse 0.20.