Quantcast
Channel: Adobe Community : Discussion List - All Communities
Viewing all articles
Browse latest Browse all 238792

A problem with a simple Type 3 bitmap font

$
0
0

I'm trying to reproduce an old document, in PDF, so that it looks EXACTLY like the original

document.  So that means each character has to look like the exact character, in the exact

position, of the original document.  Since I have scans (600 dpi) of the document, it

seemed I could do this by creating a Type 3 bitmap font and using that to define the

characters.  Then I just position each character, one after another.  It mostly works

fine.  I have a program that takes the position of each character and the bitmap fonts

and generates a PDF file.  I work in a Linux/C environment, and evince, the Linux

PDF viewer, shows everything as being just right.

 

But I have tried to also move the PDF to a Windows system, and a Mac, and use the

PDF viewers there.  Using the Adobe reader on a Windows 10 system, everything

works except 2 characters -- the full PDF is 302 pages, but I can create a test

case which is just one page, one instance of the two characters, displayed once.

It displays fine in evince.  When I copy it to Windows and use the Adobe Reader,

there appears to be a short pop-up window that says "the file is damaged, being

repaired", but it pops up and goes away so fast I can't tell if it is or is not there,

and sometimes it appears to be "under" the main display window, so I can't see

it anyway.  There is no log or diagnostic window or anything that I can find for the

Adobe Reader that tells me what it found or what it did, so I really can't tell.

 

But the image shows up, but only the lower half of it.  The character in question is

a very large left and right square bracket, used to define a matrix.  In print, it's a

little over an inch, so 668 bits tall (at 600 dpi) and only 19 wide.

 

I define my image drawing function exactly the same for all my characters, with

the exception, of course, of the height and width of the characters, and the actual

bits for the image.  The bits for the image are a stream, represented in plain old

hex.  A 0 bit is a black bit; a 1 bit is a white bit (that seems backwards, but it's easy

to code).  And by experimentation, I found that the for the matrix of bits, you have to pad out

each row to a multiple of 8.  So a 19 bit wide image takes 24 bits per row, even tho the

definition says it is a 19 bit image.  That means a 19x668 image will take 3 bytes per

row times 668 rows = 2004 bytes, which when represented in hex is 4008 bytes, plus

the trailing ">", making it 4009.

 

So my image object is:

 

1 0 obj % image object for &leftbigbracket; 112pt

<<

/Type /XObject

/Subtype /Image

/ImageMask true

/Width 19

/Height 668

/BitsPerComponent 1

/Filter /ASCIIHexDecode

/Length 4009

>>

stream

000000000000000000000000000000003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0 003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0 003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0 003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0 003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0 003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0 003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0 003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0 003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0 003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0 003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0 003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0 003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0 003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0 003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0 003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0 003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0 003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0 003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0 003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0 003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0 003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0 003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0 003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0 003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0 003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0 003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0 003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0 003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0 003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0 003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0 003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0 003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0 003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0 003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0 003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0 003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0 003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0 003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0 003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0 003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0 003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0 003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0 003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0003FE0 003FE0003FE0003FE0000000000000000000000000000000>

endstream

endobj

 

and, as I say, this works for all my other characters (over 1000 different characters in two main font families, normal, bold, italic,

in 10 different point sizes, EXCEPT for the two largest ones.  My right/left brackets work for up to 166

rows tall, but then fail at 251 bits tall.  Well, they don't fail, it's just only the lower part of the bracket shows

up, almost like someone has a 256 bit tall limit built into the Adobe Reader.  (Or maybe it's in the spec and

I just have missed that.)  I suppose I could test that by building characters that are 255, 256, and 257 rows

tall, but do I really have to do that to show that there is a problem with the Reader?  Or am I doing something

wrong?

 

(The Apple Mac previewer is terrible code.  It will display each page of the document, as a separate PDF

file just fine, but one big (and I mean big) PDF with all the fonts, all the characters, all the pages, and

the Mac seems to just throw away most of the characters -- I get the right characters in the right

places, but half of them (or more) are just blank.  It appears that there are fixed limits in the Mac previewer

on the number of total characters and after some number, it just tosses the others.)

 

Of course, I can't check the code for the Adobe Reader since it's only provided in binary.  Since all my

scans are at 600 dpi, and so all my numbers are in 600 dpi units, I tried to use the ability to define my

own user space coordinate system (UserUnit), but couldn't get it to work with evince.  But since evince

is open source, I got the source, tracked down where it processed a user defined unit and saw that

it set a state variable which then was never referenced anywhere in the source code.  Since I was

writing my own code, I simply did the conversion from my user units (600 dpi) to PDF default

units (1/72 inch) myself, to avoid that.

 

I can provide actual sample PDF files, of specific pages, or of specific fonts, or characters, if anyone

wants to use them as test cases.


Viewing all articles
Browse latest Browse all 238792

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>