×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

How to change font in PCL
2

How to change font in PCL

How to change font in PCL

(OP)
I'm developing a print engine for a project I'm working on and I'm trying to figure out PCL.  I'm currently using an HP4050 and can't get the font change from the default monospaced font.

Here is the example that I was trying:

Dim lhPrinter As Long
Dim lReturn As Long
Dim lpcWritten As Long
Dim lDoc As Long
Dim sWrittenData As String
Dim MyDocInfo As DOCINFO

lReturn = OpenPrinter(Printer.DeviceName, lhPrinter, 0)

If lReturn = 0 Then
    MsgBox "The Printer Name you typed wasn't recognized."
    Exit Sub
End If

MyDocInfo.pDocName = "AAAAAA"
MyDocInfo.pOutputFile = vbNullString
MyDocInfo.pDatatype = vbNullString

lDoc = StartDocPrinter(lhPrinter, 1, MyDocInfo)
Call StartPagePrinter(lhPrinter)

sWrittenData = Chr(27) & "(s16602T" & "How's that for Magic !!!!"  ' should change to arial!!!!

lReturn = WritePrinter(lhPrinter, ByVal sWrittenData, _
   Len(sWrittenData), lpcWritten)
lReturn = EndPagePrinter(lhPrinter)
lReturn = EndDocPrinter(lhPrinter)
lReturn = ClosePrinter(lhPrinter)

Can anybody give me any suggestions?

Thanks for your help, Brinson

RE: How to change font in PCL

2
No, you don't understand. You have given an incomplete
font selection.

The typface is just one of several parameters that
describe a font. PCL gives priority to font selection
by the attributes. In order of highest priority these
are the attributes.

1. Symbol Set
2. Spacing (proportional or fixed pitch)
3. Point Size (or pitch if fixed spacing)
4. Style (Upright or italic etc.)
5. Stroke weight(medium bold etc.)
6. Typeface(arial, courier, times etc.)

Notice the the typeface has the lowest priority for
font selection!

Back to your example. First consider that the printer
maintains a table for the selection and will do its
best to meet the request. Any unstated attributes will
revert to whatever is current.

You had started with a fixed pitch font, and then
requested the arial typeface. Arial IS a proportional
font, but you are, by default, still requesting a
fixed pitch font. Because the spacing has a higher
priority than the typeface, you still get a fixed
pitch font.

To be safe, always specify the complete select string.

If you want 12pt med Arial then...

<esc>(s1p12v0s0b16602T should never fail.

There is still the issue of the symbol set which
has the highest priority, but that isn't so much of
an issue with HP internal fonts as many symbol sets
are supported. That may not be true with soft fonts.

Jim Asman

RE: How to change font in PCL

(OP)
Thanks for the information jlasman.  It worked like a charm!!

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login


Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close