1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-07-03 04:22:47 -05:00

Change the unifont API so that text is passed right down to the

individual font implementation as wchar_t, rather than having to be
converted by the client into the appropriate MBCS/SBCS.

This also means I can remove 'real_charset' from the public-facing
contents of the unifont structure.

[originally from svn r9292]
This commit is contained in:
Simon Tatham
2011-09-16 19:18:53 +00:00
parent c8d943ed9d
commit 24bad48f00
3 changed files with 68 additions and 78 deletions

View File

@ -2138,28 +2138,12 @@ void do_text_internal(Context ctx, int x, int y, wchar_t *text, int len,
rlen*widefactor*inst->font_width, inst->font_height);
gdk_gc_set_foreground(gc, &inst->cols[nfg]);
{
gchar *gcs;
/*
* FIXME: this length is hardwired on the assumption that
* conversions from wide to multibyte characters will
* never generate more than 10 bytes for a single wide
* character.
*/
gcs = snewn(len*10+1, gchar);
for (combining = 0; combining < ncombining; combining++) {
int mblen = wc_to_mb(inst->fonts[fontid]->real_charset, 0,
text + combining, len, gcs, len*10+1, ".",
NULL, NULL);
unifont_draw_text(inst->pixmap, gc, inst->fonts[fontid],
x*inst->font_width+inst->window_border,
y*inst->font_height+inst->window_border+inst->fonts[0]->ascent,
gcs, mblen, widefactor > 1, bold, inst->font_width);
}
sfree(gcs);
for (combining = 0; combining < ncombining; combining++) {
unifont_draw_text(inst->pixmap, gc, inst->fonts[fontid],
x*inst->font_width+inst->window_border,
y*inst->font_height+inst->window_border+inst->fonts[0]->ascent,
text + combining, len, widefactor > 1,
bold, inst->font_width);
}
if (attr & ATTR_UNDER) {