Hello, I have the following problem:
I create a GlyphVector, and drawing this GlyphVector later.
It works fine with regular string, but if string starts from blanks,
they are disappear. It means, that if I have
String s = new String(" tex t");
the drawing appears to be "tex t". Blanks inside the string or at the end
of the string do not cause any problem.
Any thoughts?
Thank you.
P.S. I have found a very similar question oin this forum without an answer.
Orna Vel - 28 Apr 2005 23:24 GMT
It means that nobody had this problem before?
It appears just sometime. As I found, if you call
code:
----------------------------------------------------------------------------
----
Graphics2D g2D;FontRenderContext frc = g2D.getFontRenderContext();String
string = new String (" test ");GlyphVector gV = Font.createGlyphVector
(frc, string); g2D.drawGlyphVector ( gV ,0 ,0 );
----------------------------------------------------------------------------
----
everything works fine, but
if you want to draw SHAPE here is the problem:
code:
----------------------------------------------------------------------------
----
Shape dispElement;Graphics2D g2D;FontRenderContext frc =
g2D.getFontRenderContext();String string = new String (" test ")
;GlyphVector gV = Font.createGlyphVector(frc, string); dispElement =
gV.getOutline();g2D.fill(dispElement);
----------------------------------------------------------------------------
----
the leading blanks are disappear. Too bad.