Changeset 5611 for trunk/Ohana/src/kapa/graph/RotFont.c
- Timestamp:
- Nov 27, 2005, 9:22:01 PM (21 years ago)
- File:
-
- 1 edited
-
trunk/Ohana/src/kapa/graph/RotFont.c (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/kapa/graph/RotFont.c
r5610 r5611 1 1 # include "Ximage.h" 2 2 # include "alphabet.h" 3 # define NROT 2564 3 4 static int Nrotfonts; 5 static FontSet *RotFonts; 6 7 static char currentname[64]; 8 static int currentsize; 9 static double currentscale; 10 static RotFont *currentfont; 11 5 12 void InitRotFonts () { 6 13 … … 9 16 Nhardwired = sizeof (HardwiredFonts) / sizeof (FontSet); 10 17 11 N allfonts = Nhardwired;12 ALLOCATE ( AllFonts, FontSet, Nallfonts);18 Nrotfonts = Nhardwired; 19 ALLOCATE (RotFonts, FontSet, Nrotfonts); 13 20 14 21 for (i = 0; i < Nhardwired; i++) { 15 AllFonts[i] = HardwiredFonts[i];22 RotFonts[i] = HardwiredFonts[i]; 16 23 } 17 24 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; 22 29 } 23 30 … … 29 36 dsize = 10000; 30 37 bsize = 10000; 31 for (i = 0; i < N allfonts; i++) {32 if (!strcasecmp ( AllFonts[i].name, name)) {38 for (i = 0; i < Nrotfonts; i++) { 39 if (!strcasecmp (RotFonts[i].name, name)) { 33 40 good = i; 34 nsize = abs ( AllFonts[i].size - size);41 nsize = abs (RotFonts[i].size - size); 35 42 if (nsize < dsize) { 36 43 match = i; 37 44 dsize = nsize; 38 45 } 39 msize = AllFonts[i].size - size;46 msize = RotFonts[i].size - size; 40 47 if ((msize < bsize) && (msize >= 0)) { 41 48 bigger = i; … … 48 55 if (bigger != -1) match = bigger; 49 56 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; 52 59 currentsize = size; 53 60 strcpy (currentname, name); … … 67 74 } 68 75 76 RotFont *GetRotFontData (double *scale) { 77 *scale = currentscale; 78 return (currentfont); 79 } 80 69 81 int RotStrlen (char *c) { 70 82 … … 72 84 double scale; 73 85 74 scale = activescale;86 scale = currentscale; 75 87 76 88 /* find string length */ … … 94 106 } 95 107 if (N == 124) { /* normal-script */ 96 scale = activescale;108 scale = currentscale; 97 109 continue; 98 110 } … … 107 119 } 108 120 code = FALSE; 109 dX += scale* activefont[N].dx + 1;121 dX += scale*currentfont[N].dx + 1; 110 122 } 111 123 return (dX);
Note:
See TracChangeset
for help on using the changeset viewer.
