private void drawString(Object nativeFont,String str,int x,int y,int textDecoration,int fontHeight){
  if (str.length() == 0) {
    return;
  }
  if (textDecoration != 0) {
    boolean raised=(textDecoration & Style.TEXT_DECORATION_3D) != 0;
    boolean lowerd=(textDecoration & Style.TEXT_DECORATION_3D_LOWERED) != 0;
    boolean north=(textDecoration & Style.TEXT_DECORATION_3D_SHADOW_NORTH) != 0;
    if (raised || lowerd || north) {
      textDecoration=textDecoration & (~Style.TEXT_DECORATION_3D) & (~Style.TEXT_DECORATION_3D_LOWERED)& (~Style.TEXT_DECORATION_3D_SHADOW_NORTH);
      int c=getColor();
      int a=getAlpha();
      int newColor=0;
      int offset=-2;
      if (lowerd) {
        offset=2;
        newColor=0xffffff;
      }
 else       if (north) {
        offset=2;
      }
      setColor(newColor);
      if (a == 0xff) {
        setAlpha(140);
      }
      drawString(nativeFont,str,x,y + offset,textDecoration,fontHeight);
      setAlpha(a);
      setColor(c);
      drawString(nativeFont,str,x,y,textDecoration,fontHeight);
      return;
    }
    canvas.drawText(str,x,y - font.getFontAscent(),font);
    if ((textDecoration & Style.TEXT_DECORATION_UNDERLINE) != 0) {
      paint.setStyle(Paint.Style.FILL);
      canvas.drawLine(x,y + fontHeight - 1,x + impl.stringWidth(nativeFont,str),y + fontHeight - 1,paint);
    }
    if ((textDecoration & Style.TEXT_DECORATION_STRIKETHRU) != 0) {
      paint.setStyle(Paint.Style.FILL);
      canvas.drawLine(x,y + fontHeight / 2,x + impl.stringWidth(nativeFont,str),y + fontHeight / 2,paint);
    }
    if ((textDecoration & Style.TEXT_DECORATION_OVERLINE) != 0) {
      paint.setStyle(Paint.Style.FILL);
      canvas.drawLine(x,y,x + impl.stringWidth(nativeFont,str),y,paint);
    }
  }
 else {
    canvas.drawText(str,x,y - font.getFontAscent(),font);
  }
}

private void drawString ( Object nativeFont , String str , int x , int y , int textDecoration , int fontHeight ) { if ( str . length ( ) == 0 ) { return ; } if ( textDecoration != 0 ) { boolean raised = ( textDecoration & Style . TEXT_DECORATION_3D ) != 0 ; boolean lowerd = ( textDecoration & Style . TEXT_DECORATION_3D_LOWERED ) != 0 ; boolean north = ( textDecoration & Style . TEXT_DECORATION_3D_SHADOW_NORTH ) != 0 ; if ( raised || lowerd || north ) { textDecoration = textDecoration & ( ~ Style . TEXT_DECORATION_3D ) & ( ~ Style . TEXT_DECORATION_3D_LOWERED ) & ( ~ Style . TEXT_DECORATION_3D_SHADOW_NORTH ) ; int c = getColor ( ) ; int a = getAlpha ( ) ; int newColor = 0 ; int offset = - 2 ; if ( lowerd ) { offset = 2 ; newColor = 0xffffff ; } else if ( north ) { offset = 2 ; } setColor ( newColor ) ; if ( a == 0xff ) { setAlpha ( 140 ) ; } drawString ( nativeFont , str , x , y + offset , textDecoration , fontHeight ) ; setAlpha ( a ) ; setColor ( c ) ; drawString ( nativeFont , str , x , y , textDecoration , fontHeight ) ; return ; } canvas . drawText ( str , x , y - font . getFontAscent ( ) , font ) ; if ( ( textDecoration & Style . TEXT_DECORATION_UNDERLINE ) != 0 ) { paint . setStyle ( Paint . Style . FILL ) ; canvas . drawLine ( x , y + fontHeight - 1 , x + impl . stringWidth ( nativeFont , str ) , y + fontHeight - 1 , paint ) ; } if ( ( textDecoration & Style . TEXT_DECORATION_STRIKETHRU ) != 0 ) { paint . setStyle ( Paint . Style . FILL ) ; canvas . drawLine ( x , y + fontHeight / 2 , x + impl . stringWidth ( nativeFont , str ) , y + fontHeight / 2 , paint ) ; } if ( ( textDecoration & Style . TEXT_DECORATION_OVERLINE ) != 0 ) { paint . setStyle ( Paint . Style . FILL ) ; canvas . drawLine ( x , y , x + impl . stringWidth ( nativeFont , str ) , y , paint ) ; } } else { canvas . drawText ( str , x , y - font . getFontAscent ( ) , font ) ; } }
draw a string using the current font and color in the x , y coordinates . the font is drawn from the top position and not the baseline .
