Re: VB6 fonts on different display sizes



"jerry_ys" <jerryys@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:4FD1361C-9F45-4386-B7BE-43926B157D63@xxxxxxxxxxxxxxxx

Thanks for the extensive education on this matter. My problem is resolved.

You're welcome.

but the second part of my question was not answered.

Yes it was. You asked, "how can I be sure that an app developed on one size computer will be ok on a larger, or smaller screen size?" and I gave you a fairly comprehensive answer which went into some detail on a number of different points. Regarding the specific point about some "Small Fonts" sizes not looking good on some machines I suggested that if you're going to use Small Fonts then you should "make sure it is a designed small font and not an expanded small font", and I told you how to do that. All you would need is a bit of code that checked whether your desired size of "Small Fonts" was a real bitmap on that specific machine and if not then move down a little bit and check again until you find the largest size that is a real bitmap (and not an expanded version of a smaller bitmap). Then set all your controls which use that desired size of "Small Fonts" to the new value. Alternatively, of course, you could use a True Type font, depending on the actual size you require.

with same OS, XP SP2, why does the IDE on the larger computer only allow
small fonts to a max size of 6 while the smaller one gave choices to size 7?

Now that's a different question, and the reason I didn't answer it is because you didn't ask it! As I said earlier, "Small Fonts" are bitmap fonts and there is a separate bitmap for each available size (a limited number of bitmaps, of course) and those bitmaps typically range in size up to around 7 points. If you ask for a "Small Fonts" point size greater than about 7 (you can get virtually any size you want) the system will generate a bitmap by "doubling up" or "trebling up" one of the smaller "real bitmaps". As with all fonts, the size you get is not necessarily the size you ask for (and the "list of available sizes" in the various drop down lists is merely an approximation of the available sizes, using nice round figures). This is because font sizes are always in whole pixel values, and the number of pixels in a point can be different on different machines. To see which sizes are actually available you can write code to loop through a specific range of point sizes, setting the font to that size and then "reading the size you actually got". In the case of the "Small Fonts" font you can take this a little further by printing the character "I" into a small picture box at the standard (not bold) setting and checking across the centre of the picture box to see whether or not the "I" is one pixel thick (any thicker than 1 pixel and it is not a "real bitmap" Small Font size and it will not look good on the display).

The number of "Small Fonts" bitmaps loaded (and therefore the number and range of "real bitmap" Small Font sizes you can get) depends on a number of things, including the dpi setting of the machine and I think even on the type of graphics card you have. For example, on my own machine at the standard 96 dpi setting the available "Small Fonts" font sizes are:

2.25, 3.00, 3.75, 5.25, 6.00 and 6.75 points.

(These values equate to: 3, 4, 5, 7, 8 and 9 pixels.)

If I change the same machine to its 120 dpi setting then the available sizes are:

1.80, 3.00, 4.20, 4.80, 6.00 and 6.60 points.

(These equate to: 3, 5, 7, 8, 10 and 11 pixels.)

Don't worry too much about the "nice round" point size values shown in the VB properties window. They're only kiddin' ;-)

. . . Otherwise, this situation could become an endless maintenance nightmare.

There's no maintenance at all required if you select the font sizes properly at run time. To discover what font sizes are really available on a specific device (and in the case of the "Small Fonts" typeface to discover which of those sizes are "real bitmaps") you need to write some code. Then, when you've selected your font size you need to make sure that your desired text at that specific size will fit onto the control (Command Button or whatever).

Mike




.