int fillWidth = textWidth(line, lineOffset, renderOffset, styleLineLength, filteredStyles, paintX, gc, currentFont);
int fillWidth = getTextWidth(line, lineOffset, renderOffset, styleLineLength, filteredStyles, paintX, gc, currentFont);
private void drawStyledLine(String line, int lineOffset, int renderOffset, StyleRange[] styles, int paintX, int paintY, GC gc, Color lineBackground, Color lineForeground, FontData currentFont, StyledTextBidi bidi) {	int lineLength = line.length();	int horizontalScrollOffset = getHorizontalPixel();	Color background = gc.getBackground();	Color foreground = gc.getForeground();		StyleRange style = null;	StyleRange[] filteredStyles = filterLineStyles(styles);		int renderStopX = getClientArea().width + horizontalScrollOffset;			// Always render the entire line when in a bidi locale.	// Since we render the line in logical order we may start past the end	// of the visual right border of the client area and work towards the	// left.	for (int i = 0; i < styles.length && (paintX < renderStopX || bidi != null); i++) {		int styleLineLength;		int styleLineStart;		int styleLineEnd;		style = styles[i];		styleLineEnd = style.start + style.length - lineOffset;		styleLineStart = Math.max(style.start - lineOffset, 0);		// render unstyled text between the start of the current 		// style range and the end of the previously rendered 		// style range		if (styleLineStart > renderOffset) {			background = setLineBackground(gc, background, lineBackground);			foreground = setLineForeground(gc, foreground, lineForeground);			setLineFont(gc, currentFont, SWT.NORMAL);						// don't try to render more text than requested			styleLineStart = Math.min(lineLength, styleLineStart);			paintX = drawText(line, renderOffset, styleLineStart - renderOffset, paintX, paintY, gc, bidi);			renderOffset = styleLineStart;		}		else		if (styleLineEnd <= renderOffset) {			// style ends before render start offset			// skip to the next style			continue;		}		if (styleLineStart >= lineLength) {			// there are line styles but no text for those styles			// possible when called with partial line text			break;		}				styleLineLength = Math.min(styleLineEnd, lineLength) - renderOffset;		// set style background color if specified		if (style.background != null) {			background = setLineBackground(gc, background, style.background);			foreground = setLineForeground(gc, foreground, style.background);			if (bidi != null) {				bidi.fillBackground(renderOffset, styleLineLength, leftMargin - horizontalScrollOffset, paintY, lineHeight);			}			else {				int fillWidth = textWidth(line, lineOffset, renderOffset, styleLineLength, filteredStyles, paintX, gc, currentFont);				gc.fillRectangle(paintX - horizontalScrollOffset + leftMargin, paintY, fillWidth, lineHeight);			}		}		else {			background = setLineBackground(gc, background, lineBackground);		}		// set style foreground color if specified		if (style.foreground != null) {			foreground = setLineForeground(gc, foreground, style.foreground);		}		else {			foreground = setLineForeground(gc, foreground, lineForeground);		}		setLineFont(gc, currentFont, style.fontStyle);		paintX = drawText(line, renderOffset, styleLineLength, paintX, paintY, gc, bidi);		renderOffset += styleLineLength;	}	// render unstyled text at the end of the line	if ((style == null || renderOffset < lineLength) && 		(paintX < renderStopX || bidi != null)) {		setLineBackground(gc, background, lineBackground);		setLineForeground(gc, foreground, lineForeground);		setLineFont(gc, currentFont, SWT.NORMAL);		drawText(line, renderOffset, lineLength - renderOffset, paintX, paintY, gc, bidi);	}	}