Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Work with fonts in PCL 6 class 3

Status
Not open for further replies.

EgorovAlex

Technical User
Oct 30, 2008
12
Hello,

I hava small PCL 6 class 3 file (attached), it is created from Windows Notepad and contain only one word "abcba". It is created for test.

Now I try to get this text from spl file, but I don't know, how to work with fonts, when I parse this file, I receive TextData = #01#02#03#02#01 - I know, this is my text and I need get symbols for this numbers, this is font description from spl file:

[tt][blue]
4D532050434C584C466F6E7420303031 - "MS PCLXLFont 001"
F8 - Attribute
A8 - FontName (="MS PCLXLFont 001")
4F - BeginFontHeader
C1 - uint16
0800 - 8
F8 - Attribute
A7 - FontHeaderLength (=8)
50 - ReadFontHeader
FB - dataLengthByte
08 - Length of extended data
0000000201001770 - font data
C1
0600
F8
A7
50
FB
06
4754000002D8
C1
0C00
F8
A7
50
FB
0C
000100000006004000020020
C1
6000
F8
A7
50
FB
60
63767420000000000000006C000000F46670676D0000000000000160000
00020676469720000000000000000000000006865616400000000000001
80000000386D61787000000000000001B80000002070726570000000000
00001D800000100
C1
F400
F8
A7
50
FB
F4
0000FFE10000FFE70000FFDB05030522043E045605C805ED062B0644FE7
5FE5C00C500D2009400B9065000AFFFFFFFFFFFFFFFFF05C800DE064401
42FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFF008900A1FFFFFFFFFFFF00CA00F7053400AD
00AC00BB00A800BA0425001901A300DE003200F7021F00960170007B006
302A602E4FED8008801280141021F00A5003A00A600AD026900B4002B00
AD005CFEB9007C004C006F007E00B9008700E400AB007F029A064400F70
12804A00281004A02DA030300190141012800F7008800A80206FE500650
00CD006900950078
C1
2000
F8
A7
50
FB
20
B11F0F2C23208A8A45505821211B4544592D2C4B525845441B2121592D0
00000
C1
3800
F8
A7
50
FB
38
00010000000040000259F9D55F0F3CF5000B080000000000A9117A1D000
00000B16E0F850000FE5004D206500000000C0001000000000000
C1
2000
F8
A7
50
FB
20
00010000029A0078001E004500050002001000160096000000D30121000
30001
C1
0001
F8
A7
50
FA
00010000
40461A0A641F5A4C231F3F08231F0F0E231F0D0C231F0B0A2F1F0A060D1
F0504251F03022F1F09083C1F01002F1F07062F1F63625A0F5D5BE00F5E
78E00F785B540F4D12A00F3D12B80120403B0F3C12F00F3B3AE00F53121
31F5110191F4410A00F7215D20F6210600F5F10E00F5810600F5610E00F
5410E00F3E10E00F3A10B40F3710E00F3233B80120400F0F3310820F151
0E00F1310E00F1110B80140401B0F12109E0F1012121F0F1C701C701D80
1D041F066F069F06033201B901FF00084B5358B001B0018E59858D4B535
8B0801D597373012B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B002B2B
2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B0000
C1
0C00
F8
A7
50
FB
0C
4743000000060000FFFF0000
C1
0600
F8
A7
50
FB
06
FFFF00000000
51 - EndFontHeader
[/blue][/tt]

How I can use this font data to get readable text?
 
>> How I can use this font data to get readable text?

The short answer is that you almost certainly can't!

The Windows printer driver has 'obfuscated' the downloaded PCL-encapsulated version of the donor TrueType font.

This is to make it more difficult for people to contravene the 'licensing and embedding' restrictions associated with the font (fonts are like other proprietary software - they have licences).

With the PCLXL (PCL6) driver, you'll usually find that the first character to be printed has been associated with character code hexadecimal 01, the second with hex 02, etc.

So, for a page with "abcba", the characters will probably be encoded as hex 01 02 03 02 01.
And you'd find exactly the same encoded characters if the page had contained "pqrqp" instead - but the font download would have been different.

You'll find that the same happens with the PCL5 drivers, but in this case the encoded characters will start with hex 20 (space), hex 21 (!), etc. instead of hex 01, hex 02, etc.


I don't think that you can work backwards from the information in the individual character downloads to help you: although these will contain the 'glyph identifier', you can't map this back to a Unicode value, since the 'cmap' table from the TTF is not present in the font header of the PCL-encapsulated downloaded equivalent font.
 
Thank you, but I found many converters from PCL to image, and it is work fine! How I can do this?

Currently I found all chars in my PCL file, but I don't know how I can interpret it to readable bitmap:


A8 - FontName = MS PCLXLFont 001
52 - BeginChar
C1 - uint16
0100
F8 - attr_ubyte
A2 - CharCode = 1
C1 - uint16
6800
F8 - attr_ubyte
A3 - CharDataSize = 100
53 - ReadChar
FB - dataLengthByte
68 - length of Embedded Data = 104
01 01 00 66 00 B9 04 D2 00 14 00 01 00 B9 00 00 04 94 05 ED 00 09 00 34 40 17 55 05 01 04 03 05 06 07 01 12 00 04 06 0B 09 07 10 02 04 00 02 16 0A 10 4B 53 58 B0 45 76 59 D6 18 DC 3C 10 FD DC 00 3F 3F FD 3C 10 C0 D0 C0 5D 31 30 33 35 21 11 05 35 25 11 21 15 B9 01 8B FE 75 02 50 01 8B 94 04 7F 59 7A B9 FA A7 94
01 - Format Must Be 1
01 - Class = 1
00 66 - Character Data Size = 102
00 B9 - Left Side Bearing = 185
04 D2 - Advance Width = 1234
00 14 - TrueType Glyph ID = 20
00 01 00 B9 00 00 04 94 05 ED 00 09 00 34 40 17
55 05 01 04 03 05 06 07 01 12 00 04 06 0B 09 07
10 02 04 00 02 16 0A 10 4B 53 58 B0 45 76 59 D6
18 DC 3C 10 FD DC 00 3F 3F FD 3C 10 C0 D0 C0 5D
31 30 33 35 21 11 05 35 25 11 21 15 B9 01 8B FE
75 02 50 01 8B 94 04 7F 59 7A B9 FA A7 94
C1 - uint16
0200
F8 - attr_ubyte
A2 - CharCode = 2
C1 - uint16
CA00
F8 - attr_ubyte
A3 - CharDataSize = 100
53 - ReadChar
FB - dataLengthByte
CA - length of Embedded Data = 202
01 01 00 C8 00 A8 04 D2 00 15 00 01 00 A8 00 00 03 F7 05 ED 00 19 00 70 40 44 76 03 76 04 86 03 86 04 04 15 14 11 17 04 03 06 01 34 17 44 17 54 17 64 17 74 17 84 17 06 15 14 11 17 04 03 06 01 11 06 00 0E 01 17 12 00 04 09 12 0E 0B 17 19 01 19 6A 06 7A 06 8A 06 03 11 11 06 0B 01 1A 10 DE C4 DC FD 5D C4 11 12 39 00 3F FD 3F FD 3C 11 12 39 39 01 11 12 39 39 11 12 39 39 5D 00 11 12 39 39 11 12 39 39 5D 31 30 33 35 36 3F 01 36 35 34 26 23 22 07 35 36 33 32 16 15 14 06 0F 01 06 07 21 15 A8 7A F2 59 B8 8D 76 8F C6 B8 B0 CB F7 72 88 54 E8 2F 02 5D AD EC F0 59 B7 BA 77 8F 68 AE 4E DD B5 75 CE 7F 4F D8 C5 AD
01 - Format Must Be 1
01 - Class = 1
00 C8 - Character Data Size = 200
00 A8 - Left Side Bearing = 168
04 D2 - Advance Width = 1234
00 15 - TrueType Glyph ID = 21
00 01 00 A8 00 00 03 F7 05 ED 00 19 00 70 40 44
76 03 76 04 86 03 86 04 04 15 14 11 17 04 03 06
01 34 17 44 17 54 17 64 17 74 17 84 17 06 15 14
11 17 04 03 06 01 11 06 00 0E 01 17 12 00 04 09
12 0E 0B 17 19 01 19 6A 06 7A 06 8A 06 03 11 11
06 0B 01 1A 10 DE C4 DC FD 5D C4 11 12 39 00 3F
FD 3F FD 3C 11 12 39 39 01 11 12 39 39 11 12 39
39 5D 00 11 12 39 39 11 12 39 39 5D 31 30 33 35
36 3F 01 36 35 34 26 23 22 07 35 36 33 32 16 15
14 06 0F 01 06 07 21 15 A8 7A F2 59 B8 8D 76 8F
C6 B8 B0 CB F7 72 88 54 E8 2F 02 5D AD EC F0 59
B7 BA 77 8F 68 AE 4E DD B5 75 CE 7F 4F D8 C5 AD
C1 - uint16
0300
F8 - attr_ubyte
A2 - CharCode = 3
C1 - uint16
CE00
F8 - attr_ubyte
A3 - CharDataSize = 100
53 - ReadChar
FB - dataLengthByte
CE - length of Embedded Data = 206
01 01 00 CC 00 EA 04 D2 00 16 00 01 00 EA FF DB 04 1B 05 EE 00 24 00 5A 40 39 1E 0B 0A 0B 12 0A 0A 19 23 03 12 23 05 14 12 19 0B 46 1E 56 1E C9 1E E9 1E 04 1E 06 0A 0A 0A 06 00 46 20 5A 06 59 11 6A 06 7B 06 7A 11 8A 11 07 20 11 06 1C 11 11 16 00 25 10 DE C4 DC ED D4 FD 5D 11 12 39 2F 11 12 39 5D 00 3F FD 3F FD 11 12 39 2F FD 11 12 39 31 30 37 35 16 33 32 36 35 34 26 2B 01 35 33 32 36 37 36 35 34 26 23 22 07 35 36 33 32 16 15 14 05 04 11 14 04 23 22 EA C9 6C 86 A4 C3 B4 60 39 83 79 32 4F 7E 6C 97 A8 A3 A7 C6 DF FE F5 01 38 FE EB EB 92 07 AE 46 A5 86 96 A2 8E 21 31 4E 7B 67 77 51 AD 39 B3 9F F8 7C 6B FE DD CD F2
01 - Format Must Be 1
01 - Class = 1
00 CC - Character Data Size = 204
00 EA - Left Side Bearing = 234
04 D2 - Advance Width = 1234
00 16 - TrueType Glyph ID = 22
00 01 00 EA FF DB 04 1B 05 EE 00 24 00 5A 40 39
1E 0B 0A 0B 12 0A 0A 19 23 03 12 23 05 14 12 19
0B 46 1E 56 1E C9 1E E9 1E 04 1E 06 0A 0A 0A 06
00 46 20 5A 06 59 11 6A 06 7B 06 7A 11 8A 11 07
20 11 06 1C 11 11 16 00 25 10 DE C4 DC ED D4 FD
5D 11 12 39 2F 11 12 39 5D 00 3F FD 3F FD 11 12
39 2F FD 11 12 39 31 30 37 35 16 33 32 36 35 34
26 2B 01 35 33 32 36 37 36 35 34 26 23 22 07 35
36 33 32 16 15 14 05 04 11 14 04 23 22 EA C9 6C
86 A4 C3 B4 60 39 83 79 32 4F 7E 6C 97 A8 A3 A7
C6 DF FE F5 01 38 FE EB EB 92 07 AE 46 A5 86 96
A2 8E 21 31 4E 7B 67 77 51 AD 39 B3 9F F8 7C 6B
FE DD CD F2
C1 - uint16
0400
F8 - attr_ubyte
A2 - CharCode = 4
C1 - uint16
9400
F8 - attr_ubyte
A3 - CharDataSize = 100
53 - ReadChar
FB - dataLengthByte
94 - length of Embedded Data = 148
01 01 00 92 00 6F 04 D2 00 17 00 02 00 6F 00 00 04 56 05 C8 00 0A 00 0D 00 50 40 2C 5A 0D 6B 0D 7B 0D 8B 0D 04 0D 04 06 0C 12 09 01 01 00 04 00 04 04 0A 0B 0B 65 0B 73 0B 82 0B 04 0B 03 08 06 0A 13 04 0C 03 00 16 0E 10 4B 53 58 B0 45 76 59 D6 18 CE 3C C0 FC 3C DC 10 C0 5D 00 3F 3F 11 12 39 2F 3C FD 3C 10 C0 5D 31 30 21 11 21 35 01 33 11 33 15 23 11 01 21 11 02 D8 FD 97 02 69 B9 C5 C5 FD 84 01 C3 01 8B A6 03 97 FC 57 94 FE 75 02 1F 02 A0 00
01
01
00 92
00 6F
04 D2
00 17
00 02 00 6F 00 00 04 56 05 C8 00 0A 00 0D 00 50
40 2C 5A 0D 6B 0D 7B 0D 8B 0D 04 0D 04 06 0C 12
09 01 01 00 04 00 04 04 0A 0B 0B 65 0B 73 0B 82
0B 04 0B 03 08 06 0A 13 04 0C 03 00 16 0E 10 4B
53 58 B0 45 76 59 D6 18 CE 3C C0 FC 3C DC 10 C0
5D 00 3F 3F 11 12 39 2F 3C FD 3C 10 C0 5D 31 30
21 11 21 35 01 33 11 33 15 23 11 01 21 11 02 D8
FD 97 02 69 B9 C5 C5 FD 84 01 C3 01 8B A6 03 97
FC 57 94 FE 75 02 1F 02 A0 00
C1 - uint16
0500
F8 - attr_ubyte
A2 - CharCode = 5
C1 - uint16
9200
F8 - attr_ubyte
A3 - CharDataSize = 100
53 - ReadChar
FB - dataLengthByte
92 - length of Embedded Data = 146
01 01 00 90 01 0E 04 D2 00 18 00 01 01 0E FF DB 04 06 05 C8 00 16 00 3A 40 1C 08 12 0F 47 0D 03 12 15 05 0D 15 0C 0A 4A 06 5A 06 02 0D 12 11 06 0F 12 00 0A 16 17 10 4B 53 58 B0 45 76 59 D6 18 C4 ED DC FD C4 5D 00 3F FC 3F FD 10 76 DC 18 FD 31 30 25 35 16 33 32 36 35 10 21 22 07 11 21 15 21 11 20 00 15 14 00 23 22 01 0E A9 66 7A 9D FE 4E 25 33 02 B6 FD F0 01 06 01 30 FE EC D0 75 08 A9 42 BD 93 01 4B 04 02 C2 AC FE 80 FE F8 E3 CA FE F4
01
01
00 90
01 0E
04 D2
00 18
00 01 01 0E FF DB 04 06 05 C8 00 16 00 3A 40 1C
08 12 0F 47 0D 03 12 15 05 0D 15 0C 0A 4A 06 5A
06 02 0D 12 11 06 0F 12 00 0A 16 17 10 4B 53 58
B0 45 76 59 D6 18 C4 ED DC FD C4 5D 00 3F FC 3F
FD 10 76 DC 18 FD 31 30 25 35 16 33 32 36 35 10
21 22 07 11 21 15 21 11 20 00 15 14 00 23 22 01
0E A9 66 7A 9D FE 4E 25 33 02 B6 FD F0 01 06 01
30 FE EC D0 75 08 A9 42 BD 93 01 4B 04 02 C2 AC
FE 80 FE F8 E3 CA FE F4
54 - EndChar
D3 - sint16_xy
7401 7002
F8 - attr_ubyte
4C - Point = (372, 624)
6B - SetCursor
C9 - uint16_array
C1 - uint16
0005 - length of array = 5
0001 0002 0003 0004 0005
F8 - attr_ubyte
AB - TextData = 
C8 - ubyte_array
C1 - uint16
0005 - length of array = 5
2D 2D 2D 2D 00
F8 - attr_ubyte
AF - XSpacingData = 45 45 45 45 0
A8 - Text


You can see, that I have TextData = hex values 01 02 03 04 05 (this is another file), and I have all 5 chars, but how I can decode this chars to bitmaps or fonts?
 
>> but I found many converters from PCL to image, and it is
>> work fine! How I can do this?

The converters are analysing and interpreting the whole PCL stream, including the downloaded font(s).

So, from the downloaded font, they are obtaining the shapes (i.e. glyph outlines) which correspond to the character codes hex(01), hex(02), etc.

But (as far as I'm aware) they have no idea what the text (i.e. the Unicode code-points) is - they just know what shape (in terms of a character outline) corresponds to each character code.

i.e. I don't think that these converters can return plain ASCII text - but perhaps you can prove otherwise?


So if you just want the shape (rather than the Unicode code-point which usually represents that shape) you could probably emulate what the converters are doing (but I've no idea how easy this is).
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top