Changeset 5611 for trunk/Ohana/src/kapa/graph/bDrawRotFont.c
- Timestamp:
- Nov 27, 2005, 9:22:01 PM (21 years ago)
- File:
-
- 1 edited
-
trunk/Ohana/src/kapa/graph/bDrawRotFont.c (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/kapa/graph/bDrawRotFont.c
r5610 r5611 1 1 # include "Ximage.h" 2 2 # include "bDraw.h" 3 # include "alphabet.h" 4 3 4 # define NROTCHARS 256 5 5 # define XPROC(x,y) (scale*(cs*((x) - x0) - sn*((y) - y0)) + X0) 6 6 # define YPROC(x,y) (scale*(cs*((y) - y0) + sn*((x) - x0)) + Y0) … … 12 12 int bDrawRotText (int x, int y, char *string, int pos, double angle) { 13 13 14 char *c, *bitmap, basefont[64]; 14 unsigned char *bitmap; 15 char *currentname, basename[64], *c; 15 16 int i, dy, dx, N, X, Y, code; 16 int dX, Xoff, dY, Yoff, YoffBase, basesize; 17 double cs, sn; 18 19 // return (TRUE); 17 int dX, Xoff, dY, Yoff, YoffBase; 18 int currentsize, basesize; 19 double cs, sn, currentscale; 20 RotFont *currentfont; 21 20 22 white = GetColorByName ("white"); 21 23 black = GetColorByName ("black"); 24 25 currentname = GetRotFont (¤tsize); 26 currentfont = GetRotFontData (¤tscale); 27 strcpy (basename, currentname); 28 basesize = currentsize; 22 29 23 30 /* strip leading whitespace */ … … 29 36 sn = sin(angle*RAD_DEG); 30 37 dX = RotStrlen (c); 31 dY = activefont[65].ascent;38 dY = currentfont[65].ascent; 32 39 33 40 /* apply appropriate offset */ … … 47 54 code = FALSE; 48 55 49 strcpy (basefont, currentname);50 basesize = currentsize;51 52 56 YoffBase = Yoff; 53 57 /* draw characters one-by-one */ 54 58 for (i = 0; i < strlen(c); i++) { 55 59 N = (int)(c[i]); 56 if ((N < 0) || (N >= NROT )) continue;60 if ((N < 0) || (N >= NROTCHARS)) continue; 57 61 58 62 /* check for special characters */ … … 60 64 if (N == 94) { 61 65 SetRotFont (currentname, (int)(0.8*currentsize)); 62 Yoff -= 0.5*activescale*dY; 66 currentfont = GetRotFontData (¤tscale); 67 Yoff -= 0.5*currentscale*dY; 63 68 continue; 64 69 } 65 70 if (N == 95) { 66 71 SetRotFont (currentname, (int)(0.8*currentsize)); 67 Yoff += 0.5*activescale*dY; 72 currentfont = GetRotFontData (¤tscale); 73 Yoff += 0.5*currentscale*dY; 68 74 continue; 69 75 } 70 76 if (N == 124) { 71 77 SetRotFont (currentname, basesize); 78 currentfont = GetRotFontData (¤tscale); 72 79 Yoff = YoffBase; 73 80 continue; … … 80 87 if (c[i+1] == 'h') { 81 88 SetRotFont ("helvetica", currentsize); 89 currentfont = GetRotFontData (¤tscale); 82 90 } 83 91 if (c[i+1] == 't') { 84 92 SetRotFont ("times", currentsize); 93 currentfont = GetRotFontData (¤tscale); 85 94 } 86 95 if (c[i+1] == 'c') { 87 96 SetRotFont ("courier", currentsize); 97 currentfont = GetRotFontData (¤tscale); 88 98 } 89 99 if (c[i+1] == 's') { 90 100 SetRotFont ("symbol", currentsize); 101 currentfont = GetRotFontData (¤tscale); 91 102 } 92 103 i++; … … 96 107 code = FALSE; 97 108 98 bitmap = activefont[N].bits;99 dx = activefont[N].dx;100 dy = activefont[N].dy;101 X = x + (int)(Xoff*cs - Yoff*sn) + (int)( activescale*activefont[N].ascent*sn);102 Y = y + (int)(Xoff*sn + Yoff*cs) - (int)( activescale*activefont[N].ascent*cs);103 bDrawRotBitmap (X, Y, dx, dy, bitmap, TRUE, angle, activescale);104 Xoff += 1 + (int)( activescale*dx + 0.5);109 bitmap = currentfont[N].bits; 110 dx = currentfont[N].dx; 111 dy = currentfont[N].dy; 112 X = x + (int)(Xoff*cs - Yoff*sn) + (int)(currentscale*currentfont[N].ascent*sn); 113 Y = y + (int)(Xoff*sn + Yoff*cs) - (int)(currentscale*currentfont[N].ascent*cs); 114 bDrawRotBitmap (X, Y, dx, dy, bitmap, TRUE, angle, currentscale); 115 Xoff += 1 + (int)(currentscale*dx + 0.5); 105 116 } 106 SetRotFont (base font, basesize);117 SetRotFont (basename, basesize); 107 118 return (TRUE); 108 119 } 109 120 110 int bDrawRotBitmap (int x, int y, int dx, int dy, char *bitmap, int mode, double angle, double scale) {121 int bDrawRotBitmap (int x, int y, int dx, int dy, unsigned char *bitmap, int mode, double angle, double scale) { 111 122 112 123 int ii, jj, byte_line, byte, bit, flag;
Note:
See TracChangeset
for help on using the changeset viewer.
