850 PLFLT *t = args->xform, tt[4];
851 PLFLT theta, shear, stride;
855 PostscriptDocument *doc = (PostscriptDocument *)
pls->psdoc;
861 #define PROC_STR_STRING_LENGTH 1000
864 float font_factor = 1.4;
865 PLINT clxmin, clxmax, clymin, clymax;
866 PLINT clipx[4], clipy[4];
868 PLFLT scale = 1., up = 0.;
870 double lineSpacing, xAdvance, ymintmp, ymaxtmp, ymin, ymax, xmin, xmax;
874 if ( args->unicode_array_len > 0 )
882 unsigned char fontfamily, fontstyle, fontweight;
883 PLFLT old_sscale, sscale, old_soffset, soffset, dup;
903 fprintf( stderr,
"fci = 0x%x, font name pointer = NULL \n", fci );
904 plabort(
"proc_str: FCI inconsistent with TrueTypeLookup; "
905 "internal PLplot error" );
909 cur_text = args->unicode_array;
910 for ( f = s = j = 0; j < args->unicode_array_len; j++ )
926 if ( fonts[f] == NULL )
928 fprintf( stderr,
"string-supplied FCI = 0x%x, font name pointer = NULL \n", cur_text[j] );
929 plabort(
"proc_str: string-supplied FCI inconsistent with font lookup;" );
954 ft_ht =
pls->chrht * 72.0 / 25.4;
961 tt[0] = t[0] * cs + t[2] * sn;
962 tt[1] = t[1] * cs + t[3] * sn;
963 tt[2] = -t[0] * sn + t[2] * cs;
964 tt[3] = -t[1] * sn + t[3] * cs;
978 if ( args->base == 2 )
980 else if ( args->base == 1 )
983 offset = -
ENLARGE * ft_ht / 2.;
986 theta -=
PI / 2. *
pls->diorot;
987 args->y += (int) ( offset * cos( theta ) );
988 args->x -= (int) ( offset * sin( theta ) );
992 &( args->x ), &( args->y ) );
999 clipx[0] =
pls->clpxmi;
1000 clipx[2] =
pls->clpxma;
1001 clipy[0] =
pls->clpymi;
1002 clipy[2] =
pls->clpyma;
1003 clipx[1] = clipx[2];
1004 clipy[1] = clipy[0];
1005 clipx[3] = clipx[0];
1006 clipy[3] = clipy[2];
1007 difilt( clipx, clipy, 4, &clxmin, &clxmax, &clymin, &clymax );
1009 &clipx[0], &clipy[0] );
1011 &clipx[1], &clipy[1] );
1013 &clipx[2], &clipy[2] );
1015 &clipx[3], &clipy[3] );
1016 doc->osBody() <<
" gsave " << clipx[0] <<
" " << clipy[0] <<
" " <<
1017 clipx[1] <<
" " << clipy[1] <<
" " << clipx[2] <<
" " <<
1018 clipy[2] <<
" " << clipx[3] <<
" " << clipy[3] <<
" CL\n";
1021 doc->osBody() <<
" " << args->x <<
" " << args->y <<
" M\n";
1024 doc->osBody() <<
"gsave " <<
TRMFLT( theta * 180. /
PI ) <<
" R\n";
1026 doc->osBody() <<
"[" <<
TRMFLT( tt[0] ) <<
" " <<
TRMFLT( tt[2] ) <<
" " <<
TRMFLT( tt[1] )
1027 <<
" " <<
TRMFLT( tt[3] ) <<
" 0 0] concat\n";
1038 if ( *cur_strp == esc )
1042 if ( *cur_strp == esc )
1044 *strp++ = *cur_strp++;
1046 else if ( *cur_strp ==
'f' )
1049 if ( *cur_strp++ !=
'f' )
1053 plabort(
"proc_str, internal PLplot logic error;"
1054 "wrong escf escape sequence" );
1059 weight = weights[f];
1064 switch ( *cur_strp++ )
1069 &old_sscale, &sscale, &old_soffset, &soffset );
1075 dup = -0.5 * ( 1.0 - sscale );
1082 &old_sscale, &sscale, &old_soffset, &soffset );
1088 dup = 0.5 * ( 1.0 - sscale );
1098 plwarn(
"'+', '-', and 'b/B' text escape sequences not processed." );
1106 while ( *cur_strp && *cur_strp != esc )
1108 *strp++ = *cur_strp++;
1115 doc->setFont( font, style, weight );
1116 doc->setFontSize( font_factor *
ENLARGE * ft_ht * scale );
1117 doc->get_dimensions( (
const char *) str, &lineSpacing, &xAdvance, &ymintmp, &ymaxtmp );
1119 }
while ( *cur_strp );
1123 xmin = -xmax * args->just;
1134 doc->osBody() <<
" gsave " <<
TRMFLT( xmin * tt[0] ) <<
" " <<
1135 TRMFLT( xmin * tt[2] ) <<
" rmoveto\n";
1145 if ( *cur_strp == esc )
1149 if ( *cur_strp == esc )
1151 *strp++ = *cur_strp++;
1153 else if ( *cur_strp ==
'f' )
1156 if ( *cur_strp++ !=
'f' )
1160 plabort(
"proc_str, internal PLplot logic error;"
1161 "wrong escf escape sequence" );
1166 weight = weights[f];
1172 switch ( *cur_strp++ )
1177 &old_sscale, &sscale, &old_soffset, &soffset );
1183 dup = -0.5 * ( 1.0 - sscale );
1190 &old_sscale, &sscale, &old_soffset, &soffset );
1196 dup = 0.5 * ( 1.0 - sscale );
1206 plwarn(
"'+', '-', and 'b/B' text escape sequences not processed." );
1214 while ( *cur_strp && *cur_strp != esc )
1216 *strp++ = *cur_strp++;
1223 doc->setFont( font, style, weight );
1224 doc->setFontSize( font_factor *
ENLARGE * ft_ht * scale );
1225 doc->get_dimensions( (
const char *) str, &lineSpacing, &xAdvance, &ymintmp, &ymaxtmp );
1226 ymin =
MIN( ymintmp + up, ymin );
1227 ymax =
MAX( ymaxtmp + up, ymax );
1233 doc->osBody() <<
"gsave " <<
TRMFLT( up * tt[1] ) <<
" " <<
TRMFLT( up * tt[3] ) <<
" rmoveto\n";
1236 doc->osBody() << show( (
const char *) str );
1240 doc->osBody() <<
"grestore " <<
TRMFLT( xAdvance * tt[0] ) <<
" " <<
TRMFLT( xAdvance * tt[2] ) <<
" rmoveto\n";
1241 }
while ( *cur_strp );
1243 doc->osBody() <<
"grestore\n";
1244 doc->osBody() <<
"grestore\n";
1245 doc->osBody() <<
"grestore\n";
1253 xx[0] = (
PLINT) ( t[0] * xmin + t[1] * ymin );
1254 yy[0] = (
PLINT) ( t[2] * xmin + t[3] * ymin );
1255 xx[1] = (
PLINT) ( t[0] * xmin + t[1] * ymax );
1256 yy[1] = (
PLINT) ( t[2] * xmin + t[3] * ymax );
1257 xx[2] = (
PLINT) ( t[0] * xmax + t[1] * ymin );
1258 yy[2] = (
PLINT) ( t[2] * xmax + t[3] * ymin );
1259 xx[3] = (
PLINT) ( t[0] * xmax + t[1] * ymax );
1260 yy[3] = (
PLINT) ( t[2] * xmax + t[3] * ymax );
1268 xmin =
MIN(
MIN(
MIN( xx[0], xx[1] ), xx[2] ), xx[3] ) + args->x;
1269 xmax =
MAX(
MAX(
MAX( xx[0], xx[1] ), xx[2] ), xx[3] ) + args->x;
1270 ymin =
MIN(
MIN(
MIN( yy[0], yy[1] ), yy[2] ), yy[3] ) + args->y;
1271 ymax =
MAX(
MAX(
MAX( yy[0], yy[1] ), yy[2] ), yy[3] ) + args->y;
1273 dev->
llx = (int) (
MIN( dev->
llx, xmin ) );
1274 dev->
lly = (int) (
MIN( dev->
lly, ymin ) );
1275 dev->
urx = (int) (
MAX( dev->
urx, xmax ) );
1276 dev->
ury = (int) (
MAX( dev->
ury, ymax ) );