• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

centralising characters

 
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I want display individual characters centralised inside a box so that I can create a sort of grid with them equally spaced - this would be like a centered baseline monospaced characterset.

I can't see how with lower case letters once can discover how much to shift them to get them central, although this can be achieved somewhat with caps.

Is there any way to make my own font up perhaps, and bundle that with the application?

TIA
John
 
Ranch Hand
Posts: 1535
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can usually get pretty close using methods of the Font class.
Here's one way to do it.
Other options include the TextLayout and GlyphVector classes.
 
Bartender
Posts: 1561
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Too cool! I twiddled it to show some lower-case characters too:



Thanks for the clever code.

/Pete
 
reply
    Bookmark Topic Watch Topic
  • New Topic