Article View: fj.sys.sun
Article #13217Help me, displaying kanji use XView.
From: Ichimura
Date: Thu, 10 Dec 1992 09:28
Date: Thu, 10 Dec 1992 09:28
126 lines
4208 bytes
4208 bytes
$BFMA3$G$9$,$$$^(JXView$B$G%/%j%(%$%H$7$?%&%#%s%I%&>e$K4A;z$rI=<($5$;$h$&$H$7$F$$$k(J
$B$N$G$9$,$&$^$/$$$-$^$;$s!#(J
SUN $B$N!!(JSPARK_Station2$B!!$N(J Japanese OpenWindow 2.0.1 $B>e$G%W%m%0%i%_%s%0$r$7$F(J
$B$$$^$9!#(J
$B!V#X#V#i#e#w%W%m%0%i%_%s%0%^%K%e%"%k!J#S#O#F#T#B#A#N#K!K!W$N#3#0#2%Z!<%8$NNcBj(J
$B%W%m%0%i%`(J"simple_font.c"$B$K!V#X#V#i#e#w%W%m%0%i%^!<%:%,%$%I!J9q:]2=HG!K!JF|K\(J
$B%5%s%^%$%/%m%7%9%F%`%:!K!W$K1h$$%W%m%0%i%`$rJQ99$7$F$_$?$N$G$9$,!"(J"Bus Error"
$B$K$J$C$F$7$^$$$^$9!#$^$?!"$3$N%W%m%0%i%`$NB0@-(J"XV_KEY_DATA"$B$r(J"XV_KEY_DATA_WCS"
$B$H%o%$%I%-%c%i%/%?;EMM$K$7$h$&$H$9$k$H(J"Undefined"$B$N%(%i!<$,$G$^$9!#(J
$B$I$NMM$K$9$l$P$$$$$N$G$7$g$&$+8f;XF32<$5$$!#(J
$B$^$?!"4A;z$rI=<($G$-$k$h$&$K$J$k4JC1$JNcBj$J$IM-$j$^$7$?$i!"$*65$(2<$5$$!#(J
###########################################################
# $B!!9qN)El5~9)6H9bEy@lLg3X9;!!>pJs9)3X2J!!;TB<8&5f<<!!!!(J #
# $B!!!!!!!!!!!!!!EOJU!!0l@.!!!!!!!!!!!!!!!!!!!!!!!!(J #
# E-mail: ichimura@cs.tokyo-ct.ac.jp #
###########################################################
$B0J2<$K>e5-$N%U%!%$%k$r<($7$^$9!#$*4j$$$7$^$9!#(J
/*
* simple_font.c --
*/
#include <stdio.h>
#include <X11/X.h>
#include <X11/Xlib.h>
#include <xview/xview.h>
#include <xview/canvas.h>
#include <xview/font.h>
#include <xview/xv_xrect.h>
#include <widec.h>
#define GC_KEY 10
main(argc,argv)
int argc;
char *argv[];
{
Frame frame;
Canvas canvas;
XGCValues gcvalues;
Xv_Font font;
void my_repaint_proc();
Display *dpy;
GC gc;
xv_init(XV_USE_LOCALE, TRUE,
XV_LC_BASIC_LOCALE, "japanese",
XV_INIT_ARGC_PTR_ARGV, &argc, argv, NULL);
frame = (Frame)xv_create(XV_NULL, FRAME, NULL);
canvas = (Canvas)xv_create(frame, CANVAS,
XV_WIDTH, 400,
XV_HEIGHT, 200,
CANVAS_X_PAINT_WINDOW, TRUE,
CANVAS_REPAINT_PROC, my_repaint_proc,
NULL);
window_fit(frame);
printf("pass!1\n");/******/
dpy = (Display *)xv_get(frame, XV_DISPLAY);
font = (Xv_Font)xv_find(frame, FONT,
FONT_FAMILY, FONT_FAMILY_SANS_SERIF,
FONT_STYLE, FONT_STYLE_NORMAL,
FONT_LOCALE, "japanese",
NULL);
/*if (!font) {
fprintf(stderr, "%s: cannot use font: lucida.\n", argv[0]);
font = (Xv_Font)xv_get(frame, XV_FONT);
}*/
/* Create a GC
*
*/
printf("pass!2\n");/********/
gcvalues.font = (Font)xv_get(font, XV_XID);
gcvalues.foreground = BlackPixel(dpy, DefaultScreen(dpy));
gcvalues.background = WhitePixel(dpy, DefaultScreen(dpy));
gcvalues.graphics_exposures = False;
gc = XCreateGC(dpy, RootWindow(dpy, DefaultScreen(dpy)),
GCForeground | GCBackground | GCFont | GCGraphicsExposures,
&gcvalues);
/* Assign the gc to the canvas object so we can use the same
* gc each time we draw into the canvas. Also avoid a grobal
* Variable to store the GC.
*/
printf("pass!3\n");/*********/
xv_set(canvas, XV_KEY_DATA, GC_KEY, gc, NULL);
printf("pass!4\n");/*********/
xv_main_loop(frame);
}
/*
* Called every time the window needs repainting.
*/
void
my_repaint_proc(canvas, font, frame, wstring, dpy, xwin)
Frame frame;
Canvas canvas;
Display *dpy;
/*Window*/
Drawable xwin;
wchar_t *wstring;
Xv_Font font;
{
GC gc = (GC)xv_get(canvas, XV_KEY_DATA, GC_KEY);
printf("pass!5\n");/*********/
wstring = "$BEl5~9b@l(J";
printf("pass!6\n");/*********/
XwcDrawString(dpy, xwin, font, gc, 10, 20, wstring, 4); /* %%% BUS ERROR occured %%% */
printf("pass!7\n");/*********/
}
Technical Details
Message-ID:
<1148@tok-ctgw.tokyo-ct.ac.jp>Path:
arc1-ca.pugleaf.net!sparky!uunet!stanford.edu!sun-barr!sh.wide!wnoc-tyo-news!sranha!cecgw!tok-ctgw!ichimuraShow Full Headers
Complete Article Headers
X-Google-Language: Japanese,JIS X-Google-Thread: fcfb5,5e7585e4d1dfae98,start X-Google-Attributes: gidfcfb5,public X-Google-ArrivalTime: 1992-12-10 07:10:30 PST Path: arc1-ca.pugleaf.net!sparky!uunet!stanford.edu!sun-barr!sh.wide!wnoc-tyo-news!sranha!cecgw!tok-ctgw!ichimura From: ichimura@tok-ctgw.tokyo-ct.ac.jp (Ichimura) Newsgroups: fj.sys.sun Subject: Help me, displaying kanji use XView. Message-ID: <1148@tok-ctgw.tokyo-ct.ac.jp> Date: 10 Dec 92 09:28:20 GMT Reply-To: ichimura@tok-ctgw.tokyo-ct.ac.jp (Ichimura) Distribution: fj Organization: Tokyo National College of Technology, Tokyo, Japan Lines: 126