X-Git-Url: http://git.chise.org/gitweb/?a=blobdiff_plain;f=src%2Fdraw.c;h=0d1d48b6b548e11e0bf82ae466388d7c68da9587;hb=032fa01988c08909d017f7e1ef922335a55fd7c5;hp=4ea2041e7f7fe255809ae66348f298dfe2f79eea;hpb=6fbf27a21d5913c10d8f2f6854e9ade434aa51b2;p=m17n%2Fm17n-lib.git diff --git a/src/draw.c b/src/draw.c index 4ea2041..0d1d48b 100644 --- a/src/draw.c +++ b/src/draw.c @@ -440,7 +440,11 @@ compose_glyph_string (MFrame *frame, MText *mt, int from, int to, NULL, prev->c) != MCHAR_INVALID_CODE)); start--, prev--) - prev->code = code; + if (prev->rface->rfont != this->rface->rfont) + { + prev->rface->rfont = this->rface->rfont; + prev->code = code; + } for (g++; (g->type == GLYPH_CHAR @@ -601,7 +605,10 @@ layout_glyphs (MFrame *frame, MGlyphString *gstring, int from, int to, if (base->left_padding && base->lbearing < 0) { base->xoff = - base->lbearing; - base->width += base->xoff; + if (base->rbearing < 0) + base->width = base->rbearing - base->lbearing; + else + base->width += base->xoff; base->rbearing += base->xoff; base->lbearing = 0; } @@ -609,9 +616,8 @@ layout_glyphs (MFrame *frame, MGlyphString *gstring, int from, int to, { base->width = base->rbearing; } - lbearing = (base->xoff + base->lbearing < 0 - ? base->xoff + base->lbearing : 0); - rbearing = base->xoff + base->rbearing; + lbearing = base->lbearing; + rbearing = base->rbearing; } else { @@ -1261,7 +1267,8 @@ render_glyphs (MFrame *frame, MDrawWindow win, int x, int y, int width, gend--; } if (g != gend) - while (gend[-1].to == gend->to) gend++; + while (gend->type != GLYPH_ANCHOR && gend[-1].to == gend->to) + gend++; } } @@ -1571,9 +1578,15 @@ truncate_gstring (MFrame *frame, MText *mt, MGlyphString *gstring) pos = gstring->to; } else if (i == 0) - pos++; - compose_glyph_string (frame, mt, gstring->from, pos, gstring); - layout_glyph_string (frame, gstring); + { + g = find_glyph_in_gstring (gstring, gstring->from, 1); + pos = g->to; + } + if (pos < gstring->to) + { + compose_glyph_string (frame, mt, gstring->from, pos, gstring); + layout_glyph_string (frame, gstring); + } } @@ -2650,7 +2663,8 @@ mdraw_glyph_info (MFrame *frame, MText *mt, int from, int pos, info->prev_from = g_tmp->pos; } - else if (info->line_from > 0) + else if (info->line_from > 0 + && gstring->from > 0) { /* The logically previous glyph is on the previous line. */ MGlyphString *gst = get_gstring (frame, mt, gstring->from - 1, @@ -2845,7 +2859,7 @@ mdraw_glyph_list (MFrame *frame, MText *mt, int from, int to, { glyphs->font = (MFont *) g->rface->rfont; glyphs->font_type - = (g->rface->rfont->font->type == MFONT_SOURCE_X ? Mx + = (glyphs->font->source == MFONT_SOURCE_X ? Mx : g->rface->rfont->driver == &mfont__ft_driver ? Mfreetype : Mxft); glyphs->fontp = g->rface->rfont->fontp;