Example #1
0
int oledStringWidth(const char *text) {
	if (!text) return 0;
	int l = 0;
	char c;
	for (; *text; text++) {
		c = oledConvertChar(*text);
		if (c) {
			l += fontCharWidth(c) + 1;
		}
	}
	return l;
}
Example #2
0
void oledDrawString(int x, int y, const char *text, int font) {
  if (!text) return;
  int l = 0;
  int size = (font & FONT_DOUBLE ? 2 : 1);
  for (; *text; text++) {
    char c = oledConvertChar(*text);
    if (c) {
      oledDrawChar(x + l, y, c, font);
      l += size * (fontCharWidth(font & 0x7f, c) + 1);
    }
  }
}
Example #3
0
int oledStringWidth(const char *text, int font) {
  if (!text) return 0;
  int size = (font & FONT_DOUBLE ? 2 : 1);
  int l = 0;
  for (; *text; text++) {
    char c = oledConvertChar(*text);
    if (c) {
      l += size * (fontCharWidth(font & 0x7f, c) + 1);
    }
  }
  return l;
}
Example #4
0
void oledDrawString(int x, int y, const char* text)
{
	if (!text) return;
	int l = 0;
	char c;
	for (; *text; text++) {
		c = oledConvertChar(*text);
		if (c) {
			oledDrawChar(x + l, y, c);
			l += fontCharWidth(c) + 1;
		}
	}
}
Example #5
0
void oledDrawString(int x, int y, const char* text)
{
	if (!text) return;
	int size = 1;
	if (*text == 0x01) { // double size
		text++;
		size = 2;
	}
	int l = 0;
	char c;
	for (; *text; text++) {
		c = oledConvertChar(*text);
		if (c) {
			oledDrawChar(x + l, y, c, size);
			l += size * (fontCharWidth(c) + 1);
		}
	}
}