The R Project SVN R

Rev

Rev 78742 | Rev 82986 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 78742 Rev 79696
Line 977... Line 977...
977
	    size_t res;
977
	    size_t res;
978
 
978
 
979
	    mbs_init(&mb_st);
979
	    mbs_init(&mb_st);
980
	    while (*s) {
980
	    while (*s) {
981
		wc = 0;
981
		wc = 0;
-
 
982
		// FIXME this does not allow for surrogate pairs (implausible)
982
		res = mbrtowc(&wc, s, MB_LEN_MAX, &mb_st);
983
		res = mbrtowc(&wc, s, MB_LEN_MAX, &mb_st);
983
		if(res == -1) error("invalid multibyte string '%s'", s);
984
		if(res == -1) error("invalid multibyte string '%s'", s);
984
		if (iswdigit(wc) && font != PlainFont) {
985
		if (iswdigit(wc) && font != PlainFont) {
985
		    font = PlainFont;
986
		    font = PlainFont;
986
		    SetFont(PlainFont, gc);
987
		    SetFont(PlainFont, gc);
Line 1089... Line 1090...
1089
	    size_t n = strlen(str), used;
1090
	    size_t n = strlen(str), used;
1090
	    wchar_t wc;
1091
	    wchar_t wc;
1091
	    const char *p = str;
1092
	    const char *p = str;
1092
	    mbstate_t mb_st;
1093
	    mbstate_t mb_st;
1093
	    mbs_init(&mb_st);
1094
	    mbs_init(&mb_st);
-
 
1095
	    // FIXME this does not allow for surrogate pairs
1094
	    while ((used = Mbrtowc(&wc, p, n, &mb_st)) > 0) {
1096
	    while ((used = Mbrtowc(&wc, p, n, &mb_st)) > 0) {
1095
		/* On Windows could have sign extension here */
1097
		/* On Windows could have sign extension here */
1096
		glyphBBox = GlyphBBox((unsigned int) wc, gc, dd);
1098
		glyphBBox = GlyphBBox((unsigned int) wc, gc, dd);
1097
		resultBBox = CombineBBoxes(resultBBox, glyphBBox);
1099
		resultBBox = CombineBBoxes(resultBBox, glyphBBox);
1098
		p += used; n -= used; nc++;
1100
		p += used; n -= used; nc++;