Win a copy of Succeeding with AI this week in the Artificial Intelligence and Machine Learning forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
  • Junilu Lacar
  • Tim Cooke
  • Jeanne Boyarsky
  • Knute Snortum
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
  • Piet Souris
  • salvin francis
  • fred rosenberger
  • Frits Walraven

creating a String Shape of specified size

Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Given a rectangle of some arbitrary size, I need to create a Shape that represents a string that will fit inside the rectangle. I've read some things about TextLayout and GlyphVector which say that I can get a Shape object that represents the outline of my text. However, it seems to create these things, I need a Font. That leads to specifying a font size, and possibly to getting a FontRenderContext. But at the time I'm setting up the text, I don't have a Graphics2D object at my disposal, so all the stuff about LineMetrics and sizing is not available. Does anyone have an idea about how to do this? I think I'm in over my head.
Blood pressure normal? What do I change to get "magnificent"? Maybe this tiny ad?
Two software engineers solve most of the world's problems in one K&R sized book
    Bookmark Topic Watch Topic
  • New Topic