106 for ( i = 0; i < n; i++ )
108 c_plptex( x[i], y[i], 1., 0., 0.5,
string );
128 if ( plsc->level < 3 )
130 plabort(
"plsym: Please set up window first" );
135 plabort(
"plsym: Invalid code" );
139 for ( i = 0; i < n; i++ )
169 PLINT i, sym, ifont = plsc->cfont;
172 if ( plsc->level < 3 )
174 plabort(
"plpoin: Please set up window first" );
177 if ( code < -1 || code > 127 )
179 plabort(
"plpoin: Invalid code" );
185 for ( i = 0; i < n; i++ )
199 for ( i = 0; i < n; i++ )
232 PLINT i, sym, ifont = plsc->cfont;
236 if ( plsc->level < 3 )
238 plabort(
"plpoin3: Please set up window first" );
241 if ( code < -1 || code > 127 )
243 plabort(
"plpoin3: Invalid code" );
247 plP_gdom( &xmin, &xmax, &ymin, &ymax );
252 for ( i = 0; i < n; i++ )
254 if ( x[i] >= xmin && x[i] <= xmax &&
255 y[i] >= ymin && y[i] <= ymax &&
256 z[i] >= zmin && z[i] <= zmax )
271 for ( i = 0; i < n; i++ )
273 if ( x[i] >= xmin && x[i] <= xmax &&
274 y[i] >= ymin && y[i] <= ymax &&
275 z[i] >= zmin && z[i] <= zmax )
312 if ( plsc->level < 3 )
314 plabort(
"plstring3: Please set up window first" );
318 plP_gdom( &xmin, &xmax, &ymin, &ymax );
321 for ( i = 0; i < n; i++ )
323 if ( x[i] >= xmin && x[i] <= xmax &&
324 y[i] >= ymin && y[i] <= ymax &&
325 z[i] >= zmin && z[i] <= zmax )
329 c_plptex( u, v, 1., 0., 0.5,
string );
363 if ( ( plsc->dev_text ) && ( plsc->dev_unicode ) && ( !plsc->dev_hrshsym ) )
375 if ( ( unicode_char == 0 ) || ( idx == -1 ) )
377 #ifndef PL_TEST_FOR_MISSING_GLYPHS
400 plhrsh_unicode_buffer[0] = unicode_char;
406 plhrsh_unicode_buffer[1] = unicode_char;
412 plsc->original_chrht = plsc->chrht;
413 plsc->original_chrdef = plsc->chrdef;
414 plsc->chrht = plsc->symht;
415 plsc->chrdef = plsc->symdef;
417 if ( plsc->alt_unicode )
421 args.
n_char = unicode_char;
431 plsc->chrht = plsc->original_chrht;
432 plsc->chrdef = plsc->original_chrdef;
450 PLINT cx, cy, k, penup, style;
451 signed char *vxygrid = 0;
456 scale = 0.05 * plsc->symht;
458 if ( !
plcvec( ch, &vxygrid ) )
471 xscale = scale * plsc->xpmm;
472 yscale = scale * plsc->ypmm;
479 if ( cx == 64 && cy == 64 )
490 else if ( cx == 64 && cy == 0 )
501 llx[l] =
ROUND( x + xscale * cx );
502 lly[l++] =
ROUND( y + yscale * cy );
508 llx[l] =
ROUND( x + xscale * cx );
509 lly[l++] =
ROUND( y + yscale * cy );
522 c_pllab(
const char *xlabel,
const char *ylabel,
const char *tlabel )
524 if ( plsc->level < 2 )
526 plabort(
"pllab: Please set up viewport first" );
570 PLINT clpxmi, clpxma, clpymi, clpyma;
572 PLFLT xdv, ydv, xmm, ymm, refxmm, refymm, shift,
xform[4];
576 if ( plsc->level < 2 )
578 plabort(
"plmtex: Please set up viewport first" );
584 plP_gclp( &clpxmi, &clpxma, &clpymi, &clpyma );
585 plP_sclp( plsc->sppxmi, plsc->sppxma, plsc->sppymi, plsc->sppyma );
590 xdv = plsc->vpdxmi + ( plsc->vpdxma - plsc->vpdxmi ) * pos;
598 xdv = plsc->vpdxmi + ( plsc->vpdxma - plsc->vpdxmi ) * pos;
606 xdv = plsc->vpdxmi + ( plsc->vpdxma - plsc->vpdxmi ) * pos;
614 xdv = plsc->vpdxmi + ( plsc->vpdxma - plsc->vpdxmi ) * pos;
623 ydv = plsc->vpdymi + ( plsc->vpdyma - plsc->vpdymi ) * pos;
631 ydv = plsc->vpdymi + ( plsc->vpdyma - plsc->vpdymi ) * pos;
639 ydv = plsc->vpdymi + ( plsc->vpdyma - plsc->vpdymi ) * pos;
647 ydv = plsc->vpdymi + ( plsc->vpdyma - plsc->vpdymi ) * pos;
653 plP_sclp( clpxmi, clpxma, clpymi, clpyma );
676 plgchr( &chrdef, &chrht );
677 shift = ( just == 0.0 ) ? 0.0 :
plstrl( text ) * just;
681 refxmm = xmm - shift * xform[0];
682 refymm = ymm - shift * xform[2];
691 plP_text( 0, just, xform, x, y, refx, refy, text );
692 plP_sclp( clpxmi, clpxma, clpymi, clpyma );
710 PLFLT xdv, ydv, xmm, ymm, refxmm, refymm, shift, cc, ss;
714 PLFLT wxt, wyt, dxt, dyt;
716 if ( plsc->level < 3 )
718 plabort(
"plptex: Please set up window first" );
724 TRANSFORM( wx + dx, wy + dy, &dxt, &dyt );
727 if ( dxt == 0.0 && dyt == 0.0 )
733 cc = plsc->wmxscl * dxt;
734 ss = plsc->wmyscl * dyt;
735 diag = sqrt( cc * cc + ss * ss );
752 plgchr( &chrdef, &chrht );
753 shift = ( just == 0.0 ) ? 0.0 :
plstrl( text ) * just;
757 refxmm = xmm - shift * xform[0];
758 refymm = ymm - shift * xform[2];
765 plP_text( 0, just, xform, x, y, refx, refy, text );
786 signed char *vxygrid = 0;
788 PLINT ch, i, length, level = 0, style, oline = 0, uline = 0;
789 PLFLT width = 0., xorg = 0., yorg = 0., def, ht, dscale, scale;
790 PLFLT old_sscale, sscale, old_soffset, soffset;
801 pldeco( &symbol, &length,
string );
803 for ( i = 0; i < length; i++ )
809 &old_sscale, &sscale, &old_soffset, &soffset );
810 yorg = 16.0 * dscale * soffset;
811 scale = dscale * sscale;
816 &old_sscale, &sscale, &old_soffset, &soffset );
817 yorg = -16.0 * dscale * soffset;
818 scale = dscale * sscale;
821 xorg -= width * scale;
828 if (
plcvec( ch, &vxygrid ) )
829 plchar( vxygrid, xform, base, oline, uline, refx, refy, scale,
830 plsc->xpmm, plsc->ypmm, &xorg, &yorg, &width );
847 PLINT xbase, ybase, ydisp, lx, ly, cx, cy;
853 *p_width = vxygrid[3] - xbase;
871 if ( cx == 64 && cy == 64 )
880 if ( cx == 64 && cy == 0 )
891 x = *p_xorg + ( cx - xbase ) * scale;
892 y = *p_yorg + ( cy - ybase ) * scale;
893 lx = refx +
ROUND( xpmm * ( xform[0] * x + xform[1] * y ) );
894 ly = refy +
ROUND( ypmm * ( xform[2] * x + xform[3] * y ) );
918 y = *p_yorg + ( 30 + ydisp ) * scale;
919 lx = refx +
ROUND( xpmm * ( xform[0] * x + xform[1] * y ) );
920 ly = refy +
ROUND( ypmm * ( xform[2] * x + xform[3] * y ) );
922 x = *p_xorg + *p_width * scale;
923 lx = refx +
ROUND( xpmm * ( xform[0] * x + xform[1] * y ) );
924 ly = refy +
ROUND( ypmm * ( xform[2] * x + xform[3] * y ) );
930 y = *p_yorg + ( -5 + ydisp ) * scale;
931 lx = refx +
ROUND( xpmm * ( xform[0] * x + xform[1] * y ) );
932 ly = refy +
ROUND( ypmm * ( xform[2] * x + xform[3] * y ) );
934 x = *p_xorg + *p_width * scale;
935 lx = refx +
ROUND( xpmm * ( xform[0] * x + xform[1] * y ) );
936 ly = refy +
ROUND( ypmm * ( xform[2] * x + xform[3] * y ) );
939 *p_xorg = *p_xorg + *p_width * scale;
952 signed char *vxygrid = 0;
953 PLINT ch, i, length, level = 0;
954 PLFLT width = 0., xorg = 0., dscale, scale, def, ht;
965 if ( plsc->has_string_length )
967 plsc->get_string_length = 1;
968 c_plmtex(
"t", 0.0, 0.0, 0.0,
string );
969 plsc->get_string_length = 0;
970 return (
PLFLT) plsc->string_length;
977 pldeco( &symbol, &length,
string );
979 for ( i = 0; i < length; i++ )
985 scale = dscale * pow( 0.75, (
double)
ABS( level ) );
990 scale = dscale * pow( 0.75, (
double)
ABS( level ) );
993 xorg -= width * scale;
994 else if ( ch == -4 || ch == -5 )
998 if (
plcvec( ch, &vxygrid ) )
1000 width = vxygrid[3] - vxygrid[2];
1001 xorg += width * scale;
1005 return (
PLFLT) xorg;
1035 }
while ( ( x != 64 || y != 64 ) && k <= (
STLEN - 2 ) );
1037 if ( k == (
STLEN - 1 ) )
1076 PLINT ch, ifont = plsc->cfont, ig, j = 0, lentxt = (
PLINT) strlen( text );
1090 while ( j < lentxt )
1096 if ( ch < 0 || ch > 175 )
1101 if ( ch == esc && ( lentxt - j ) >= 1 )
1107 else if ( test ==
'u' || test ==
'U' )
1108 sym[( *length )++] = -1;
1110 else if ( test ==
'd' || test ==
'D' )
1111 sym[( *length )++] = -2;
1113 else if ( test ==
'b' || test ==
'B' )
1114 sym[( *length )++] = -3;
1116 else if ( test ==
'+' )
1117 sym[( *length )++] = -4;
1119 else if ( test ==
'-' )
1120 sym[( *length )++] = -5;
1122 else if ( test ==
'(' )
1125 while (
'0' <= text[j] && text[j] <=
'9' )
1127 sym[*length] = (short) ( (
int) sym[*length] * 10 + text[j] -
'0' );
1131 if ( text[j] ==
')' )
1134 else if ( test ==
'f' || test ==
'F' )
1138 isupper( test ) ? tolower( test ) : test );
1142 else if ( test ==
'g' || test ==
'G' )
1154 sym[( *length )++] =
1188 if ( ( temp = strchr( str, chr ) ) )
1189 return (
PLINT) ( temp - str );
1203 PLINT base, str1ind, str2ind;
1205 for ( base = 0; *( str1 + base ) !=
'\0'; base++ )
1207 for ( str1ind = base, str2ind = 0; *( str2 + str2ind ) !=
'\0' &&
1208 *( str2 + str2ind ) == *( str1 + str1ind ); str1ind++, str2ind++ )
1211 if ( *( str2 + str2ind ) ==
'\0' )
1212 return (
PLINT) base;
1226 if ( strchr( str, chr ) )
1228 else if ( strchr( str, toupper( chr ) ) )
1281 *old_scale = *scale;
1282 *old_offset = *offset;
1284 if ( ( *level >= 0 && ifupper ) || ( *level <= 0 && !ifupper ) )
1287 *scale = 0.75 * *old_scale;
1288 *offset = *old_offset + *old_scale;
1293 *scale = *old_scale / 0.75;
1294 *offset = *old_offset - *scale;
1312 if ( plsc->level < 1 )
1314 plabort(
"plfont: Please call plinit first" );
1317 if ( ifont < 1 || ifont > 4 )
1319 plabort(
"plfont: Invalid font" );
1323 plsc->cfont = ifont;
1364 static PLINT charset;
1381 plexit(
"Unable to either (1) open/find or (2) allocate memory for the font file" );
1389 fntlkup = (
short int *) malloc( (
size_t) bffrleng *
sizeof (
short int ) );
1391 plexit(
"plfntld: Out of memory while allocating font buffer." );
1398 fntindx = (
short int *) malloc( (
size_t)
indxleng *
sizeof (
short int ) );
1400 plexit(
"plfntld: Out of memory while allocating font buffer." );
1408 fntbffr = (
signed char *) malloc( 2 * (
size_t) bffrleng *
sizeof (
signed char ) );
1410 plexit(
"plfntld: Out of memory while allocating font buffer." );
1412 #if PLPLOT_USE_TCL_CHANNELS
1413 pdf_rdx(
fntbffr,
sizeof (
signed char ) * (
size_t) ( 2 * bffrleng ), pdfs );
1416 (
size_t) ( 2 * bffrleng ), pdfs->
file );
1460 #ifdef SIMPLE_BUT_SAFE_HERSHEY_LOOKUP
1475 while ( jhi - jlo > 1 )
1481 jmid = ( jlo + jhi ) / 2;
1519 int jlo = -1, jmid, jhi = nlookup;
1520 while ( jhi - jlo > 1 )
1526 jmid = ( jlo + jhi ) / 2;
1527 if ( fci > lookup[jmid].fci )
1529 else if ( fci < lookup[jmid].fci )
1535 return (
const char *) ( lookup[jmid].
pfont );
1582 PLFLT chrdef, chrht;
1585 PLFLT xpc, ypc, xrefpc, yrefpc;
1586 PLFLT epx1 = 0.0, epy1 = 0.0, epx2 = 0.0, epy2 = 0.0, epx3 = 0.0, epy3 = 0.0;
1588 PLFLT shift, theta, temp;
1591 if ( plsc->level < 3 )
1593 plabort(
"plmtex3: Please set up window first" );
1598 plP_gdom( &xmin, &xmax, &ymin, &ymax );
1600 plgchr( &chrdef, &chrht );
1663 if ( ( epx2 - epx1 ) != 0.0 )
1665 theta = atan( ( epy2 - epy1 ) / ( epx2 - epx1 ) );
1681 dispy = disp * chrht;
1685 xpc = pos * ( epx2 - epx1 ) + epx1;
1686 ypc = pos * ( epy2 - epy1 ) + epy1;
1699 shift =
plstrl( text ) * just;
1704 yrefpc = ypc - shift;
1708 xrefpc = xpc - cos( theta ) * shift;
1709 yrefpc = ypc - sin( theta ) * shift;
1724 xform[1] = -cos( theta );
1726 xform[3] = -sin( theta );
1733 xform[0] = cos( theta );
1735 xform[2] = sin( theta );
1833 if ( ( epx3 - epx1 ) != 0.0 )
1835 theta = atan( ( epy3 - epy1 ) / ( epx3 - epx1 ) );
1851 dispx = -cos( theta ) * disp * chrht;
1852 dispy = -sin( theta ) * disp * chrht;
1856 if ( ( epx1 - epx3 ) != 0.0 )
1858 theta = -atan( ( epy3 - epy1 ) / ( epx1 - epx3 ) );
1872 dispx = cos( theta ) * disp * chrht;
1873 dispy = sin( theta ) * disp * chrht;
1879 ypc = pos * ( epy2 - epy1 ) + epy1;
1886 shift =
plstrl( text ) * just;
1890 xrefpc = xpc - cos( theta ) * shift;
1891 yrefpc = ypc - sin( theta ) * shift;
1896 yrefpc = ypc - shift;
1908 xform[0] = cos( theta );
1910 xform[2] = sin( theta );
1919 xform[1] = -cos( theta );
1921 xform[3] = -sin( theta );
1953 PLFLT xpc, ypc, xrefpc, yrefpc, xdpc, ydpc, xspc, yspc, ld, ls, cp, shift;
1954 PLFLT x_o, y_o, z_o, x_dx, y_dy, z_dz;
1955 PLFLT theta, phi, stride,
xform[6], affineL[6], cosphi;
1958 if ( plsc->level < 3 )
1960 plabort(
"plptex3: Please set up window first" );
1971 theta = atan2( ydpc - ypc, xdpc - xpc );
1983 if ( ( sx == 0.0 ) && ( sy == 0.0 ) && ( sz == 0.0 ) )
1991 ld = sqrt( ( xpc - xdpc ) * ( xpc - xdpc ) + ( ypc - ydpc ) * ( ypc - ydpc ) );
1992 ls = sqrt( ( xpc - xspc ) * ( xpc - xspc ) + ( ypc - yspc ) * ( ypc - yspc ) );
1993 phi = acos( ( ( xdpc - xpc ) * ( xspc - xpc ) + ( ydpc - ypc ) * ( yspc - ypc ) ) / ( ld * ls ) );
1994 cp = ( xdpc - xpc ) * ( yspc - ypc ) - ( ydpc - ypc ) * ( xspc - xpc );
1999 phi = 0.5 *
PI - phi;
2009 x_dx = x_o -
plP_w3wcx( wx + dx, wy + dy, wz + dz );
2010 y_dy = y_o -
plP_w3wcy( wx + dx, wy + dy, wz + dz );
2011 z_dz = z_o -
plP_w3wcz( wx + dx, wy + dy, wz + dz );
2013 stride = sqrt( x_dx * x_dx + y_dy * y_dy );
2014 stride = stride / sqrt( x_dx * x_dx + y_dy * y_dy + z_dz * z_dz );
2020 shift =
plstrl( text ) * just;
2021 xrefpc = xpc - cos( theta ) * shift * stride;
2022 yrefpc = ypc - sin( theta ) * shift * stride;
2044 cosphi = cos( phi );
2045 if ( fabs( cosphi ) > 1.e-300 )
2072 plwarn(
"plsfont: Value for family is out of range" );
2081 plwarn(
"plsfont: Value for style is out of range" );
2090 plwarn(
"plsfont: Value for weight is out of range" );
2116 *p_family = (
PLINT) val;
2122 *p_style = (
PLINT) val;
2128 *p_weight = (
PLINT) val;
void plP_script_scale(PLBOOL ifupper, PLINT *level, PLFLT *old_scale, PLFLT *scale, PLFLT *old_offset, PLFLT *offset)
int pdf_rdx(U_CHAR *x, long nitems, PDFstrm *pdfs)
PLFLT plstrl(const char *string)
void plP_esc(PLINT op, void *ptr)
void plP_fci2hex(PLUNICODE fci, unsigned char *phexdigit, unsigned char hexpower)
PLFLT plP_w3wcz(PLFLT x, PLFLT y, PLFLT z)
void c_plptex(PLFLT wx, PLFLT wy, PLFLT dx, PLFLT dy, PLFLT just, const char *text)
static void plhrsh2(PLINT ch, PLINT x, PLINT y)
void c_plstring(PLINT n, const PLFLT *x, const PLFLT *y, const char *string)
void c_plsym(PLINT n, const PLFLT *x, const PLFLT *y, PLINT code)
const char plP_greek_mnemonic[]
void c_plstring3(PLINT n, const PLFLT *x, const PLFLT *y, const PLFLT *z, const char *string)
static void pldeco(short int **sym, PLINT *length, const char *text)
subroutine plmtex(side, disp, pos, xjust, text)
static short int * fntindx
void plP_grange(PLFLT *p_zscl, PLFLT *p_zmin, PLFLT *p_zmax)
static void plchar(signed char *xygrid, PLFLT *xform, PLINT base, PLINT oline, PLINT uline, PLINT refx, PLINT refy, PLFLT scale, PLFLT xpmm, PLFLT ypmm, PLFLT *p_xorg, PLFLT *p_yorg, PLFLT *p_width)
int pdf_rd_2bytes(PDFstrm *pdfs, U_SHORT *ps)
static void plhrsh(PLINT ch, PLINT x, PLINT y)
PLBOOL plP_stsearch(const char *str, int chr)
void PLFLT PLINT PLINT PLFLT x
static short int numberfonts
void xform(PLFLT x, PLFLT y, PLFLT *tx, PLFLT *ty, PLPointer pltr_data)
void c_pllab(const char *xlabel, const char *ylabel, const char *tlabel)
int hershey2unicode(int in)
static short symbol_buffer[PLMAXSTR]
void plP_affine_multiply(PLFLT *affine_vectorA, const PLFLT *affine_vectorB, const PLFLT *affine_vectorC)
void plP_affine_yskew(PLFLT *affine_vector, PLFLT angle)
static PLINT plcvec(PLINT ch, signed char **xygr)
static const char font_types[]
PDFstrm * plLibOpenPdfstrm(const char *fn)
void plP_gclp(PLINT *p_ixmin, PLINT *p_ixmax, PLINT *p_iymin, PLINT *p_iymax)
PLINT plP_stindex(const char *str1, const char *str2)
void c_plmtex3(const char *side, PLFLT disp, PLFLT pos, PLFLT just, const char *text)
const char * plP_FCI2FontName(PLUNICODE fci, const FCI_to_FontName_Table lookup[], const int nlookup)
const unsigned char * pfont
void c_plptex3(PLFLT wx, PLFLT wy, PLFLT wz, PLFLT dx, PLFLT dy, PLFLT dz, PLFLT sx, PLFLT sy, PLFLT sz, PLFLT just, const char *text)
void c_plsfont(PLINT family, PLINT style, PLINT weight)
static signed char * fntbffr
void c_plgfont(PLINT *p_family, PLINT *p_style, PLINT *p_weight)
void plio_fread(void *buf, size_t size, size_t nmemb, FILE *stream)
static short int numberchars
void PLFLT PLINT PLINT PLFLT PLFLT y
#define TRANSFORM(x, y, xnew, ynew)
void c_plmtex(const char *side, PLFLT disp, PLFLT pos, PLFLT just, const char *text)
Hershey_to_Unicode_table hershey_to_unicode_lookup_table[]
void plP_affine_rotate(PLFLT *affine_vector, PLFLT angle)
PLFLT plP_w3wcy(PLFLT x, PLFLT y, PLFLT z)
unsigned short unicode_array_len
void plabort(const char *errormsg)
int plhershey2unicode(int in)
void plP_draphy(PLINT x, PLINT y)
PLINT plP_strpos(const char *str, int chr)
void c_plfont(PLINT ifont)
static short int * fntlkup
PLFLT plP_w3wcx(PLFLT x, PLFLT y, PLFLT PL_UNUSED(z))
int pdf_close(PDFstrm *pdfs)
void plP_draphy_poly(PLINT *x, PLINT *y, PLINT n)
void plwarn(const char *errormsg)
void plP_hex2fci(unsigned char hexdigit, unsigned char hexpower, PLUNICODE *pfci)
void plP_movphy(PLINT x, PLINT y)
void c_plpoin3(PLINT n, const PLFLT *x, const PLFLT *y, const PLFLT *z, PLINT code)
void c_plpoin(PLINT n, const PLFLT *x, const PLFLT *y, PLINT code)
int pdf_rd_2nbytes(PDFstrm *pdfs, U_SHORT *s, PLINT n)
void plP_sclp(PLINT ixmin, PLINT ixmax, PLINT iymin, PLINT iymax)
static short int indxleng
int number_of_entries_in_hershey_to_unicode_table
dx
if { $zoomopts($this,1) == 0 } then {
void plstr(PLINT base, PLFLT *xform, PLINT refx, PLINT refy, const char *string)
static signed char xygrid[STLEN]
PLUNICODE * unicode_array
void plP_affine_scale(PLFLT *affine_vector, PLFLT xscale, PLFLT yscale)
void plP_gdom(PLFLT *p_xmin, PLFLT *p_xmax, PLFLT *p_ymin, PLFLT *p_ymax)
void plP_text(PLINT base, PLFLT just, PLFLT *xform, PLINT x, PLINT y, PLINT refx, PLINT refy, const char *string)
void plexit(const char *errormsg)