implements some GlyphVector methods for Swing

This commit is contained in:
smallsql 2009-05-07 19:00:56 +00:00
Родитель 52798fc6a0
Коммит 081a361661
1 изменённых файлов: 14 добавлений и 4 удалений

Просмотреть файл

@ -299,6 +299,7 @@ namespace ikvm.awt
private readonly java.awt.Font font; private readonly java.awt.Font font;
private readonly FontRenderContext frc; private readonly FontRenderContext frc;
private readonly char[] text; private readonly char[] text;
private NetFontMetrics metrics;
internal NetGlyphVector(Font netFont, java.awt.Font font, FontRenderContext frc, char[] text) internal NetGlyphVector(Font netFont, java.awt.Font font, FontRenderContext frc, char[] text)
@ -309,6 +310,15 @@ namespace ikvm.awt
this.text = text; this.text = text;
} }
private NetFontMetrics getMetrics()
{
if(metrics == null)
{
metrics = new NetFontMetrics(font);
}
return metrics;
}
public override bool equals(GlyphVector gv) public override bool equals(GlyphVector gv)
{ {
throw new NotImplementedException(); throw new NotImplementedException();
@ -369,14 +379,14 @@ namespace ikvm.awt
throw new NotImplementedException(); throw new NotImplementedException();
} }
public override java.awt.Shape getGlyphVisualBounds(int i) public override java.awt.Shape getGlyphVisualBounds(int index)
{ {
throw new NotImplementedException(); return getMetrics().GetStringBounds(new String(text, index, 1));
} }
public override Rectangle2D getLogicalBounds() public override Rectangle2D getLogicalBounds()
{ {
return new NetFontMetrics(font).GetStringBounds(new String(text)); return getMetrics().GetStringBounds(new String(text));
} }
public override int getNumGlyphs() public override int getNumGlyphs()
@ -517,4 +527,4 @@ namespace ikvm.awt
} }
} }
} }