Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / GUI / April 2005

Tip: Looking for answers? Try searching our database.

Problem with Font.createGlyphVector(frc, String)

Thread view: 
Orna Vel - 27 Apr 2005 20:27 GMT
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.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.