private void drawString(Object nativeGraphics,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(nativeGraphics);
      int a=getAlpha(nativeGraphics);
      int newColor=0;
      int offset=-2;
      if (lowerd) {
        offset=2;
        newColor=0xffffff;
      }
 else       if (north) {
        offset=2;
      }
      setColor(nativeGraphics,newColor);
      if (a == 0xff) {
        setAlpha(nativeGraphics,140);
      }
      drawString(nativeGraphics,nativeFont,str,x,y + offset,textDecoration,fontHeight);
      setAlpha(nativeGraphics,a);
      setColor(nativeGraphics,c);
      drawString(nativeGraphics,nativeFont,str,x,y,textDecoration,fontHeight);
      return;
    }
    drawString(nativeGraphics,str,x,y);
    if ((textDecoration & Style.TEXT_DECORATION_UNDERLINE) != 0) {
      drawLine(nativeGraphics,x,y + fontHeight - 1,x + stringWidth(nativeFont,str),y + fontHeight - 1);
    }
    if ((textDecoration & Style.TEXT_DECORATION_STRIKETHRU) != 0) {
      drawLine(nativeGraphics,x,y + fontHeight / 2,x + stringWidth(nativeFont,str),y + fontHeight / 2);
    }
    if ((textDecoration & Style.TEXT_DECORATION_OVERLINE) != 0) {
      drawLine(nativeGraphics,x,y,x + stringWidth(nativeFont,str),y);
    }
  }
 else {
    drawString(nativeGraphics,str,x,y);
  }
}

private void drawString ( Object nativeGraphics , 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 ( nativeGraphics ) ; int a = getAlpha ( nativeGraphics ) ; int newColor = 0 ; int offset = - 2 ; if ( lowerd ) { offset = 2 ; newColor = 0xffffff ; } else if ( north ) { offset = 2 ; } setColor ( nativeGraphics , newColor ) ; if ( a == 0xff ) { setAlpha ( nativeGraphics , 140 ) ; } drawString ( nativeGraphics , nativeFont , str , x , y + offset , textDecoration , fontHeight ) ; setAlpha ( nativeGraphics , a ) ; setColor ( nativeGraphics , c ) ; drawString ( nativeGraphics , nativeFont , str , x , y , textDecoration , fontHeight ) ; return ; } drawString ( nativeGraphics , str , x , y ) ; if ( ( textDecoration & Style . TEXT_DECORATION_UNDERLINE ) != 0 ) { drawLine ( nativeGraphics , x , y + fontHeight - 1 , x + stringWidth ( nativeFont , str ) , y + fontHeight - 1 ) ; } if ( ( textDecoration & Style . TEXT_DECORATION_STRIKETHRU ) != 0 ) { drawLine ( nativeGraphics , x , y + fontHeight / 2 , x + stringWidth ( nativeFont , str ) , y + fontHeight / 2 ) ; } if ( ( textDecoration & Style . TEXT_DECORATION_OVERLINE ) != 0 ) { drawLine ( nativeGraphics , x , y , x + stringWidth ( nativeFont , str ) , y ) ; } } else { drawString ( nativeGraphics , str , x , y ) ; } }
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 .
