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/RotFont.c

    r5610 r5611  
    11# include "Ximage.h"
    22# include "alphabet.h"
    3 # define NROT 256
    43 
     4static int Nrotfonts;
     5static FontSet *RotFonts;
     6
     7static char currentname[64];
     8static int  currentsize;
     9static double currentscale;
     10static RotFont *currentfont;
     11
    512void InitRotFonts () {
    613
     
    916  Nhardwired = sizeof (HardwiredFonts) / sizeof (FontSet);
    1017 
    11   Nallfonts = Nhardwired;
    12   ALLOCATE (AllFonts, FontSet, Nallfonts);
     18  Nrotfonts = Nhardwired;
     19  ALLOCATE (RotFonts, FontSet, Nrotfonts);
    1320 
    1421  for (i = 0; i < Nhardwired; i++) {
    15     AllFonts[i] = HardwiredFonts[i];
     22    RotFonts[i] = HardwiredFonts[i];
    1623  }
    1724
    18   activefont = AllFonts[DEFFONT].font;
    19   activescale = 1.0;
    20   strcpy (currentname, AllFonts[DEFFONT].name);
    21   currentsize = AllFonts[DEFFONT].size;
     25  currentfont = RotFonts[DEFFONT].font;
     26  currentscale = 1.0;
     27  strcpy (currentname, RotFonts[DEFFONT].name);
     28  currentsize = RotFonts[DEFFONT].size;
    2229}
    2330
     
    2936  dsize = 10000;
    3037  bsize = 10000;
    31   for (i = 0; i < Nallfonts; i++) {
    32     if (!strcasecmp (AllFonts[i].name, name)) {
     38  for (i = 0; i < Nrotfonts; i++) {
     39    if (!strcasecmp (RotFonts[i].name, name)) {
    3340      good = i;
    34       nsize = abs (AllFonts[i].size - size);
     41      nsize = abs (RotFonts[i].size - size);
    3542      if (nsize < dsize) {
    3643        match = i;
    3744        dsize = nsize;
    3845      }
    39       msize = AllFonts[i].size - size;
     46      msize = RotFonts[i].size - size;
    4047      if ((msize < bsize) && (msize >= 0)) {
    4148        bigger = i;
     
    4855  if (bigger != -1) match = bigger;
    4956  if (match != -1) {
    50     activefont = AllFonts[match].font;
    51     activescale = (double) size / AllFonts[match].size;
     57    currentfont = RotFonts[match].font;
     58    currentscale = (double) size / RotFonts[match].size;
    5259    currentsize = size;
    5360    strcpy (currentname, name);
     
    6774}
    6875
     76RotFont *GetRotFontData (double *scale) {
     77  *scale = currentscale;
     78  return (currentfont);
     79}
     80
    6981int RotStrlen (char *c) {
    7082
     
    7284  double scale;
    7385 
    74   scale = activescale;
     86  scale = currentscale;
    7587
    7688  /* find string length */
     
    94106      }
    95107      if (N == 124) { /* normal-script */
    96         scale = activescale;
     108        scale = currentscale;
    97109        continue;
    98110      }
     
    107119    }
    108120    code = FALSE;
    109     dX += scale*activefont[N].dx + 1;
     121    dX += scale*currentfont[N].dx + 1;
    110122  }
    111123  return (dX);
Note: See TracChangeset for help on using the changeset viewer.