Skip to Main Content
Volume 7A: XView Programming Manual
book

Volume 7A: XView Programming Manual

by Dan Heller
October 1994
Intermediate to advanced content levelIntermediate to advanced
770 pages
22h 58m
English
O'Reilly Media, Inc.
Content preview from Volume 7A: XView Programming Manual
Example F-4. The type_font.c program
/*
* simple_font.c -- very simple program showing how to render text
* using fonts loaded by XView.
*/
#include <ctype.h>
#include <X11/X.h>
#include <X11/Xlib.h>
#include <xview/xview.h>
#include <xview/panel.h>
#include <xview/font.h>
Display *dpy;
GC gc;
XFontStruct *font_info;
main(argc, argv)
int argc;
char *argv[ ];
{
Frame frame;
Panel panel;
Canvas canvas;
XGCValues gcvalues;
Xv_Font font;
void my_event_proc();
extern void exit();
xv_init(XV_INIT_ARGC_PTR_ARGV, &argc, argv, NULL);
frame = (Frame)xv_create(XV_NULL, FRAME,
FRAME_LABEL, argv[0],
NULL);
panel = (Panel)xv_create(frame, PANEL,
PANEL_LAYOUT, PANEL_VERTICAL,
NULL);
xv_create(panel, PANEL_BUTTON,
PANEL_LABEL_STRING, "Quit",
PANEL_NOTIFY_PROC, exit,
NULL);
window_fit(panel);
canvas = (Canvas)xv_create(frame, CANVAS,
XV_WIDTH, 400,
XV_HEIGHT, 200,
CANVAS_X_PAINT_WINDOW, TRUE,
NULL);
xv_set(canvas_paint_window(canvas),
WIN_EVENT_PROC, my_event_proc,
NULL);
window_fit(frame);
dpy = (Display *)xv_get(frame, XV_DISPLAY);
font = (Xv_Font)xv_get(frame, XV_FONT);
font_info = (XFontStruct *)xv_get(font, FONT_INFO);
728 XView Programming Manual
Example F-4. The type_font.c program (continued)
gcvalues.font = (Font)xv_get(font, XV_XID);
gcvalues.foreground = BlackPixel(dpy, DefaultScreen(dpy));
gcvalues.background = WhitePixel(dpy, Defau
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Volume 6A: Motif Programming Manual

Volume 6A: Motif Programming Manual

David Brennan, Dan Heller, Paula Ferguson
Java™ Media APIs: Cross-Platform Imaging, Media, and Visualization

Java™ Media APIs: Cross-Platform Imaging, Media, and Visualization

Alejandro Terrazas, John Ostuni, Michael Barlow

Publisher Resources

ISBN: 9780937175873