[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: TeX output for UML diagrams [path]




Cyrille Chepelov wrote:

>Le dim, jan 06, 2002, à 12:34:53 +0200, Ruslan Shevchenko a écrit:
>
>>1. Small problem with printing UML diagram in TeX: TeX special symbols 
>>in names (such as #) are not escaped, as result TeX output
>>are not compiled by TeX.
>>So, I attach patch against dia-0.88.1
>>
>
>thanks for the patch ! It looks mostly good; I've not yet applied it, see 
>comments/questions below. But as it applies cleanly to CVS head, I don't see
>why wouldn't it go in.
>

I will send to list corrected path tomorow, if current utf8 workarounds 
will be accepted. (see below)

>[ ... ]
> 
>
>
>in all these loops, what happens if the input string is encoded in UTF-8 ? 
>
>(how does TeX behave when presented with UTF-8 data ? Can it even do that ?
> OK, I tease you, but I'd be very happy to learn how)
>

TeX itself - no.
omegaTeX (distributed with near all TeX distributions)
can handle utf16, will be handle utf8 and utf32 in near future.


So, ideal solution is:

 - insert dialog form for TeX pstricks export parameters.
   (Can I do this from plugin ? If yes - how ?)
    where ask output TeX encoding.
 - transform Utf8 to Utf16 for omegaTex or to some 8-bit
   encoding for normal TeX.
     \footnote{
        encoding of text is usially
        setted by \inputenc command in document preambule.
      }
   Extra questions:
   (what is the name of type for utf16 char and utf16 string ?
    are exists built-in in support libraries transform functions
    (utf8 -> utf16), or I
    can use code from unicode consorcium. ?
    are exists built-in in support libraries transform functions
    (utf8 -> encoding Name).
   )

   - in terms of 'soft-localization' code is Ok.
    (i. e. current code will work with utf8, but TeX will not be
able to interpet it correctly. )
So, I think current patch [ with TODO record ] will ok as
 short-term solution (it does not make thing worse), then when we
 will learn, how to do first approach, we will write extra code for
 handling of different TeX input encodings.





>
>>+ }
>>+ /* now alloc memory and print prefixed escaped string */
>>+ out_text = malloc(strlen(in_text)+extra_count+1);
>>
>
><nitpick>Please use gmalloc() here</nitpick>
>
>
>>+ out_cursor=out_text;
>>+ for(in_cursor=in_text;*in_cursor;) {
>>+   if (is_tex_escaped_symbol(*in_cursor,&prefix,&replace)) {
>>+     while(*prefix) *out_cursor++ = *prefix++;
>>+   }
>>+   if (!replace) {
>>+     *out_cursor++=*in_cursor++;
>>+   }else{
>>+     in_cursor++;
>>+   }
>>+ }
>>+ *out_cursor++='\0';
>>+ return out_text;
>>+}
>>+
>> static void
>> draw_string(RendererPSTRICKS *renderer,
>> 	    const char *text,
>> 	    Point *pos, Alignment alignment,
>> 	    Color *color)
>> {
>>+    char* tex_escaped_text;
>>+
>>     set_line_color(renderer,color);
>> 
>>     fprintf(renderer->file,"\\rput");
>>@@ -668,7 +746,12 @@
>> 	fprintf(renderer->file,"[r]");
>> 	break;
>>     }
>>-    fprintf(renderer->file,"(%f,%f){\\scalebox{1 -1}{%s}}\n",pos->x, pos->y,text);
>>+    
>>+    tex_escaped_text=create_tex_escaped_string(text); 
>>+
>>+    fprintf(renderer->file,"(%f,%f){\\scalebox{1 -1}{%s}}\n",pos->x, pos->y,tex_escaped_text);
>>+
>>+    free(tex_escaped_text);
>>
>
><nitpick>gfree()</nitpick>
>
>
>Thanks in advance !
>
>	-- Cyrille
>





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index] Mail converted by Mofo Magic and the Flying D

 
All trademarks and copyrights are the property of their respective owners.

Other Directory Sites: SeekWonder | Directory Owners Forum

GuideSMACK