| 1 |
@x |
| 2 |
#include <math.h> |
| 3 |
@y |
| 4 |
#include <math.h> |
| 5 |
#include <ptexenc/ptexenc.h> |
| 6 |
#ifdef UPMP |
| 7 |
#include <ptexenc/unicode.h> |
| 8 |
#endif |
| 9 |
@z |
| 10 |
|
| 11 |
@x |
| 12 |
@<Character |k| is not allowed in SVG output@>= |
| 13 |
(k=='&')||(k=='>')||(k=='<') |
| 14 |
@y |
| 15 |
@<Character |k| is not allowed in SVG output@>= |
| 16 |
(k=='&')||(k=='>')||(k=='<')||(k>=0x7F) |
| 17 |
@z |
| 18 |
|
| 19 |
@x |
| 20 |
@ Now for outputting the actual graphic objects. |
| 21 |
@y |
| 22 |
@ Now for outputting the actual graphic objects. |
| 23 |
|
| 24 |
@d yoko_jfm_id 11 /* `yoko-kumi' fonts */ |
| 25 |
@d tate_jfm_id 9 /* `tate-kumi' fonts */ |
| 26 |
@d font_jfm_p(A) (mp->font_id[(A)]!=0) |
| 27 |
@z |
| 28 |
|
| 29 |
@x Even if prologues=3, Japanese texts are not converted into paths. |
| 30 |
if (prologues == 3 ) { |
| 31 |
@y |
| 32 |
if (prologues == 3 && mp->font_id[gr_font_n(p)]==0) { |
| 33 |
@z |
| 34 |
|
| 35 |
@x To realise vertical Japanese texts ... |
| 36 |
mp_svg_attribute(mp, "font-size", mp->svg->buf); |
| 37 |
@y |
| 38 |
mp_svg_attribute(mp, "font-size", mp->svg->buf); |
| 39 |
if ( mp->font_id[gr_font_n(p)]==tate_jfm_id ) { |
| 40 |
mp_svg_reset_buf(mp); |
| 41 |
append_string("tb-rl"); |
| 42 |
mp_svg_attribute(mp, "writing-mode", mp->svg->buf); |
| 43 |
} |
| 44 |
@z |
| 45 |
|
| 46 |
@x |
| 47 |
while (l-->0) { |
| 48 |
@y |
| 49 |
if ( mp->font_id[gr_font_n(p)]!=0 ) { |
| 50 |
#ifdef UPMP |
| 51 |
if (is_internalUPTEX() ) { |
| 52 |
while (l>0) { |
| 53 |
append_string("&#"); |
| 54 |
mp_svg_store_int(mp,UTF8StoUCS(s)); |
| 55 |
append_char(';'); |
| 56 |
k = UTF8length((int)*s); s += k; l -= k; |
| 57 |
} |
| 58 |
} else /* 1 charatcer = 2 bytes */ |
| 59 |
#endif |
| 60 |
{ |
| 61 |
l >>= 1; |
| 62 |
while (l-->0) { |
| 63 |
k =((int)*s++)*0x100; k += (int)*s++; |
| 64 |
append_string("&#"); |
| 65 |
mp_svg_store_int(mp,toUCS(k)); |
| 66 |
append_char(';'); |
| 67 |
} |
| 68 |
} |
| 69 |
} else |
| 70 |
while (l-->0) { |
| 71 |
@z |
| 72 |
|
| 73 |
@x |
| 74 |
mp_svg_print(mp, "<?xml version=\"1.0\"?>"); |
| 75 |
@y |
| 76 |
mp_svg_print(mp, "<?xml version=\"1.0\" encoding=\"utf-8\"?>"); |
| 77 |
@z |