The R Project SVN R

Rev

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

Rev 59167 Rev 59173
Line 1... Line 1...
1
/*
1
/*
2
 *  R : A Computer Language for Statistical Data Analysis
2
 *  R : A Computer Language for Statistical Data Analysis
3
 *  Copyright (C) 1995, 1996, 1997 Robert Gentleman and Ross Ihaka
3
 *  Copyright (C) 1995, 1996, 1997 Robert Gentleman and Ross Ihaka
4
 *  Copyright (C) 1998-2008	The R Core Team
4
 *  Copyright (C) 1998-2012	The R Core Team
5
 *
5
 *
6
 *  This source code module:
6
 *  This source code module:
7
 *  Copyright (C) 1997, 1998 Paul Murrell and Ross Ihaka
7
 *  Copyright (C) 1997, 1998 Paul Murrell and Ross Ihaka
8
 *  Copyright (C) 1998-2008	The R Core Team
8
 *  Copyright (C) 1998-2012	The R Core Team
9
 *
9
 *
10
 *  This program is free software; you can redistribute it and/or modify
10
 *  This program is free software; you can redistribute it and/or modify
11
 *  it under the terms of the GNU General Public License as published by
11
 *  it under the terms of the GNU General Public License as published by
12
 *  the Free Software Foundation; either version 2 of the License, or
12
 *  the Free Software Foundation; either version 2 of the License, or
13
 *  (at your option) any later version.
13
 *  (at your option) any later version.
Line 936... Line 936...
936
	prev = SetFont(PlainFont, gc);
936
	prev = SetFont(PlainFont, gc);
937
    else
937
    else
938
	prev = SetFont(SymbolFont, gc);
938
	prev = SetFont(SymbolFont, gc);
939
    bbox = GlyphBBox(ascii, gc, dd);
939
    bbox = GlyphBBox(ascii, gc, dd);
940
    if (draw) {
940
    if (draw) {
941
	asciiStr[0] = ascii;
941
	asciiStr[0] = (char) ascii;
942
	asciiStr[1] = '\0';
942
	asciiStr[1] = '\0';
943
	GEText(ConvertedX(mc ,dd), ConvertedY(mc, dd), asciiStr,
943
	GEText(ConvertedX(mc ,dd), ConvertedY(mc, dd), asciiStr,
944
	       CE_SYMBOL,
944
	       CE_SYMBOL,
945
	       0.0, 0.0, mc->CurrentAngle, gc,
945
	       0.0, 0.0, mc->CurrentAngle, gc,
946
	       dd);
946
	       dd);
Line 1061... Line 1061...
1061
	if(mbcslocale) {
1061
	if(mbcslocale) {
1062
	    size_t res = wcrtomb(asciiStr, ascii, NULL);
1062
	    size_t res = wcrtomb(asciiStr, ascii, NULL);
1063
	    if(res == -1)
1063
	    if(res == -1)
1064
		error("invalid character in current multibyte locale");
1064
		error("invalid character in current multibyte locale");
1065
	} else
1065
	} else
1066
	    asciiStr[0] = ascii;
1066
	    asciiStr[0] = (char) ascii;
1067
	GEText(ConvertedX(mc ,dd), ConvertedY(mc, dd), asciiStr, CE_NATIVE,
1067
	GEText(ConvertedX(mc ,dd), ConvertedY(mc, dd), asciiStr, CE_NATIVE,
1068
	       0.0, 0.0, mc->CurrentAngle, gc,
1068
	       0.0, 0.0, mc->CurrentAngle, gc,
1069
	       dd);
1069
	       dd);
1070
	PMoveAcross(bboxWidth(bbox), mc);
1070
	PMoveAcross(bboxWidth(bbox), mc);
1071
    }
1071
    }
Line 1082... Line 1082...
1082
    cetype_t enc = (gc->fontface == 5) ? CE_SYMBOL : CE_NATIVE;
1082
    cetype_t enc = (gc->fontface == 5) ? CE_SYMBOL : CE_NATIVE;
1083
 
1083
 
1084
    if (str) {
1084
    if (str) {
1085
	/* need to advance by character, not byte, except in the symbol font */
1085
	/* need to advance by character, not byte, except in the symbol font */
1086
	if(mbcslocale && gc->fontface != 5) {
1086
	if(mbcslocale && gc->fontface != 5) {
1087
	    int n = strlen(str), used;
1087
	    size_t n = strlen(str), used;
1088
	    wchar_t wc;
1088
	    wchar_t wc;
1089
	    const char *p = str;
1089
	    const char *p = str;
1090
	    mbstate_t mb_st;
1090
	    mbstate_t mb_st;
1091
	    mbs_init(&mb_st);
1091
	    mbs_init(&mb_st);
1092
	    while ((used = Mbrtowc(&wc, p, n, &mb_st)) > 0) {
1092
	    while ((used = Mbrtowc(&wc, p, n, &mb_st)) > 0) {