mgp_1.11b-3.dsc (NOT pgp-verified)
[alioth/magicpoint.git] / draw.c
diff --git a/draw.c b/draw.c
index 11eb46a..d9a8067 100644 (file)
--- a/draw.c
+++ b/draw.c
@@ -65,10 +65,7 @@ static struct pcache {
 static void process_direc __P((struct render_state *, int *));
 
 static int set_position __P((struct render_state *));
-static void draw_line_start __P((struct render_state *));
-void draw_line_itemsize __P((struct render_state *, int, int, int));
 static void draw_line_output __P((struct render_state *, char *));
-static void draw_line_end __P((struct render_state *));
 static void cutin __P((struct render_state *, int, int, int));
 #if 0
 static void shrink __P((char *, u_int));
@@ -573,6 +570,13 @@ process_direc(state, seenpause)
 
        case CTL_FORE:
                fore_color[caching] = cp->ctl_value;
+#ifdef USE_M17N
+               if (! (mgp_flag & FL_NOM17N))
+                 {
+                   M17N_set_color (cp->ctl_value);
+                   break;
+                 }
+#endif
                XSetForeground(display, gcfore, fore_color[caching]);
                break;
 
@@ -628,6 +632,13 @@ process_direc(state, seenpause)
 #endif /*FREETYPE*/
 
        case CTL_XFONT2:
+#ifdef USE_M17N
+               if (! (mgp_flag & FL_NOM17N))
+                 {
+                   M17N_set_font (cp->ctc2_value1, cp->ctc2_value2);
+                   break;
+                 }
+#endif
                x_registerseed(state, cp->ctc2_value1, cp->ctc2_value2);
                break;
 
@@ -718,6 +729,15 @@ process_direc(state, seenpause)
                p = (state->tabprefix) ? state->tabprefix : state->curprefix;
                if (!p)
                        break;
+#ifdef USE_M17N
+               if (! (mgp_flag & FL_NOM17N))
+                 {
+                   cp->ct_op = CTL_TEXT;
+                   cp->ctc_value = p;
+                   M17N_draw_string (state, cp);
+                   break;
+                 }
+#endif
                draw_line_output(state, p);
                break;
            }
@@ -729,6 +749,13 @@ process_direc(state, seenpause)
                        state->align = AL_LEFTFILL1;
                        state->leftfillpos = state->linewidth;
                }
+#ifdef USE_M17N
+               if (! (mgp_flag & FL_NOM17N))
+                 {
+                   M17N_draw_string (state, cp);
+                   break;
+                 }
+#endif
                draw_line_output(state, cp->ctc_value);
                break;
 
@@ -952,7 +979,7 @@ set_position(state)
        return x;
 }
 
-static void
+void
 draw_line_start(state)
        struct render_state *state;
 {
@@ -1003,17 +1030,10 @@ draw_line_output(state, data)
        struct render_state *state;
        char *data;
 {
-#ifdef USE_M17N
-       if (mgp_flag & FL_NOM17N)
-               draw_string(state, data);
-       else
-               M17N_draw_string(state, data);
-#else
        draw_string(state, data);
-#endif
 }
 
-static void
+void
 draw_line_end(state)
        struct render_state *state;
 {
@@ -1313,12 +1333,6 @@ draw_fragment(state, p, len, registry, charset16)
        enum { MODE_UNKNOWN, MODE_X, MODE_VFLIB, MODE_FREETYPE }
                mode = MODE_UNKNOWN;
        char *p0;
-#ifdef USE_M17N
-       if (!(mgp_flag & FL_NOM17N)){
-               p0 = M17N_draw_fragment(state, p, len);
-               if (p0) return p0;
-       }
-#endif
 #ifdef USE_XFT2
        if (!(mgp_flag & FL_NOXFT)){
                p0 = xft_draw_fragment(state, p, len, registry, charset16);
@@ -4922,10 +4936,11 @@ xft_setfont(xfontarg, csize, registry)
 }
 #endif
 #ifdef USE_M17N
-obj_new_mtext(state, x, y, mt, drawframe, ascent, descent)
+obj_new_mtext(state, x, y, mt, from, to, drawframe, ascent, descent)
        struct render_state *state;
        int x, y;
        MText *mt;
+       int from, to;
        MFrame *drawframe;      
        int ascent, descent;
 {
@@ -4941,8 +4956,10 @@ obj_new_mtext(state, x, y, mt, drawframe, ascent, descent)
        obj->descent = descent;
        obj->vertloc = VL_BASE;
        obj->data.m17ntext.mt = mt;
+       m17n_object_ref (mt);
        obj->data.m17ntext.drawframe = drawframe;
-       obj->data.m17ntext.len = mtext_len(mt);
+       obj->data.m17ntext.from = from;
+       obj->data.m17ntext.to = to;
        return 1;
 }
 #endif