Re: Setting the column width size to 'n' number of characters



On Fri, 27 Feb 2009 02:26:34 -0800 (PST), nivedita.jadhav@xxxxxxxxx
wrote, quoted or indirectly quoted someone who said :

I am trying to set the size of a table column. But it takes the column
size in pixel. But my requirement is to set it to display some n
number of characters. Any way of doing it?


You have theoretical problem. Since most of your fonts are variable
pitch how wide is 10 characters? wide enough for ten 'i's or ten 'm's?

Let's say you compromised and made it wide enough for ten x's. Then
when you put 10 'm's in there, they won't fit.

What you might do is use a fixed pitch font, get the FontMetrics and
do the conversion from chars to pixels yourself with a multiplication.
http://mindprod.com/jgloss/fontmetrics.html

See http://mindprod.com/jgloss/monospacedfonts.html
for some possible choices of font. Keep WORA in mind. Only
"Monospaced" is guaranteed available everywhere.
--
Roedy Green Canadian Mind Products
http://mindprod.com

"If everyone lived the way people do in Vancouver,
we would need three more entire planets to support us."
~ Guy Dauncey (born: 1948 age: 61)
.



Relevant Pages

  • Re: Screen Size
    ... So I presume you mean that you used the conversion obtained from Point to Pixels to set up the size of your font in the LOGFONT structure that you used with CreateFontIndirect API and then just happened to draw that text to the screen DC using DrawText. ... If that is the case then you've probably used the pixel value directly when using CreateFontIndirect, ... When you use a negative value for the pixel size in the lfHeight entry in the LOGFONT structure then you are effectively asking Windows to select a font size such that the height of the "glyph" (the part of the character cell actually occupied by the shape of the characters) is the requested pixel height. ...
    (microsoft.public.vb.general.discussion)
  • Re: make drawString render fonts identically to PhotoShop 7.0
    ... I've noticed that there are differences, pixel for pixel, when ... rendering characters in the same Font with Java and with Photoshop. ... Most characters match pixel for pixel, ... The percentage varies with font choice. ...
    (comp.lang.java.programmer)
  • The font "Arabic Transparent" (artro.ttf) is invalid
    ... This font, when installed, causes WEFT to crash. ... Error code Message Details ... I2100 Characters in a unicode range are present in the font, ...
    (microsoft.public.windowsxp.general)
  • Re: apostrophe with space in Word
    ... Helvetica as known in the computing world didn't get going until Apple included it in the Mac Operating system. ... Because it became so popular, Microsoft decide to add to their font collection, but because it was patented they decide to create their own version. ... So it may help to explain that the Unicode character set now defines about ... important to know the answer to the question "How many glyphs (characters) ...
    (microsoft.public.mac.office.word)
  • Re: Russian language support
    ... Actually in our previous test we didnt do language transition properly ... bytes, or if in Unicode, just a string of 2-byte values, each of which is ... it selects a font to use to display ... TTF fonts in Windows CE map Unicode characters into suitable glyphs. ...
    (microsoft.public.windowsce.platbuilder)