/* * htexta_ */ void htexta_( float *ang) { htextang(*ang); }
/* * display all the hershey fonts and demonstrate textang */ main() { char buf[50]; char *str1 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" ; char *str2 = "abcdefghijklmnopqrstuvwxyz" ; char *str3 = "1234567890+-=!@#$%^&*(){}[]" ; char *str4 = "<>,./?~`\\|_BONK,blark" ; int i; short val; vinit("mswin"); winopen("circtxt"); hleftjustify(1); unqdevice(INPUTCHANGE); qdevice(KEYBD); /* * Wait for REDRAW event ... */ while (qread(&val) != REDRAW) ; color(BLACK); clear(); ortho2(-14.0, 14.0, -14.0, 14.0); /* define the world space */ for(i = 0; i < 22; i++) { /* * textang is used to specify the orientation of text. As * we want the title to come out straight we make sure it is * zero each time we go through this loop. */ htextang(0.0); /* * do the title */ color(YELLOW); hfont("futura.m"); sprintf(buf, "This is hershey font %s", fonts[i]); hboxtext(-11.0, 12.0, 20.0, 1.0, buf); /* * draw a box around the title */ rect(-11.0, 12.0, 9.0, 13.0); color(GREEN); hfont(fonts[i]); /* grab a font from the table */ htextsize(1.5, 1.5); /* show the outer ring */ ShowCircularText(11.0, str1); htextsize(1.3, 1.3); /* show the second ring */ ShowCircularText(8.5, str2); htextsize(1.1, 1.1); /* show the third ring */ ShowCircularText(7.0, str3); htextsize(0.9, 0.9); /* show the inside ring */ ShowCircularText(5.0, str4); if (qread(&val)) { if (val == 'q') { gexit(); exit(0); } } color(BLACK); clear(); } gexit(); }
/* * a demonstration of objects */ draw_balls() { if (!inited) { inited = 1; /* * set up our viewing transformation */ perspective(900, 1.0, 0.001, 500.0); lookat(13.0, 13.0, 8.0, 0.0, 0.0, 0.0, 0); /* * Call a routine to make the sphere object */ makesphere(); hfont("times.rb"); } /* * Now draw the sphere object scaled down. We use the pushmatrix * and the popmatrix to preserve the transformation matrix so * that only this sphere is drawn scaled. */ color(CYAN); pushmatrix(); scale(0.5, 0.5, 0.5); callobj(SPHERE); popmatrix(); /* * now we draw the same sphere translated, with a different * scale and color. */ color(WHITE); pushmatrix(); translate(0.0, -1.4 * RADIUS, 1.4 * RADIUS); scale(0.3, 0.3, 0.3); callobj(SPHERE); popmatrix(); /* * and maybe a few more times.... */ color(RED); pushmatrix(); translate(0.0, RADIUS, 0.7 * RADIUS); scale(0.2, 0.2, 0.2); callobj(SPHERE); popmatrix(); color(GREEN); pushmatrix(); translate(0.0, 1.5 * RADIUS, -RADIUS); scale(0.15, 0.15, 0.15); callobj(SPHERE); popmatrix(); color(YELLOW); pushmatrix(); translate(0.0, -RADIUS, -RADIUS); scale(0.12, 0.12, 0.12); callobj(SPHERE); popmatrix(); color(BLUE); pushmatrix(); translate(0.0, -2.0*RADIUS, -RADIUS); scale(0.3, 0.3, 0.3); callobj(SPHERE); popmatrix(); ortho2(0.0, 1.0, 0.0, 1.0); hcentertext(1); htextsize(0.08, 0.15); move2(0.8, 0.5); htextang(-90.0); hcharstr("I'm very ordinary!"); perspective(900, 1.0, 0.001, 500.0); lookat(13.0, 13.0, 8.0, 0.0, 0.0, 0.0, 0); }