From: <hba...@us...> - 2009-03-22 05:38:54
|
Revision: 9768 http://plplot.svn.sourceforge.net/plplot/?rev=9768&view=rev Author: hbabcock Date: 2009-03-22 05:38:51 +0000 (Sun, 22 Mar 2009) Log Message: ----------- Initial commit of a branch to explore refactoring text handling. The hope is to make unicode text handling easier from the perspective of the driver by moving much of the logic that is being repeated in many of the drivers into PLplot core. Modified Paths: -------------- branches/hbabcock/bindings/octave/demos/x27c.m branches/hbabcock/bindings/octave/demos/x28c.m branches/hbabcock/bindings/octave/demos/x30c.m branches/hbabcock/drivers/cairo.c branches/hbabcock/examples/c++/x27.cc branches/hbabcock/examples/f95/x25f.f90 branches/hbabcock/examples/f95/x26f.f90 branches/hbabcock/examples/f95/x27f.f90 branches/hbabcock/examples/java/x27.java branches/hbabcock/examples/tcl/x23 branches/hbabcock/examples/tcl/x24 branches/hbabcock/examples/tcl/x28 branches/hbabcock/examples/tcl/x29 branches/hbabcock/include/disptab.h branches/hbabcock/include/plplotP.h branches/hbabcock/include/plstrm.h branches/hbabcock/src/plcore.c Added Paths: ----------- branches/hbabcock/ Property changes on: branches/hbabcock ___________________________________________________________________ Added: svn:ignore + .import configure confdefs.h config.cache config.log config.status config.summary Makefile Makefile.in aclocal.m4 libtool *.tar.gz libltdl plplot_libtool autom4te.cache COPYING py-compile plplot.pc plplot-double.pc config.h config.h.in jadeout.log stamp-h1 .dsl .htm .out .xml CMakeCache.txt CMakeFiles cmake_install.cmake Added: svn:mergeinfo + Modified: branches/hbabcock/bindings/octave/demos/x27c.m =================================================================== --- trunk/bindings/octave/demos/x27c.m 2009-03-21 18:55:53 UTC (rev 9767) +++ branches/hbabcock/bindings/octave/demos/x27c.m 2009-03-22 05:38:51 UTC (rev 9768) @@ -1,4 +1,4 @@ -## $Id:$ +## $Id$ ## ## Drawing "spirograph" curves - epitrochoids, cycolids, roulettes ## Modified: branches/hbabcock/bindings/octave/demos/x28c.m =================================================================== --- trunk/bindings/octave/demos/x28c.m 2009-03-21 18:55:53 UTC (rev 9767) +++ branches/hbabcock/bindings/octave/demos/x28c.m 2009-03-22 05:38:51 UTC (rev 9768) @@ -1,4 +1,4 @@ -## $Id:$ +## $Id$ ## ## plmtex3, plptex3 demo ## Modified: branches/hbabcock/bindings/octave/demos/x30c.m =================================================================== --- trunk/bindings/octave/demos/x30c.m 2009-03-21 18:55:53 UTC (rev 9767) +++ branches/hbabcock/bindings/octave/demos/x30c.m 2009-03-22 05:38:51 UTC (rev 9768) @@ -1,4 +1,4 @@ -## $Id:$ +## $Id$ ## ## Alpha color values demonstration. ## Modified: branches/hbabcock/drivers/cairo.c =================================================================== --- trunk/drivers/cairo.c 2009-03-21 18:55:53 UTC (rev 9767) +++ branches/hbabcock/drivers/cairo.c 2009-03-22 05:38:51 UTC (rev 9768) @@ -86,6 +86,9 @@ short text_anti_aliasing; short graphics_anti_aliasing; PLFLT downscale; + char *pangoMarkupString; + short upDown; + float fontSize; #if defined(PLD_xcairo) short exit_event_loop; Display *XDisplay; @@ -215,7 +218,12 @@ void plD_tidy_cairo (PLStream *); void plD_line_cairo (PLStream *, short, short, short, short); void plD_polyline_cairo (PLStream *, short *, short *, PLINT); +void plD_textbgn_cairo (PLStream *, EscText *); +void plD_textchr_cairo (PLStream *, EscText *); +void plD_textesc_cairo (PLStream *, PLINT, EscText *); +void plD_textend_cairo (PLStream *, EscText *); + /*---------------------------------------------------------------------- plD_bop_cairo() @@ -341,13 +349,195 @@ case PLESC_FILL: /* filled polygon */ filled_polygon(pls, pls->dev_x, pls->dev_y, pls->dev_npts); break; - case PLESC_HAS_TEXT: /* render rext */ + + /* + case PLESC_HAS_TEXT: /* render rext proc_str(pls, (EscText *) ptr); break; + */ } } /*--------------------------------------------------------------------- + plD_textbgn_cairo() + + Begin text. + ---------------------------------------------------------------------*/ + +void plD_textbgn_cairo(PLStream *pls, EscText *args) +{ + int i; + PLCairo *aStream; + + aStream = (PLCairo *)pls->dev; + aStream->upDown = 0; + aStream->pangoMarkupString = (char *) malloc (sizeof(char) * MAX_MARKUP_LEN); + aStream->fontSize = pls->chrht * DPI/25.4; + for(i = 0; i < MAX_MARKUP_LEN; i++){ + aStream->pangoMarkupString[i] = 0; + } + open_span_tag(aStream->pangoMarkupString, args->n_fci, aStream->fontSize, 0); +} + +/*--------------------------------------------------------------------- + plD_textchr_cairo() + + Add text. + ---------------------------------------------------------------------*/ + +void plD_textchr_cairo(PLStream *pls, EscText *args) +{ + char utf8[5]; + PLCairo *aStream; + + aStream = (PLCairo *)pls->dev; + /* make sure we are not too close to the end of the string */ + if(strlen(aStream->pangoMarkupString) < (MAX_MARKUP_LEN - 50)){ + switch (args->n_char) + { + case 38: + strncat(aStream->pangoMarkupString, "&", MAX_MARKUP_LEN-1-strlen(aStream->pangoMarkupString)); + break; + case 60: + strncat(aStream->pangoMarkupString, "<", MAX_MARKUP_LEN)-1-strlen(aStream->pangoMarkupString); + break; + case 62: + strncat(aStream->pangoMarkupString, ">", MAX_MARKUP_LEN-1-strlen(aStream->pangoMarkupString)); + break; + default: + ucs4_to_utf8(args->n_char,utf8); + strncat(aStream->pangoMarkupString, utf8, MAX_MARKUP_LEN-1-strlen(aStream->pangoMarkupString)); + break; + } + } +} + +/*--------------------------------------------------------------------- + plD_textesc_cairo() + + A font change, superscript, subscript, etc... + ---------------------------------------------------------------------*/ + +void plD_textesc_cairo(PLStream *pls, PLINT op, EscText *args) +{ + PLCairo *aStream; + + aStream = (PLCairo *)pls->dev; + switch(op) + { + case PL_FONTCHANGE: + close_span_tag(aStream->pangoMarkupString, aStream->upDown); + open_span_tag(aStream->pangoMarkupString, args->n_fci, aStream->fontSize, aStream->upDown); + break; + case PL_SUPERSCRIPT: + if(aStream->upDown < 0){ + strncat(aStream->pangoMarkupString, "</sub>", MAX_MARKUP_LEN-1-strlen(aStream->pangoMarkupString)); + } else { + strncat(aStream->pangoMarkupString, "<sup>", MAX_MARKUP_LEN-1-strlen(aStream->pangoMarkupString)); + } + aStream->upDown++; + break; + case PL_SUBSCRIPT: + if(aStream->upDown > 0){ + strncat(aStream->pangoMarkupString, "</sup>", MAX_MARKUP_LEN-1-strlen(aStream->pangoMarkupString)); + } else { + strncat(aStream->pangoMarkupString, "<sub>", MAX_MARKUP_LEN-1-strlen(aStream->pangoMarkupString)); + } + aStream->upDown--; + break; + } +} + +/*--------------------------------------------------------------------- + plD_textend_cairo() + + Draw the text and clean up. + ---------------------------------------------------------------------*/ + +void plD_textend_cairo(PLStream *pls, EscText *args) +{ + int textXExtent, textYExtent; + char *textWithPangoMarkup; + PLFLT rotation, shear, stride, cos_rot, sin_rot, cos_shear, sin_shear; + cairo_matrix_t *cairoTransformMatrix; + cairo_font_options_t *cairoFontOptions; + PangoContext *context; + PangoLayout *layout; + PangoFontDescription *fontDescription; + PLCairo *aStream; + + aStream = (PLCairo *)pls->dev; + + /* Close the last span tag. */ + close_span_tag(aStream->pangoMarkupString, aStream->upDown); + /* printf("%s\n", aStream->pangoMarkupString); */ + + /* Create the Pango text layout so we can figure out how big it is */ + layout = pango_cairo_create_layout(aStream->cairoContext); + pango_layout_set_markup(layout, aStream->pangoMarkupString, -1); + pango_layout_get_pixel_size(layout, &textXExtent, &textYExtent); + + /* Set font aliasing */ + context = pango_layout_get_context(layout); + cairoFontOptions = cairo_font_options_create(); + cairo_font_options_set_antialias(cairoFontOptions, aStream->text_anti_aliasing); + pango_cairo_context_set_font_options(context, cairoFontOptions); + pango_layout_context_changed(layout); + cairo_font_options_destroy(cairoFontOptions); + + /* Save current transform matrix & clipping region */ + cairo_save(aStream->cairoContext); + + /* Set up the clipping region if we are doing text clipping */ + if(aStream->text_clipping){ + cairo_rectangle(aStream->cairoContext, aStream->downscale * pls->clpxmi, aStream->downscale * pls->clpymi, aStream->downscale * (pls->clpxma - pls->clpxmi), aStream->downscale * (pls->clpyma - pls->clpymi)); + cairo_clip(aStream->cairoContext); + } + + /* Move to the string reference point */ + cairo_move_to(aStream->cairoContext, aStream->downscale * (double) args->x, aStream->downscale * (double) args->y); + + /* Invert the coordinate system so that the text is drawn right side up */ + cairoTransformMatrix = (cairo_matrix_t *) malloc (sizeof(cairo_matrix_t)); + cairo_matrix_init(cairoTransformMatrix, 1.0, 0.0, 0.0, -1.0, 0.0, 0.0); + cairo_transform(aStream->cairoContext, cairoTransformMatrix); + + /* Extract rotation angle and shear from the PLplot tranformation matrix. + Compute sines and cosines of the angles as an optimization. */ + plRotationShear(args->xform, &rotation, &shear, &stride); + rotation -= pls->diorot * 3.14159 / 2.0; + cos_rot = cos(rotation); + sin_rot = sin(rotation); + cos_shear = cos(shear); + sin_shear = sin(shear); + + /* Apply the transform matrix */ + cairo_matrix_init(cairoTransformMatrix, + cos_rot * stride, + -sin_rot * stride, + cos_rot * sin_shear + sin_rot * cos_shear, + -sin_rot * sin_shear + cos_rot * cos_shear, + 0,0); + cairo_transform(aStream->cairoContext, cairoTransformMatrix); + free(cairoTransformMatrix); + + /* Move to the text starting point */ + cairo_rel_move_to(aStream->cairoContext, + (double)(-1.0 * args->just * (double)textXExtent), + (double)(-0.5 * textYExtent)); + + /* Render the text */ + pango_cairo_show_layout(aStream->cairoContext, layout); + + /* Restore the transform matrix to its state prior to the text transform. */ + cairo_restore(aStream->cairoContext); + + /* Free the layout object and the markup string. */ + g_object_unref(layout); + free(aStream->pangoMarkupString); +} + +/*--------------------------------------------------------------------- proc_str() Processes strings for display. @@ -667,6 +857,7 @@ pls->color = 1; /* Supports color */ pls->dev_text = 1; /* Handles text */ pls->dev_unicode = 1; /* Wants unicode text */ + pls->new_unicode = 1; /* Use the new unicode text display mode */ pls->page = 0; pls->dev_fill0 = 1; /* Supports hardware solid fills */ pls->plbuf_write = 1; /* Activate plot buffer */ @@ -904,6 +1095,10 @@ pdt->pl_tidy = (plD_tidy_fp) plD_tidy_xcairo; pdt->pl_state = (plD_state_fp) plD_state_cairo; pdt->pl_esc = (plD_esc_fp) plD_esc_xcairo; + pdt->pl_textbgn = (plD_textbgn_fp) plD_textbgn_cairo; + pdt->pl_textchr = (plD_textchr_fp) plD_textchr_cairo; + pdt->pl_textesc = (plD_textesc_fp) plD_textesc_cairo; + pdt->pl_textend = (plD_textend_fp) plD_textend_cairo; } /*--------------------------------------------------------------------- @@ -1081,9 +1276,11 @@ case PLESC_FILL: /* filled polygon */ filled_polygon(pls, pls->dev_x, pls->dev_y, pls->dev_npts); break; - case PLESC_HAS_TEXT: /* render rext */ + /* + case PLESC_HAS_TEXT: render rext proc_str(pls, (EscText *) ptr); break; + */ case PLESC_FLUSH: /* forced update of the window */ XFlush(aStream->XDisplay); break; Modified: branches/hbabcock/examples/c++/x27.cc =================================================================== --- trunk/examples/c++/x27.cc 2009-03-21 18:55:53 UTC (rev 9767) +++ branches/hbabcock/examples/c++/x27.cc 2009-03-22 05:38:51 UTC (rev 9768) @@ -1,5 +1,5 @@ //---------------------------------------------------------------------------// -// $Id:$ +// $Id$ // Drawing "spirograph" curves - epitrochoids, cycolids, roulettes //---------------------------------------------------------------------------// // Modified: branches/hbabcock/examples/f95/x25f.f90 =================================================================== --- trunk/examples/f95/x25f.f90 2009-03-21 18:55:53 UTC (rev 9767) +++ branches/hbabcock/examples/f95/x25f.f90 2009-03-22 05:38:51 UTC (rev 9768) @@ -1,4 +1,4 @@ -! $Id:$ +! $Id$ ! ! Filling and clipping polygons. ! Modified: branches/hbabcock/examples/f95/x26f.f90 =================================================================== --- trunk/examples/f95/x26f.f90 2009-03-21 18:55:53 UTC (rev 9767) +++ branches/hbabcock/examples/f95/x26f.f90 2009-03-22 05:38:51 UTC (rev 9768) @@ -1,6 +1,6 @@ ! -*- coding: utf-8; -*- ! -! $Id:$ +! $Id$ ! ! Multi-lingual version of the first page of example 4. ! Modified: branches/hbabcock/examples/f95/x27f.f90 =================================================================== --- trunk/examples/f95/x27f.f90 2009-03-21 18:55:53 UTC (rev 9767) +++ branches/hbabcock/examples/f95/x27f.f90 2009-03-22 05:38:51 UTC (rev 9768) @@ -1,4 +1,4 @@ -! $Id:$ +! $Id$ ! ! Drawing "spirograph" curves - epitrochoids, cycolids, roulettes ! Modified: branches/hbabcock/examples/java/x27.java =================================================================== --- trunk/examples/java/x27.java 2009-03-21 18:55:53 UTC (rev 9767) +++ branches/hbabcock/examples/java/x27.java 2009-03-22 05:38:51 UTC (rev 9768) @@ -1,5 +1,5 @@ //---------------------------------------------------------------------------// -// $Id:$ +// $Id$ // Drawing "spirograph" curves - epitrochoids, cycolids, roulettes //---------------------------------------------------------------------------// // Modified: branches/hbabcock/examples/tcl/x23 =================================================================== --- trunk/examples/tcl/x23 2009-03-21 18:55:53 UTC (rev 9767) +++ branches/hbabcock/examples/tcl/x23 2009-03-22 05:38:51 UTC (rev 9768) @@ -1,6 +1,6 @@ #!/bin/sh #--------------------------------*- Tcl -*------------------------------------# -# $Id:$ +# $Id$ # # Maurice LeBrun # 12/24/02 Modified: branches/hbabcock/examples/tcl/x24 =================================================================== --- trunk/examples/tcl/x24 2009-03-21 18:55:53 UTC (rev 9767) +++ branches/hbabcock/examples/tcl/x24 2009-03-22 05:38:51 UTC (rev 9768) @@ -1,6 +1,6 @@ #!/bin/sh #--------------------------------*- Tcl -*------------------------------------# -# $Id:$ +# $Id$ # # Maurice LeBrun # 12/24/02 Modified: branches/hbabcock/examples/tcl/x28 =================================================================== --- trunk/examples/tcl/x28 2009-03-21 18:55:53 UTC (rev 9767) +++ branches/hbabcock/examples/tcl/x28 2009-03-22 05:38:51 UTC (rev 9768) @@ -1,6 +1,6 @@ #!/bin/sh #--------------------------------*- Tcl -*------------------------------------# -# $Id:$ +# $Id$ # # Maurice LeBrun # 12/24/02 Modified: branches/hbabcock/examples/tcl/x29 =================================================================== --- trunk/examples/tcl/x29 2009-03-21 18:55:53 UTC (rev 9767) +++ branches/hbabcock/examples/tcl/x29 2009-03-22 05:38:51 UTC (rev 9768) @@ -1,6 +1,6 @@ #!/bin/sh #--------------------------------*- Tcl -*------------------------------------# -# $Id:$ +# $Id$ # # Maurice LeBrun # 12/24/02 Modified: branches/hbabcock/include/disptab.h =================================================================== --- trunk/include/disptab.h 2009-03-21 18:55:53 UTC (rev 9767) +++ branches/hbabcock/include/disptab.h 2009-03-22 05:38:51 UTC (rev 9768) @@ -9,6 +9,7 @@ #include "plConfig.h" struct PLStream_struct; +struct EscText; enum { plDevType_FileOriented = 0, @@ -73,20 +74,28 @@ typedef void (*plD_tidy_fp) (struct PLStream_struct *); typedef void (*plD_state_fp) (struct PLStream_struct *, PLINT); typedef void (*plD_esc_fp) (struct PLStream_struct *, PLINT, void *); +typedef void (*plD_textbgn_fp) (struct PLStream_struct *, struct EscText *); +typedef void (*plD_textchr_fp) (struct PLStream_struct *, struct EscText *); +typedef void (*plD_textesc_fp) (struct PLStream_struct *, PLINT, struct EscText *); +typedef void (*plD_textend_fp) (struct PLStream_struct *, struct EscText *); typedef struct { - const char *pl_MenuStr; - const char *pl_DevName; - int pl_type; - int pl_seq; - plD_init_fp pl_init; - plD_line_fp pl_line; - plD_polyline_fp pl_polyline; - plD_eop_fp pl_eop; - plD_bop_fp pl_bop; - plD_tidy_fp pl_tidy; - plD_state_fp pl_state; - plD_esc_fp pl_esc; + const char *pl_MenuStr; + const char *pl_DevName; + int pl_type; + int pl_seq; + plD_init_fp pl_init; + plD_line_fp pl_line; + plD_polyline_fp pl_polyline; + plD_eop_fp pl_eop; + plD_bop_fp pl_bop; + plD_tidy_fp pl_tidy; + plD_state_fp pl_state; + plD_esc_fp pl_esc; + plD_textbgn_fp pl_textbgn; + plD_textchr_fp pl_textchr; + plD_textesc_fp pl_textesc; + plD_textend_fp pl_textend; } PLDispatchTable; #endif /* __DISPATCH_H__ */ Modified: branches/hbabcock/include/plplotP.h =================================================================== --- trunk/include/plplotP.h 2009-03-21 18:55:53 UTC (rev 9767) +++ branches/hbabcock/include/plplotP.h 2009-03-22 05:38:51 UTC (rev 9768) @@ -319,6 +319,12 @@ #define PL_SFONT "plstnd4.fnt" #endif +/* Font changes, superscript and subscript. */ + +#define PL_FONTCHANGE 1 +#define PL_SUPERSCRIPT 2 +#define PL_SUBSCRIPT 3 + /*--------------------------------------------------------------------------*\ * The following environment variables are defined: * @@ -537,6 +543,8 @@ PLINT refx; /* processed ref. point--after justification, displacement, etc, processing */ PLINT refy; char font_face; /* font face OPTIONALLY used for rendering hershey codes */ + PLUNICODE n_fci; /* font storage for new unicode font handling */ + PLUNICODE n_char; /* character storage for new unicode font handling */ PLUNICODE unicode_char; /* an int to hold either a Hershey, ASC-II, or Unicode value for plsym calls */ PLUNICODE *unicode_array; /* a pointer to an array of ints holding either a Hershey, ASC-II, or Unicode value for cached plsym */ unsigned short unicode_array_len; Modified: branches/hbabcock/include/plstrm.h =================================================================== --- trunk/include/plstrm.h 2009-03-21 18:55:53 UTC (rev 9767) +++ branches/hbabcock/include/plstrm.h 2009-03-22 05:38:51 UTC (rev 9768) @@ -156,6 +156,7 @@ * dev_fill0 PLINT Set if driver can do solid area fills * dev_text PLINT Set if driver want to do it's only text drawing * dev_unicode PLINT Set if driver wants unicode + * new_unicode PLINT Set if driver wants to use the new unicode interface * dev_hrshsym PLINT Set for Hershey symbols to be used * dev_fill1 PLINT Set if driver can do pattern area fills * dev_dash PLINT Set if driver can do dashed lines @@ -704,6 +705,9 @@ /* Unicode section */ + /* The new unicode interface */ + PLINT new_unicode; + PLINT dev_unicode; PLUNICODE fci; Modified: branches/hbabcock/src/plcore.c =================================================================== --- trunk/src/plcore.c 2009-03-21 18:55:53 UTC (rev 9767) +++ branches/hbabcock/src/plcore.c 2009-03-22 05:38:51 UTC (rev 9768) @@ -249,6 +249,53 @@ (*plsc->dispatch_table->pl_esc) ((struct PLStream_struct *) plsc, op, ptr); } +/* "New" unicode text handling system + * + * This moves some of the text handling into PLplot core. + * + */ + +/* Begin text */ + +void +plP_textbgn(void *ptr) +{ + if(plsc->new_unicode){ + (*plsc->dispatch_table->pl_textbgn) ((struct PLStream_struct *) plsc, ptr); + } +} + +/* Add a character to the string */ + +void +plP_textchr(void *ptr) +{ + if(plsc->new_unicode){ + (*plsc->dispatch_table->pl_textchr) ((struct PLStream_struct *) plsc, ptr); + } +} + +/* Perform what in the past we would have referred to as a text esc function */ + +void +plP_textesc(PLINT op, void *ptr) +{ + if(plsc->new_unicode){ + (*plsc->dispatch_table->pl_textesc) ((struct PLStream_struct *) plsc, op, ptr); + } +} + +/* End text. At this point the driver should probably draw the string */ + +void +plP_textend(void *ptr) +{ + if(plsc->new_unicode){ + (*plsc->dispatch_table->pl_textend) ((struct PLStream_struct *) plsc, ptr); + } +} + + /* Set up plot window parameters. */ /* The plot buffer must be called first */ /* Some drivers (metafile, Tk) need access to this data */ @@ -538,7 +585,6 @@ unsigned char hexdigit, hexpower; /* Now process the text string */ - if (string!=NULL) { /* If the string isn't blank, then we will * continue */ @@ -555,10 +601,11 @@ * rid of the esc character sequence, just replacing it with * unicode. */ - /* Obtain FCI (font characterization integer) for start of * string. */ plgfci(&fci); + args.n_fci = fci; + plP_textbgn(&args); for (j=i=0;i<len;i++) { /* Walk through the string, and convert * some stuff to unicode on the fly */ skip=0; @@ -570,11 +617,16 @@ idx=plhershey2unicode(code); /* momentarily switch to symbol font. */ fcisave = fci; - plP_hex2fci(PL_FCI_SYMBOL, PL_FCI_FAMILY, &fci); + plP_hex2fci(PL_FCI_SYMBOL, PL_FCI_FAMILY, &fci); unicode_buffer[j++]= fci; unicode_buffer[j++] = \ (PLUNICODE)hershey_to_unicode_lookup_table[idx].Unicode; + args.n_fci = fci; + plP_textesc(PL_FONTCHANGE, &args); + args.n_char = \ + (PLUNICODE)hershey_to_unicode_lookup_table[idx].Unicode; + plP_textchr(&args); /* if unicode_buffer[j-1] corresponds to the escape * character must unescape it by appending one more. * This will probably always be necessary since it is @@ -595,6 +647,12 @@ plP_hex2fci(PL_FCI_SYMBOL, PL_FCI_FAMILY, &fci); unicode_buffer[j++]= fci; unicode_buffer[j++]=code; + + args.n_fci = fci; + plP_textesc(PL_FONTCHANGE, &args); + args.n_char = \ + (PLUNICODE)hershey_to_unicode_lookup_table[idx].Unicode; + plP_textchr(&args); /* if unicode_buffer[j-1] corresponds to the escape * character must unescape it by appending one more. * This will probably always be necessary since it is @@ -618,6 +676,8 @@ fci = code; unicode_buffer[j]=fci; skip=1; + args.n_fci = fci; + plP_textesc(PL_FONTCHANGE, &args); } else { /* code is not complete FCI. Change @@ -630,6 +690,8 @@ plP_hex2fci(hexdigit, hexpower, &fci); unicode_buffer[j]=fci; skip=1; + args.n_fci = fci; + plP_textesc(PL_FONTCHANGE, &args); } } @@ -639,6 +701,8 @@ plP_hex2fci(hexdigit, hexpower, &fci); unicode_buffer[j]=fci; skip=1; + args.n_fci = fci; + plP_textesc(PL_FONTCHANGE, &args); } } break; @@ -672,6 +736,8 @@ i+=2; unicode_buffer[j] = fci; skip = 1; + args.n_fci = fci; + plP_textesc(PL_FONTCHANGE, &args); } break; @@ -685,6 +751,8 @@ fcisave = fci; plP_hex2fci(PL_FCI_SYMBOL, PL_FCI_FAMILY, &fci); unicode_buffer[j++]= fci; + args.n_fci = fci; + plP_textesc(PL_FONTCHANGE, &args); ig = plP_strpos(plP_greek_mnemonic, string[i+2]); if (ig >= 0) { if (ig >= 24) @@ -692,6 +760,9 @@ idx=plhershey2unicode(ig+527); unicode_buffer[j++] = \ (PLUNICODE)hershey_to_unicode_lookup_table[idx].Unicode; + args.n_char = \ + (PLUNICODE)hershey_to_unicode_lookup_table[idx].Unicode; + plP_textchr(&args); i+=2; skip=1; /* skip is set if we have copied something * into the unicode table */ @@ -700,14 +771,33 @@ /* Use "unknown" unicode character if string[i+2] * is not in the Greek array.*/ unicode_buffer[j++]=(PLUNICODE)0x00; + args.n_char = (PLUNICODE)0x00; + plP_textchr(&args); i+=2; skip=1; /* skip is set if we have copied something * into the unicode table */ } fci = fcisave; unicode_buffer[j]= fci; + args.n_fci = fci; + plP_textesc(PL_FONTCHANGE, &args); break; - + + case 'u': + if(plsc->new_unicode){ + plP_textesc(PL_SUPERSCRIPT, &args); + i += 1; + skip = 1; + } + break; + + case 'd': + if(plsc->new_unicode){ + plP_textesc(PL_SUBSCRIPT, &args); + i += 1; + skip = 1; + } + break; } } @@ -736,7 +826,11 @@ if (unicode_buffer[j] == esc && string[i+1] == esc) { i++; unicode_buffer[++j] = esc; + args.n_char = esc; + } else { + args.n_char = unichar; } + plP_textchr(&args); } j++; } @@ -751,6 +845,7 @@ /* Don't print anything, if there is no unicode to print! */ return; } + plP_textend(&args); } if (plsc->dev_unicode) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |