示例#1
0
void ILI9325i2c_16::print(char *st, int x, int y, int deg)
{
  int stl, i;

  stl = strlen(st);

  if (orient == PORTRAIT)
  {
    if (x == RIGHT)
      x = (XSIZE + 1) - (stl * cfont.x_size);
    if (x == CENTER)
      x = ((XSIZE + 1) - (stl * cfont.x_size)) / 2;
  }
  else
  {
    if (x == RIGHT)
      x = (YSIZE + 1) - (stl * cfont.x_size);
    if (x == CENTER)
      x = ((YSIZE + 1) - (stl * cfont.x_size)) / 2;
  }

  for (i = 0; i < stl; i++)
    if (deg == 0)
      printChar(*st++, x + (i * (cfont.x_size)), y);
    else
      rotateChar(*st++, x, y, i, deg);
}
void TFT_ScaleFonts::print(char *st, int x, int y, int S, int deg)
{
  if (S < 1) S = 1;

  if (S == 1)
  {
    _Disp->print(st, x, y, deg);
    return;
  }

  int stl, i;

  stl = strlen(st);

  if (_Disp->orient == PORTRAIT)
  {
    if (x == RIGHT)
      x = ((Bound_X2 - Bound_X)/*_Disp->disp_x_size*/ + 1) - (stl * _Disp->cfont.x_size * S);
    if (x == CENTER)
      x = (((Bound_X2 - Bound_X) + 1) - (stl * _Disp->cfont.x_size * S)) / 2;
  }
  else
  {
    if (x == RIGHT)
      x = ((Bound_Y2 - Bound_Y) + 1) - (stl * _Disp->cfont.x_size * S);
    if (x == CENTER)
      x = (((Bound_Y2 - Bound_Y) + 1) - (stl * _Disp->cfont.x_size * S)) / 2;
  }

  for (i = 0; i < stl; i++)
    if (deg == 0)
      printChar(*st++, x + (i * (_Disp->cfont.x_size * S)), y, S);
    else
      rotateChar(*st++, x, y, i * S, S, deg);
}