Skip to main content

TextLayout.draw(Graphics2D g2, float x, float y)

No replies
nepalese
Offline
Joined: 2006-04-04

I'm using TextLayout.draw(Graphics2D g2, float x, float y)
to draw a string with strikethrough_On.
But the sun.font.Decoration draws the strikethrough attribute by
filling a Rectangle2D.Float while the GDIRenderer.cpp cast the float to int
Decoration.java
if (strikethrough) {

// stroke is inconsistent, fill rectangle instead
float strikeY = y + cm.strikethroughOffset;
g2d.fill(new Rectangle2D.Float(x1, strikeY-cm.strikethroughThickness/2,
x2-x1, cm.strikethroughThickness));
}

GDIRenderer.cpp
case java_awt_geom_PathIterator_SEG_LINETO:
if (index + 2 <= maxcoords) {
x1 = transX + (int) floor(coords[index++]);
y1 = transY + (int) floor(coords[index++]);

So when the Path2D.Float got from Rectangle2D.Float is like following:
SEG_MOVETO:100.0,112.046875
SEG_LINETO:140.0,112.046875
SEG_LINETO:140.0,112.984375
SEG_LINETO:100.0,112.984375
SEG_LINETO:100.0,112.046875
SEG_CLOSE
SEG_MOVETO:100.0,119.3125
SEG_LINETO:140.0,119.3125
The strikethrough line is missing..

One month ago I submitted a bug report on bugs.sun.com and got an review ID 709284, any news for that review ID?