Example #1
0
/*********************************************************************
*
*       GUI_UC_DispString
*/
void GUI_UC_DispString(const U16 GUI_UNI_PTR *s) {
  int xAdjust, yAdjust, xOrg;
  int FontSizeY;
  if (!s)
    return;
  GUI_LOCK();
  FontSizeY = GUI_Context.pAFont->YSize;
  xOrg = GUI_Context.DispPosX[GUI_Context.SelLayer];
 /* Adjust vertical position */
  yAdjust = GUI_GetYAdjust();
  GUI_Context.DispPosY[GUI_Context.SelLayer] -= yAdjust;
  for (; *s; s++) {
    GUI_RECT r;
    int LineLen= _GetLineLen(s,0x7fff);
    int xLineSize = _GetLineDistX(s, LineLen);
  /* Check if x-position needs to be changed due to h-alignment */
    switch (GUI_Context.TextAlign & GUI_TA_HORIZONTAL) { 
    case GUI_TA_CENTER: xAdjust= xLineSize/2; break;
    case GUI_TA_RIGHT:  xAdjust= xLineSize; break;
    default:            xAdjust= 0;
    }
    r.x0 = GUI_Context.DispPosX[GUI_Context.SelLayer] -= xAdjust;
    r.x1 = r.x0 + xLineSize-1;    
    r.y0 = GUI_Context.DispPosY[GUI_Context.SelLayer];
    r.y1 = r.y0 + FontSizeY-1;    
    _DispLine(s, LineLen, &r);
    GUI_Context.DispPosY[GUI_Context.SelLayer] = r.y0;
    s += LineLen;
    if (*s=='\n') {
      switch (GUI_Context.TextAlign & GUI_TA_HORIZONTAL) { 
      case GUI_TA_CENTER:
      case GUI_TA_RIGHT:
        GUI_Context.DispPosX[GUI_Context.SelLayer] = xOrg;
        break;
      default:
        GUI_Context.DispPosX[GUI_Context.SelLayer] = GUI_Context.LBorder;
        break;
      }
      GUI_Context.DispPosY[GUI_Context.SelLayer] += GUI_GetFontDistY();
    } else {
      GUI_Context.DispPosX[GUI_Context.SelLayer] = r.x0+xLineSize;
    }
    if (*s==0)    /* end of string (last line) reached ? */
      break;
  }
  GUI_Context.DispPosY[GUI_Context.SelLayer] += yAdjust;
  GUI_Context.TextAlign &= ~GUI_TA_HORIZONTAL;
  GUI_UNLOCK();
}
Example #2
0
/*********************************************************************
*
*       GUI__DispLine
*/
void GUI__DispLine(const char GUI_UNI_PTR *s, int MaxNumChars, const GUI_RECT* pr) {
  GUI_RECT r;
  #if GUI_SUPPORT_ROTATION
  if (GUI_pLCD_APIList) {
    #if GUI_WINSUPPORT
    WM_ITERATE_START(NULL) {
    #endif
      /* Do the actual drawing via routine call. */
      _DispLine(s, MaxNumChars, &r);
    #if GUI_WINSUPPORT
    } WM_ITERATE_END();
    #endif
  } else
  #endif
  {