Пример #1
0
static void initColors(void)
{
    char *colors, *colors_file, buf[16384];
    FILE *f;
    struct newtColors palette;

    palette = newtDefaultColorPalette;

    colors_file = getenv("NEWT_COLORS_FILE");
#ifdef NEWT_COLORS_FILE
    if (colors_file == NULL)
	colors_file = NEWT_COLORS_FILE;
#endif

    if ((colors = getenv("NEWT_COLORS"))) {
	strncpy(buf, colors, sizeof (buf));
	buf[sizeof (buf) - 1] = '\0';
	parseColors(buf, &palette);
    } else if (colors_file && *colors_file && (f = fopen(colors_file, "r"))) {
	size_t r;
	if ((r = fread(buf, 1, sizeof (buf) - 1, f)) > 0) {
	    buf[r] = '\0';
	    parseColors(buf, &palette);
	}
	fclose(f);
    }

    newtSetColors(palette);
}
Пример #2
0
void Text::setText(const Common::UString &str) {
	lockFrameIfVisible();

	if (!_disableColorTokens)
		parseColors(str, _str, _colors);
	else
		_str = str;

	Font &font = _font.getFont();

	font.buildChars(str);

	_lineCount = font.getLineCount(_str, _width, _height);

	unlockFrameIfVisible();
}