Re: LOGFONT and Courier font to a printer
- From: "Paul Baker [MVP, Windows - SDK]" <paulrichardbaker@xxxxxxxxxxxxxxxx>
- Date: Wed, 4 Apr 2007 09:19:03 -0400
If you get the FontType for Courier, it will be RASTER_FONTTYPE and if you
get the FontType for Courier New, it will be TRUETYPE_FONTTYPE. I am not
sure where you're going with that though, GMG. You already know thoese facts
without querying Windows.
FWIW, I tried this myself using Windows XP, Wordpad and a HP Laserjet. On
the screen, I saw that Courier 15 was similar to Courier New 15 but that it
was chunkier and poorer quality. When I printed it, both were identical
because they ended up being Courier New 15.
The font mapper made your font the same as you expected except that it is
better quality. That is not a bad thing. If the customer thinks it is, can
you explain why?
Paul
"Alex Cohn" <AlexCohn@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:9C0F5309-CFEA-4203-8288-AD56692C36A2@xxxxxxxxxxxxxxxx
OUT_RASTER_PRECIS will not resolve your problem; it will prefer a raster
font
over TrueType scalable font _if_ one is available for the given typeface.
If
the system could not match the Courier font for the specific device
context,
it will not become better. As Paul indicated, you may use the
EnumFontFamiliesEx API to find the font type for a given typeface. The
EnumFontFamExProc will receive FontType argument that will indicate
RASTER_FONTTYPE or TRUETYPE_FONTTYPE. See an example for VB at
http://www.math.msu.su/~vfnik/WinApi/e/enumfontfamiliesex.html.
Alex
"GMG" wrote:
I'm wondering if I use OUT_RASTER_PRECIS if this would force the font
mapper
to choose courier?
Is there a method to know if a font is a Raster Font verses a true type
font.
Thanks
GMG
"Paul Baker [MVP, Windows - SDK]" wrote:
You should use Courier New. For all intents and purposes, it *is*
Courier,
but it's scalable. The customer doesn't care what Windows calls the
font, he
only cares what it looks like.
Paul
"GMG" <GMG@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:1FD4545C-BF04-4889-9071-7D4E2E7D3AF8@xxxxxxxxxxxxxxxx
Paul.
I'm setting every field that the LOGFONT structure has available,
unless
I'm
missing something.
The reason for why I'm pushing courier and my customer, of course,
requires
it for their reports. I'm stump by this issue because Courier, I
would
expect to work because it's the oldest font out there.
Thanks
GMG
"Paul Baker [MVP, Windows - SDK]" wrote:
HI,
You are not zero-filling your LOGFONT structure, although it looks
like
you
are initializing each of its members separately.
I am not saying that your printer driver does not support Courier.
In
fact
it ought to be able to support it using graphics. I am simply saying
that
the font mapper, based on your LOGFONT, driver and printer settings,
decided
not to use Courier. Actually, I am assuming that from your
observations.
You
would have to call GetTextFace to see what physical font face it
actually
used. The reason it did that is unclear to me, as the decision is
complex
and not well documented. However, it would seem to be a rather large
strike
against choosing Courier that is a raster font. It comes only in
sizes of
10, 12 and 15. The quality is going to look awful on a printer,
which
probably has a much higher DPI than your screen.
Can I ask, why are you so determined that it use the Courier font?
As
previously mentioned, you probably want to be using Courier New.
Paul
"GMG" <GMG@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:77EFCFA4-FE6A-41AB-93B7-E2AE14FFF1ED@xxxxxxxxxxxxxxxx
Below is what I'm doing to select the logical font. This routine
works
when
displaying the font on the desktop monitor but doesn't work when
sending
to
the printer. I'm going the SelectObject to select the new font
and
everything. It does seem work ok with True Type Font but not with
Raster.
Are you saying HP T45 OfficeJet doesn't support Courier that way
I'm
not
able to select it and Adobe PDF is doing some type of
preprocessing
before
sending to the print to handle Courier.
With tLF
sFont = fld.Font & vbNullChar
b = StrConv(sFont, vbFromUnicode)
For iChar = 1 To Len(sFont)
.lfFaceName(iChar - 1) = b(iChar - 1)
Next iChar
.lfHeight = -(fld.FontSize * 20) 'using MM_ANISOTROPIC
.lfWidth = 0
If fld.Italic Then
.lfItalic = 1
Else
.lfItalic = 0
End If
If (fld.Bold) Then
.lfWeight = FW_BOLD
Else
.lfWeight = FW_NORMAL
End If
If fld.Underline Then
.lfUnderline = 1
Else
.lfUnderline = 0
End If
.lfStrikeOut = 0
.lfCharSet = DEFAULT_CHARSET
.lfEscapement = 0
.lfOrientation = 0
.lfOutPrecision = OUT_DEFAULT_PRECIS
.lfClipPrecision = CLIP_DEFAULT_PRECIS
.lfQuality = DEFAULT_QUALITY
.lfPitchAndFamily = DEFAULT_PITCH Or FF_DONTCARE
End With
"Paul Baker [MVP, Windows - SDK]" wrote:
Alex,
I think that the reason you are confused is that you are unaware
of
the
font
mapping behaviour of Windows.
A LOGFONT structure represents a logical font. It describes the
attributes
of the font you would like to have.
When you output using the font, you must first use the
SelectObject()
API.
This selects the font. In doing so, it creates a physical font. A
physical
font is the font it will actually use and it is determined by the
font
mapper. It looks at your logical font and finds what it believes
to be
the
best match for the device. This depends on the capabilities of
the
device.
For a screen, this essentially means installed fonts. For a
printer,
this
depends on the driver.
The face name is one of the most important things, but each value
has
a
weighting and you must be careful to fill out as much of the
LOGFONT
structure as you can as accurately as you can to help ensure that
you
get
the physical font you want/expect.
A raster font like Courier comes in fixed sizes, it's like a
bitmap.
It
can
be scaled if necessary, but it does not scale well.
Also, PDF documents generally print text using graphics and not
fonts.
At
least, not GDI fonts. It uses its own font mechanism designed by
Adobe.
So
what Adobe calls "Courier" by no means corresponds to your GDI
Courier
font.
Paul
"GMG" <GMG@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:F51A83A1-4E76-4979-AF12-886B74790CD1@xxxxxxxxxxxxxxxx
Alex,
Only reason I'm confused by this answer, is when I send a PDF
document
to
the printer that uses a Courier font it print correctly. I'm
only
finding
the issue when I'm trying to send to the printer via
LOGFONT/CreateFontIndirect.
Do I need to specify in the LOGFONT structure it's a raster
font.
If
so,
how to I determine if a font is a raster font when all I have
is the
facename
and font size?
Thanks
GMG
"Alex Cohn" wrote:
I having an issue where I sending output to the printer inCourier is a raster font. It is not scalable. It is not
courier
and
the
courier font isn't being display. When I view the message
string
to
the
computer screen it looks fine, just when I send it to the
printer
expected to
work
for
your printer. Try using "Courier New" instead.
Cheers,
Alex
.
- References:
- Re: LOGFONT and Courier font to a printer
- From: Paul Baker [MVP, Windows - SDK]
- Re: LOGFONT and Courier font to a printer
- From: GMG
- Re: LOGFONT and Courier font to a printer
- From: Paul Baker [MVP, Windows - SDK]
- Re: LOGFONT and Courier font to a printer
- From: GMG
- Re: LOGFONT and Courier font to a printer
- From: Paul Baker [MVP, Windows - SDK]
- Re: LOGFONT and Courier font to a printer
- From: GMG
- Re: LOGFONT and Courier font to a printer
- From: Alex Cohn
- Re: LOGFONT and Courier font to a printer
- Prev by Date: Re: LOGFONT and Courier font to a printer
- Next by Date: Re: LOGFONT and Courier font to a printer
- Previous by thread: Re: LOGFONT and Courier font to a printer
- Next by thread: Re: LOGFONT and Courier font to a printer
- Index(es):
Relevant Pages
|