IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Nov 27, 2005, 9:22:01 PM (21 years ago)
Author:
eugene
Message:

fixed up RotFont stuff

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/kapa/graph/bDrawRotFont.c

    r5610 r5611  
    11# include "Ximage.h"
    22# include "bDraw.h"
    3 # include "alphabet.h"
    4 
     3
     4# define NROTCHARS 256
    55# define XPROC(x,y) (scale*(cs*((x) - x0) - sn*((y) - y0)) + X0)
    66# define YPROC(x,y) (scale*(cs*((y) - y0) + sn*((x) - x0)) + Y0)
     
    1212int bDrawRotText (int x, int y, char *string, int pos, double angle) {
    1313
    14   char *c, *bitmap, basefont[64];
     14  unsigned char *bitmap;
     15  char *currentname, basename[64], *c;
    1516  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
    2022  white = GetColorByName ("white");
    2123  black = GetColorByName ("black");
     24
     25  currentname = GetRotFont (&currentsize);
     26  currentfont = GetRotFontData (&currentscale);
     27  strcpy (basename, currentname);
     28  basesize = currentsize;
    2229
    2330  /* strip leading whitespace */
     
    2936  sn = sin(angle*RAD_DEG);
    3037  dX = RotStrlen (c);
    31   dY = activefont[65].ascent;
     38  dY = currentfont[65].ascent;
    3239
    3340  /* apply appropriate offset */
     
    4754  code = FALSE;
    4855
    49   strcpy (basefont, currentname);
    50   basesize = currentsize;
    51 
    5256  YoffBase = Yoff;
    5357  /* draw characters one-by-one */
    5458  for (i = 0; i < strlen(c); i++) {
    5559    N = (int)(c[i]);
    56     if ((N < 0) || (N >= NROT)) continue;
     60    if ((N < 0) || (N >= NROTCHARS)) continue;
    5761
    5862    /* check for special characters */
     
    6064      if (N == 94) {
    6165        SetRotFont (currentname, (int)(0.8*currentsize));
    62         Yoff -= 0.5*activescale*dY;
     66        currentfont = GetRotFontData (&currentscale);
     67        Yoff -= 0.5*currentscale*dY;
    6368        continue;
    6469      }
    6570      if (N == 95) {
    6671        SetRotFont (currentname, (int)(0.8*currentsize));
    67         Yoff += 0.5*activescale*dY;
     72        currentfont = GetRotFontData (&currentscale);
     73        Yoff += 0.5*currentscale*dY;
    6874        continue;
    6975      }
    7076      if (N == 124) {
    7177        SetRotFont (currentname, basesize);
     78        currentfont = GetRotFontData (&currentscale);
    7279        Yoff = YoffBase;
    7380        continue;
     
    8087        if (c[i+1] == 'h') {
    8188          SetRotFont ("helvetica", currentsize);
     89          currentfont = GetRotFontData (&currentscale);
    8290        }
    8391        if (c[i+1] == 't') {
    8492          SetRotFont ("times", currentsize);
     93          currentfont = GetRotFontData (&currentscale);
    8594        }
    8695        if (c[i+1] == 'c') {
    8796          SetRotFont ("courier", currentsize);
     97          currentfont = GetRotFontData (&currentscale);
    8898        }
    8999        if (c[i+1] == 's') {
    90100          SetRotFont ("symbol", currentsize);
     101          currentfont = GetRotFontData (&currentscale);
    91102        }
    92103        i++;
     
    96107    code = FALSE;
    97108
    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);
    105116  }
    106   SetRotFont (basefont, basesize);
     117  SetRotFont (basename, basesize);
    107118  return (TRUE);
    108119}
    109120
    110 int bDrawRotBitmap (int x, int y, int dx, int dy, char *bitmap, int mode, double angle, double scale) {
     121int bDrawRotBitmap (int x, int y, int dx, int dy, unsigned char *bitmap, int mode, double angle, double scale) {
    111122
    112123  int ii, jj, byte_line, byte, bit, flag;
Note: See TracChangeset for help on using the changeset viewer.