From: <hba...@us...> - 2009-04-26 20:01:34
|
Revision: 9856 http://plplot.svn.sourceforge.net/plplot/?rev=9856&view=rev Author: hbabcock Date: 2009-04-26 20:01:32 +0000 (Sun, 26 Apr 2009) Log Message: ----------- Added the new unicode text handling esc codes to the list of esc codes that are buffered by plbuf. Changed plysm to use the new unicode text handling pathway when requested by the driver. Modified Paths: -------------- trunk/src/plbuf.c trunk/src/plsym.c Modified: trunk/src/plbuf.c =================================================================== --- trunk/src/plbuf.c 2009-04-26 19:15:03 UTC (rev 9855) +++ trunk/src/plbuf.c 2009-04-26 20:01:32 UTC (rev 9856) @@ -308,6 +308,49 @@ } /*--------------------------------------------------------------------------*\ + * plbuf_text_unicode() + * + * Handle text buffering for the new unicode pathway. +\*--------------------------------------------------------------------------*/ + +static void +plbuf_text_unicode(PLStream *pls, EscText *text) +{ + PLUNICODE fci; + + dbug_enter("plbuf_text"); + + /* Retrieve the font characterization integer */ + plgfci(&fci); + + /* Write the text information */ + + wr_data(pls, &fci, sizeof(PLUNICODE)); + + wr_data(pls, &pls->chrht, sizeof(PLFLT)); + wr_data(pls, &pls->diorot, sizeof(PLFLT)); + wr_data(pls, &pls->clpxmi, sizeof(PLFLT)); + wr_data(pls, &pls->clpxma, sizeof(PLFLT)); + wr_data(pls, &pls->clpymi, sizeof(PLFLT)); + wr_data(pls, &pls->clpyma, sizeof(PLFLT)); + + wr_data(pls, &text->base, sizeof(PLINT)); + wr_data(pls, &text->just, sizeof(PLFLT)); + wr_data(pls, text->xform, sizeof(PLFLT) * 4); + wr_data(pls, &text->x, sizeof(PLINT)); + wr_data(pls, &text->y, sizeof(PLINT)); + wr_data(pls, &text->refx, sizeof(PLINT)); + wr_data(pls, &text->refy, sizeof(PLINT)); + + wr_data(pls, &text->n_fci, sizeof(PLUNICODE)); + wr_data(pls, &text->n_char, sizeof(PLUNICODE)); + wr_data(pls, &text->n_ctrl_char, sizeof(PLINT)); + + wr_data(pls, &text->unicode_array_len, sizeof(PLINT)); +} + + +/*--------------------------------------------------------------------------*\ * plbuf_esc() * * Escape function. Note that any data written must be in device @@ -344,6 +387,12 @@ if(ptr!=NULL) /* Check required by GCW driver, please don't remove */ plbuf_text(pls, (EscText *) ptr); break; + case PLESC_BEGIN_TEXT: + case PLESC_TEXT_CHAR: + case PLESC_CONTROL_CHAR: + case PLESC_END_TEXT: + plbuf_text_unicode(pls, (EscText *) ptr); + break; } } @@ -568,8 +617,12 @@ * * PLESC_FILL Fill polygon * PLESC_SWIN Set plot window parameters - * PLESC_IMAGE Draw image - * PLESC_HAS_TEXT Draw PostScript text + * PLESC_IMAGE Draw image + * PLESC_HAS_TEXT Draw PostScript text + * PLESC_BEGIN_TEXT Commands for the alternative unicode text handling path + * PLESC_TEXT_CHAR + * PLESC_CONTROL_CHAR + * PLESC_END_TEXT * PLESC_CLEAR Clear Background \*--------------------------------------------------------------------------*/ @@ -580,6 +633,9 @@ rdbuf_text(PLStream *pls); static void +rdbuf_text_unicode(PLINT op, PLStream *pls); + +static void rdbuf_esc(PLStream *pls) { U_CHAR op; @@ -601,10 +657,16 @@ case PLESC_HAS_TEXT: rdbuf_text(pls); break; + case PLESC_BEGIN_TEXT: + case PLESC_TEXT_CHAR: + case PLESC_CONTROL_CHAR: + case PLESC_END_TEXT: + rdbuf_text_unicode(op, pls); + break; case PLESC_CLEAR: plP_esc(PLESC_CLEAR,NULL); break; - } + } } /*--------------------------------------------------------------------------*\ @@ -762,6 +824,54 @@ } /*--------------------------------------------------------------------------*\ + * rdbuf_text_unicode() + * + * Draw text for the new unicode handling pathway. +\*--------------------------------------------------------------------------*/ + +static void +rdbuf_text_unicode(PLINT op, PLStream *pls) +{ + PLUNICODE(fci); + EscText text; + PLFLT xform[4]; + PLUNICODE* unicode; + + text.xform = xform; + + + /* Read in the data */ + + rd_data(pls, &fci, sizeof(PLUNICODE)); + + rd_data(pls, &pls->chrht, sizeof(PLFLT)); + rd_data(pls, &pls->diorot, sizeof(PLFLT)); + rd_data(pls, &pls->clpxmi, sizeof(PLFLT)); + rd_data(pls, &pls->clpxma, sizeof(PLFLT)); + rd_data(pls, &pls->clpymi, sizeof(PLFLT)); + rd_data(pls, &pls->clpyma, sizeof(PLFLT)); + + rd_data(pls, &text.base, sizeof(PLINT)); + rd_data(pls, &text.just, sizeof(PLFLT)); + rd_data(pls, text.xform, sizeof(PLFLT) * 4); + rd_data(pls, &text.x, sizeof(PLINT)); + rd_data(pls, &text.y, sizeof(PLINT)); + rd_data(pls, &text.refx, sizeof(PLINT)); + rd_data(pls, &text.refy, sizeof(PLINT)); + + rd_data(pls, &text.n_fci, sizeof(PLUNICODE)); + rd_data(pls, &text.n_char, sizeof(PLUNICODE)); + rd_data(pls, &text.n_ctrl_char, sizeof(PLINT)); + + rd_data(pls, &text.unicode_array_len, sizeof(PLINT)); + + if(pls->dev_unicode) { + plsfci(fci); + plP_esc(op,&text); + } +} + +/*--------------------------------------------------------------------------*\ * plRemakePlot() * * Rebuilds plot from plot buffer, usually in response to a window Modified: trunk/src/plsym.c =================================================================== --- trunk/src/plsym.c 2009-04-26 19:15:03 UTC (rev 9855) +++ trunk/src/plsym.c 2009-04-26 20:01:32 UTC (rev 9856) @@ -285,7 +285,15 @@ plsc->chrht=plsc->symht; plsc->chrdef=plsc->symdef; - plP_esc(PLESC_HAS_TEXT, &args); + if (plsc->alt_unicode){ + args.n_fci = fci; + args.n_char = unicode_char; + plP_esc(PLESC_BEGIN_TEXT, &args); + plP_esc(PLESC_TEXT_CHAR, &args); + plP_esc(PLESC_END_TEXT, &args); + } else { + plP_esc(PLESC_HAS_TEXT, &args); + } plsc->chrht=plsc->original_chrht; plsc->chrdef=plsc->original_chrdef; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |