Discussion:
Metrics of the MS Gothic font is always for even sizes.
(too old to reply)
Phil Race
2006-05-25 16:46:02 UTC
Permalink
I have been trying to reconcile my expectation of the display length and
printed length of
text using MS Gothic with what actually happens.
I have found that if the size requested (LOGFONT.lfHeight) equates to an odd
pixel size,
that GDI in fact uses the next highest even size.
eg 11 and 12 pixel both measure as 12 pixel.
I know that MS Gothic and MS Mincho are designed at 256 upem rather than 1024
or 2048 as is common now, because they are older fonts designed at a time when
computers were much less capable. So I wonder if there was also a long ago
decision
to save memory by scaling them only to even sizes? This is pure speculation
on my
part.
So with that background my questions are :
1. What is the actual reason for this ?
2. Is this implemented as some font-specific hack ?
3. How can I programmatically detect which fonts exhibit this kind of
behaviour?

-phil
Jeffrey Tan[MSFT]
2006-05-26 09:17:37 UTC
Permalink
Hi phil,

Thanks for your post!

Can you provide a sample working code snippet or a little sample project to
demonstrate the rounding to even size issue? It will be more efficient for
us to analysis this issue. Thanks!

Best regards,
Jeffrey Tan
Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
Phil Race
2006-05-26 19:04:02 UTC
Permalink
you don't need code for this. you can see it for yourself in 'Notepad'.
The one thing I recommend that you must do first is change the DPI to 72
Right click->Properties->Settings->Advanced->DPI Setting=Custom Setting ..
and selectt "75%". This reboots windows (!)

The reason to do this is a 96dpi its much harder to equate pts to pixels
uniformly.
Once you've set your display resolution set the font in Notepad to 9 pt MS
Gothic
and enter some text. It doesn't have to be Japanese.
Now increase the font size to 10pt. The line repaints but doesn't get longer
Now increase the font size to 11pt. The line gets MUCH longer
Now increase the font size to 12pt. The line repaints but doesn't get longer

Repeat until you are convinced. You can also print out but again unless you
know the printer device resolution and the mapping of pts to pixels it will be
less clear what is happening.

Just to be 100% clear : this is not a problem that occurs only when
I set DPI to 72. I am just telling you do that so you can see the problem
more clearly.

-Phil.
Post by Jeffrey Tan[MSFT]
Hi phil,
Thanks for your post!
Can you provide a sample working code snippet or a little sample project to
demonstrate the rounding to even size issue? It will be more efficient for
us to analysis this issue. Thanks!
Best regards,
Jeffrey Tan
Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
Jeffrey Tan[MSFT]
2006-05-29 02:08:04 UTC
Permalink
Hi Phil,

Thanks for your feedback!

I have consulted our product team regarding this. Based on the feedback, MS
Gothic and MS Mincho were designed to work in conjunction with bitmap fonts
for screen sizes. The bitmaps did not come at every size. If you requested
a size that was not available, another closer size was chosen.

Hope this information makes sense to you. Thanks!

Best regards,
Jeffrey Tan
Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
Phil Race
2006-05-29 06:14:01 UTC
Permalink
Post by Jeffrey Tan[MSFT]
Hi Phil,
I have consulted our product team regarding this. Based on the feedback, MS
Gothic and MS Mincho were designed to work in conjunction with bitmap fonts
for screen sizes. The bitmaps did not come at every size. If you requested
a size that was not available, another closer size was chosen.
Hope this information makes sense to you. Thanks!
Makes sense I i think but doesn't actually answer my questions.

1. What is the actual reason for this ?

Maybe that question was answered partly but which bitmap fonts
are we talking about?

2. Is this implemented as some font-specific hack ?

not answered.

3. How can I programmatically detect which fonts exhibit this kind of
behaviour?

not answered.

-phil.
Ben Voigt
2006-05-29 14:09:03 UTC
Permalink
Post by Phil Race
Post by Jeffrey Tan[MSFT]
Hi Phil,
I have consulted our product team regarding this. Based on the feedback, MS
Gothic and MS Mincho were designed to work in conjunction with bitmap fonts
for screen sizes. The bitmaps did not come at every size. If you requested
a size that was not available, another closer size was chosen.
Hope this information makes sense to you. Thanks!
Makes sense I i think but doesn't actually answer my questions.
1. What is the actual reason for this ?
Maybe that question was answered partly but which bitmap fonts
are we talking about?
Vector fonts can be requested at any size, because the size is a parameter
to the defining mathematical equations. Raster (bitmap) fonts are provided
in a certain set of sizes only.
Post by Phil Race
2. Is this implemented as some font-specific hack ?
not answered.
No. This behavior of having only a fixed set of possible sizes is common to
all raster (bitmap) fonts.
Post by Phil Race
3. How can I programmatically detect which fonts exhibit this kind of
behaviour?
not answered.
From GetTextMetrics documentation page:
Remarks
To determine whether a font is a TrueType font, first select it into a DC,
then call GetTextMetrics, and then check for TMPF_TRUETYPE in
TEXTMETRIC.tmPitchAndFamily. Note that GetDC returns an uninitialized DC,
which has "System" (a bitmap font) as the default font; thus the need to
select a font into the DC.
Post by Phil Race
-phil.
Phil Race
2006-05-29 15:44:03 UTC
Permalink
Post by Ben Voigt
Remarks
To determine whether a font is a TrueType font, first select it into a DC,
then call GetTextMetrics, and then check for TMPF_TRUETYPE in
TEXTMETRIC.tmPitchAndFamily. Note that GetDC returns an uninitialized DC,
which has "System" (a bitmap font) as the default font; thus the need to
select a font into the DC.
hmm, so this seems to be implying these fonts are bitmap fonts, but
they aren't. They are truetype fonts in (eg msgothic.ttc).
Whilst there may be *embedded* bitmaps at some sizes,
there's no bitmap font that I can see for these and there certainly aren't
printer resolution bitmaps either internally or externally.
So there's still some missing piece here.
If I had to speculate windows 3.1 JA had such bitmaps and the TTC
for 95 was handled in a metrics compatible way, but since there's nothing
in the font that implies or requests this, it remains my belief that there
is a font-specific hack. If I'm wrong I apologise, but I simply cannot
connect the dots.

-phil.
Jeffrey Tan[MSFT]
2006-05-30 08:01:08 UTC
Permalink
Hi Phil,

The bitmap fonts are actually embedded within the TrueType font file, so MS
Gothic would contain both outlines and bitmaps. You could probably use
GetFontData to query the bitmap sizes in the fonts to predict this behavior.

Hope this helps.

Best regards,
Jeffrey Tan
Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
Phil Race
2006-05-30 18:18:01 UTC
Permalink
Hi Jeffrey.
Post by Jeffrey Tan[MSFT]
Hi Phil,
The bitmap fonts are actually embedded within the TrueType font file, so MS
Gothic would contain both outlines and bitmaps. You could probably use
GetFontData to query the bitmap sizes in the fonts to predict this behavior.
I understand that TT fonts may have embedded bitmaps and I thought had
indicated in my previous post that this is not a possible explanation

I know what bitmap sizes are in the font : rhere are 16 sizes from 7pt->22
pt inclusive.
Use ttdtump from www.microsoft.com/typography, to veridy this.
So what this means is that there *are* odd size bitmaps in the font and yet
they
aren't used. Also the behaviour extends to larger pt sizes at printer
resolution.
So not only does this not add up, if your theory is that they should map to
the closest
bitmap size is correct then there is a huge bug since there are plenty of
odd sized
bitmaps that are not being used when this exact size is requested.
Also there are not bitmaps for all glyphs at each of these sizes. Just some
smallish
subset. That is another reason this makes no senze.

-Phil.
Jeffrey Tan[MSFT]
2006-05-31 02:43:58 UTC
Permalink
Hi Phil,

Thanks for your feedback!

I have searched http://msdn.microsoft.com, but I can not find any tool
named with "ttdtump". I also tried "ttdump", without any record. Can you
clarify which tool you are referring to? In your reply, is "rhere" a typo?
Does it mean "there"? I hope you can provide clearer and more accurate
reply which I can understand your concern better. Thanks.

Ok, I think your current concern is if the font size maps to bitmap size,
why there are odd bitmap sizes without being used when we are requiring odd
font size. Please confirm my understanding first, if I mis understand you,
please feel free to tell, thanks.

Best regards,
Jeffrey Tan
Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
Phil Race
2006-05-31 03:51:02 UTC
Permalink
Hi,

Try 'ttfdump'. Its not on msdn its on www.microsoft.com/typography
as part of the fonttools download.

You are right that you don't need to go get this unless you doubt me.
Post by Jeffrey Tan[MSFT]
Ok, I think your current concern is if the font size maps to bitmap size,
why there are odd bitmap sizes without being used when we are requiring odd
font size
Well only so far as it goes to showing that this theory is
not correct. My concern is actually my original question which has been
danced around with vartious theories every one of which is not consistent
with observed facts.

I still advance that there's no good reason for MS Gothic to behave
like this except for a font-specific hack for windows 3.1 compatibility
reasons. If you said yes that's the reason, I would like a way to
programmatically
detect this or be provided with a full list of the fonts that exhibit this
behaviour.

I actually don't care if I'm wrong as long as I get a theory that holds
to the facts. But since you guys should know what's happening we should
be able to do better than theories.

-phil.
Post by Jeffrey Tan[MSFT]
Hi Phil,
Thanks for your feedback!
I have searched http://msdn.microsoft.com, but I can not find any tool
named with "ttdtump". I also tried "ttdump", without any record. Can you
clarify which tool you are referring to? In your reply, is "rhere" a typo?
Does it mean "there"? I hope you can provide clearer and more accurate
reply which I can understand your concern better. Thanks.
Ok, I think your current concern is if the font size maps to bitmap size,
why there are odd bitmap sizes without being used when we are requiring odd
font size. Please confirm my understanding first, if I mis understand you,
please feel free to tell, thanks.
Best regards,
Jeffrey Tan
Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
Jeffrey Tan[MSFT]
2006-06-02 07:03:17 UTC
Permalink
Hi Phil,

Thanks for your feedback!

Yes, I understand your concern. Actually, I got the this explanation from
one of the cleartype font ARCHITECT, so I also does not know about the
design details. If you want to know about the details of this font design,
I suggest you contact Microsoft PSS for help, some experts from platform
team can help more on such font questions.

You can contact Microsoft Product Support directly by contacting us at
1-(800)936-5800 or by choosing one of the options listed at
http://www.microsoft.com/services/microsoftservices/srv_support.mspx.

Thanks for your understanding.

Best regards,
Jeffrey Tan
Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
Norman Diamond
2006-05-30 06:18:06 UTC
Permalink
Windows XP says that font MS Gothic is a TrueType font. In a command prompt
window the default font is a raster font and I have not changed it from the
default, but the alternative is visible as MS Gothic and it is shown as a
TrueType font. Here's a screenshot showing this font in the list of
options:
Loading Image...
(download size 16KB)

Furthermore this screenshot provides a nice example of another graphics bug
that several people have reported over the years. Windows do not repaint
properly. I used the mouse to drag the property window to the right, and
the text in the main window partly repainted. In case anyone thinks this is
an artifact of the PNG format, I have also uploaded the screenshot in its
original BMP format:
http://www.geocities.jp/hitotsubishi/cmd_prompt.bmp
(download size 942KB)

Windows makes an assertion in Display Properties (accessed from Control
Panel or from right-clicking the desktop) that this kind of graphics bug can
be solved by reducing video acceleration. I have never ever found this to
be true. On all except one machine, reducing video acceleration all the way
to zero had no effect on this bug. The exception was a machine using the
Trident 9525 driver which was built into Windows 2000, where reducing video
acceleration all the way to zero yielded an immediate BSOD. Anyway, this
repainting bug is not a driver problem.
Post by Jeffrey Tan[MSFT]
Hi Phil,
Thanks for your feedback!
I have consulted our product team regarding this. Based on the feedback, MS
Gothic and MS Mincho were designed to work in conjunction with bitmap fonts
for screen sizes. The bitmaps did not come at every size. If you requested
a size that was not available, another closer size was chosen.
Hope this information makes sense to you. Thanks!
Best regards,
Jeffrey Tan
Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
Loading...