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