charsize.c

来自「Intro/: Directory containing introducto」· C语言 代码 · 共 48 行

C
48
字号
#include <phigs.h>			/* get HP-PHIGS definitions for C */#include <stdio.h>			/* get standard I/O definitions */main()					/* file "CharSize.c" */{    Pint	WorkstnID = 1;		/* workstation identifier */    Pint	ConnID;			/* connection identifier */    Pint	WorkstnType = POIDDX;	/* out/in, direct, dbl bfr, Xwindow */    Pint	TheStructure = 1;	/* structure ID (chosen by user) */    char	*String, Str[2];	/* string holders */    float	Height = 0.0;		/* temporary variable: height */    float	Width = 0.05;		/* temporary variable: width */    float	X;			/* X position holder */    Ppoint	Loc;			/* location of text */    int		I;			/* loop control variable */    popen_phigs((char *) stderr, 0);	/* errors go to "stderr" */    pescape_u4("/dev/screen/phigs_window", &ConnID);    popen_ws(WorkstnID, (void *) ConnID, WorkstnType);    popen_struct(TheStructure);    strcpy(Str, "?");			/* put \0 into Str[1] */    /*--- show character height --------------------------------------------*/    String = "bigger and bigger";	/* initialize string */    Loc.x = 0.0, Loc.y = 0.7;		/* initial character location */    for (I = 0; I < 17; I++) {		/* loop for "bigger and bigger" */	Height += 0.008;		/* increment height value */	pset_char_ht(Height);	Loc.x += Height * 0.7;		/* increment X position */	Str[0] = String[I];		/* char -> null-terminated string */	ptext(&Loc, Str);		/* define a character */    }    /*--- show character width ---------------------------------------------*/    String = "wider and wider";		/* initialize string */    Loc.x = 0.0, Loc.y = 0.3;		/* initial character location */    for (I = 0; I < 15; I++) {		/* loop for "wider and wider" */	Width += 0.06;			/* increment width value */	pset_char_expan(Width);		/* set character width */	Loc.x += Width * 0.1;		/* increment X position */	Str[0] = String[I];		/* char -> null-terminated string */	ptext(&Loc, Str);		/* print a character */    }    pclose_struct();    ppost_struct(WorkstnID, TheStructure, 1.0);    pupd_ws(WorkstnID, PFLAG_PERFORM);	/* (regeneration flag) */    pclose_ws(WorkstnID);    pclose_phigs();}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?