IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 41319 for trunk


Ignore:
Timestamp:
Apr 1, 2020, 4:11:00 PM (6 years ago)
Author:
eugene
Message:

add PDF native support

Location:
trunk/Ohana/src/libkapa
Files:
1 added
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/libkapa/Makefile

    r39926 r41319  
    4242$(SRC)/RotFont.$(ARCH).o        \
    4343$(SRC)/DrawRotString.$(ARCH).o  \
     44$(SRC)/PDFRotFont.$(ARCH).o     \
    4445$(SRC)/PSRotFont.$(ARCH).o
    4546
  • trunk/Ohana/src/libkapa/include/kapa.h

    r41156 r41319  
    222222int KapaPNG (int fd, const char *filename);
    223223int KapaPPM (int fd, const char *filename);
     224int KapaPDF (int fd, const char *filename, int scaleMode, int pageMode, char *pagename);
    224225
    225226/* KiiCursor.c */
     
    291292int DrawRotTextInit (Display *display, Window window, GC gc, unsigned long fore, unsigned long back);
    292293
     294/* PDFRotFont.c */
     295void PDFRotText (IOBuffer *buffer, int x, int y, char *string, int pos, double angle);
    293296
    294297/* PSRotFont.c */
    295298void PSRotText PROTO((FILE *f, int x, int y, char *string, int pos, double angle));
    296 void PSDumpRotSegment PROTO((FILE *f, char *segment, int *Nseg));
    297 void PSSetFont PROTO((FILE *f, char *name, int size));
    298299int PSRotStrlen PROTO((char *c));
    299300
  • trunk/Ohana/src/libkapa/src/DrawRotString.c

    r40628 r41319  
    7777
    7878  YoffBase = Yoff;
     79  int Ydelta = 0;
    7980  /* draw characters one-by-one */
     81
     82  // successive subscripts / superscripts drop the line by
     83  // same amount each time, but size remains 0.8
     84  // sub followed by sup, or vice versa, should clear and do basic sup/sub
     85
    8086  unsigned int i;
    81   // unsigned char *tmpstring = (unsigned char *) string;
    82 
    8387  for (i = 0; i < strlen(string); i++) {
    8488    // N = (unsigned int)(tmpstring[i]);
     
    98102        SetRotFont (currentname, (int)(0.8*currentsize));
    99103        currentfont = GetRotFontData (&currentscale);
     104
     105        if (Ydelta > 0) { Ydelta = 0; Yoff = YoffBase; }
     106        Ydelta --;
    100107        Yoff -= 0.5*currentscale*dY;
    101108        continue;
     
    105112        SetRotFont (currentname, (int)(0.8*currentsize));
    106113        currentfont = GetRotFontData (&currentscale);
     114
     115        if (Ydelta < 0) { Ydelta = 0; Yoff = YoffBase; }
     116        Ydelta ++;
    107117        Yoff += 0.5*currentscale*dY;
    108118        continue;
     
    113123        currentfont = GetRotFontData (&currentscale);
    114124        Yoff = YoffBase;
     125        Ydelta = 0;
    115126        continue;
    116127      }
  • trunk/Ohana/src/libkapa/src/KapaColors.c

    r38153 r41319  
    44
    55static char KAPA_COLORS[N_KAPA_COLORS][3][16] = {
    6 {"black",        "black",        "0.00 0.00 0.00"},
    7 {"white",        "white",        "1.00 1.00 1.00"},
    8 {"red",          "red",          "1.00 0.00 0.00"},
    9 {"pink",         "pink",         "1.00 0.75 0.80"},
    10 {"orange",       "orange",       "1.00 0.65 0.00"},
    11 {"yellow",       "yellow",       "1.00 1.00 0.00"},
    12 {"wheat",        "wheat",        "0.96 0.87 0.70"},
    13 {"gold",         "gold",         "1.00 0.84 0.00"},
    14 {"green",        "green",        "0.00 1.00 0.00"},
    15 {"darkgreen",    "darkgreen",    "0.00 0.40 0.00"},
    16 {"darkblue",     "darkblue",     "0.50 0.50 1.00"},
    17 {"blue",         "blue",         "0.00 0.00 1.00"},
    18 {"skyblue",      "skyblue",      "0.53 0.81 0.92"},
    19 {"indigo",       "mediumpurple", "0.57 0.44 0.86"},
    20 {"violet",       "darkviolet",   "0.58 0.00 0.88"},
    21 {"blue10",       "rgb:00/00/33", "0.00 0.00 0.20"},
    22 {"blue20",       "rgb:00/00/66", "0.00 0.00 0.40"},
    23 {"blue30",       "rgb:00/00/99", "0.00 0.00 0.60"},
    24 {"blue40",       "rgb:00/00/cc", "0.00 0.00 0.80"},
    25 {"blue50",       "rgb:00/00/ff", "0.00 0.00 1.00"},
    26 {"blue60",       "rgb:33/33/ff", "0.20 0.20 1.00"},
    27 {"blue70",       "rgb:66/66/ff", "0.40 0.40 1.00"},
    28 {"blue80",       "rgb:99/99/ff", "0.60 0.60 1.00"},
    29 {"blue90",       "rgb:cc/cc/ff", "0.80 0.80 1.00"},
     6{"black",        "black",                "0.00 0.00 0.00"},
     7{"white",        "white",                "1.00 1.00 1.00"},
     8{"red",          "red",                  "1.00 0.00 0.00"},
     9{"pink",         "pink",                 "1.00 0.75 0.80"},
     10{"orange",       "orange",               "1.00 0.65 0.00"},
     11{"yellow",       "yellow",               "1.00 1.00 0.00"},
     12{"wheat",        "wheat",                "0.96 0.87 0.70"},
     13{"gold",         "gold",                 "1.00 0.84 0.00"},
     14{"green",        "green",                "0.00 1.00 0.00"},
     15{"darkgreen",    "darkgreen",            "0.00 0.40 0.00"},
     16{"darkblue",     "darkblue",             "0.50 0.50 1.00"},
     17{"blue",         "blue",                 "0.00 0.00 1.00"},
     18{"skyblue",      "skyblue",              "0.53 0.81 0.92"},
     19{"indigo",       "mediumpurple",         "0.57 0.44 0.86"},
     20{"violet",       "darkviolet",           "0.58 0.00 0.88"},
     21{"blue10",       "rgb:00/00/33",         "0.00 0.00 0.20"},
     22{"blue20",       "rgb:00/00/66",         "0.00 0.00 0.40"},
     23{"blue30",       "rgb:00/00/99",         "0.00 0.00 0.60"},
     24{"blue40",       "rgb:00/00/cc",         "0.00 0.00 0.80"},
     25{"blue50",       "rgb:00/00/ff",         "0.00 0.00 1.00"},
     26{"blue60",       "rgb:33/33/ff",         "0.20 0.20 1.00"},
     27{"blue70",       "rgb:66/66/ff",         "0.40 0.40 1.00"},
     28{"blue80",       "rgb:99/99/ff",         "0.60 0.60 1.00"},
     29{"blue90",       "rgb:cc/cc/ff",         "0.80 0.80 1.00"},
    3030{"red10",        "rgb:33/00/00",         "0.20 0.00 0.00"},
    3131{"red20",        "rgb:66/00/00",         "0.40 0.00 0.00"},
     
    3737{"red80",        "rgb:ff/99/99",         "1.00 0.60 0.60"},
    3838{"red90",        "rgb:ff/cc/cc",         "1.00 0.80 0.80"},
    39 {"grey10",       "grey10",       "0.10 0.10 0.10"},
    40 {"grey20",       "grey20",       "0.20 0.20 0.20"},
    41 {"grey30",       "grey30",       "0.30 0.30 0.30"},
    42 {"grey40",       "grey40",       "0.40 0.40 0.40"},
    43 {"grey50",       "grey50",       "0.50 0.50 0.50"},
    44 {"grey60",       "grey60",       "0.60 0.60 0.60"},
    45 {"grey70",       "grey70",       "0.70 0.70 0.70"},
    46 {"grey80",       "grey80",       "0.80 0.80 0.80"},
    47 {"grey90",       "grey90",       "0.90 0.90 0.90"}};
     39{"grey10",       "grey10",               "0.10 0.10 0.10"},
     40{"grey20",       "grey20",               "0.20 0.20 0.20"},
     41{"grey30",       "grey30",               "0.30 0.30 0.30"},
     42{"grey40",       "grey40",               "0.40 0.40 0.40"},
     43{"grey50",       "grey50",               "0.50 0.50 0.50"},
     44{"grey60",       "grey60",               "0.60 0.60 0.60"},
     45{"grey70",       "grey70",               "0.70 0.70 0.70"},
     46{"grey80",       "grey80",               "0.80 0.80 0.80"},
     47{"grey90",       "grey90",               "0.90 0.90 0.90"}};
    4848
    4949int KapaColorByName (char *name) {
     
    7070
    7171char *KapaColorRGBString (int N) {
    72   return (KAPA_COLORS[N][2]);
     72  int Nused = MAX (0, MIN (N_KAPA_COLORS, N));
     73  return (KAPA_COLORS[Nused][2]);
    7374}
    7475
    7576char *KapaColorName (int N) {
    76   return (KAPA_COLORS[N][0]);
     77  int Nused = MAX (0, MIN (N_KAPA_COLORS, N));
     78  return (KAPA_COLORS[Nused][0]);
    7779}
    7880
  • trunk/Ohana/src/libkapa/src/KiiConvert.c

    r13479 r41319  
    3232  return (TRUE);
    3333}
     34
     35int KapaPDF (int fd, const char *filename, int scaleMode, int pageMode, char *pagename) {
     36
     37  KiiSendCommand (fd, 4, "PDFT");
     38  KiiSendMessage (fd, "%s %s %d %d", filename, pagename, scaleMode, pageMode);
     39  KiiWaitAnswer (fd, "DONE");
     40  return (TRUE);
     41}
  • trunk/Ohana/src/libkapa/src/PSRotFont.c

    r40628 r41319  
    11# include <kapa_internal.h>
    22# define NROTCHARS 256
     3
     4// local functions:
     5void PSDumpRotSegment (FILE *f, char *segment, int *Nseg);
     6void PSSetFont (FILE *f, char *name, int size);
    37
    48/* writes commands to print string at location and angle using
  • trunk/Ohana/src/libkapa/src/bDrawRotFont.c

    r40628 r41319  
    5757
    5858  YoffBase = Yoff;
     59  int Ydelta = 0;
    5960  /* draw characters one-by-one */
     61
     62  // successive subscripts / superscripts drop the line by
     63  // same amount each time, but size remains 0.8
     64  // sub followed by sup, or vice versa, should clear and do basic sup/sub
    6065
    6166  unsigned int i;
     
    7378        SetRotFont (currentname, (int)(0.8*currentsize));
    7479        currentfont = GetRotFontData (&currentscale);
    75         Yoff -= 0.5*currentscale*dY;
     80
     81        if (Ydelta > 0) { Ydelta = 0; Yoff = YoffBase; }
     82        Ydelta --;
     83        Yoff -= 0.75*currentscale*dY;
    7684        continue;
    7785      }
     
    7987        SetRotFont (currentname, (int)(0.8*currentsize));
    8088        currentfont = GetRotFontData (&currentscale);
    81         Yoff += 0.5*currentscale*dY;
     89
     90        if (Ydelta < 0) { Ydelta = 0; Yoff = YoffBase; }
     91        Ydelta ++;
     92        Yoff += 0.75*currentscale*dY;
    8293        continue;
    8394      }
     
    8697        currentfont = GetRotFontData (&currentscale);
    8798        Yoff = YoffBase;
     99        Ydelta = 0;
    88100        continue;
    89101      }
Note: See TracChangeset for help on using the changeset viewer.