Hi there,
I'm processing some old scans by vectorizing the best glyph for each character, converting this into a Type 3 font and then drawing the text on the page from the font.
The problem I'm having is how to position and size each glyph on the page individually and absolutely.
I want to ignore any features, boundaries, etc. of the font and position each glyph exactly where I want it, with x0,x1,y0,y1 page coordinates, with the glyph stetched to that exact size and position.
Any ideas?
Thanks,
Alasdair
If you want the features of the font ignored, then don't use a font. If it's a font, then it's positioned and drawn according to the rules of the font format and the text drawing operators.
This may require you to make multiple versions of each glyph. This may require you to make a more complex font description.
From: Adobe Forums <forums@adobe.com<mailto:forums@adobe.com>>
Reply-To: "jive-156860415-8igo-2-2ft2x@mail.forums.adobe.com<mailto:jive-156860415-8igo-2-2ft2x@mail.forums.adobe.com>" <jive-156860415-8igo-2-2ft2x@mail.forums.adobe.com<mailto:jive-156860415-8igo-2-2ft2x@mail.forums.adobe.com>>
Date: Tue, 20 Dec 2011 19:58:02 -0800
To: Leonard Rosenthol <lrosenth@adobe.com<mailto:lrosenth@adobe.com>>
Subject: Re: Absolute text glyph positioning and size on PDF page Absolute text glyph positioning and size on PDF page
Absolute text glyph positioning and size on PDF page
created by Alasdair2<http://forums.adobe.com/people/Alasdair2> in PDF Language and Specifications - View the full discussion<http://forums.adobe.com/message/4096761#4096761
OK. I will use an xobject instead for each character, which will allow me much more control over the positioning. It is a pity though, as the text will not be selectable and I'll have to put an invisible text layer under it.
I would recommend that you consider adding the ability to position glyphs absolutely in this manner, as it is necessary in the keeping the exact layout of digitized scanned documents, for which PDF is used as a standard format.
Why bother with the Xobject? Why not just draw the vectors on the page itself and then put the hidden text under/over it?
It is quite possible to do what you are asking – Adobe's OCR implementation has been doing this for years now. It just isn't trivial.
As the PDF standard is open (ISO 32000) and is being developed in an open manner – if you wish to see changes to it, I recommend you join the ISO committee and bring your desires.
From: Adobe Forums <forums@adobe.com<mailto:forums@adobe.com>>
Reply-To: "jive-1688012939-8igo-2-2ftfu@mail.forums.adobe.com<mailto:jive-1688012939-8igo-2-2ftfu@mail.forums.adobe.com>" <jive-1688012939-8igo-2-2ftfu@mail.forums.adobe.com<mailto:jive-1688012939-8igo-2-2ftfu@mail.forums.adobe.com>>
Date: Wed, 21 Dec 2011 04:21:44 -0800
To: Leonard Rosenthol <lrosenth@adobe.com<mailto:lrosenth@adobe.com>>
Subject: Re: Absolute text glyph positioning and size on PDF page Absolute text glyph positioning and size on PDF page
Re: Absolute text glyph positioning and size on PDF page
created by Alasdair2<http://forums.adobe.com/people/Alasdair2> in PDF Language and Specifications - View the full discussion<http://forums.adobe.com/message/4097226#4097226
There are many pages and only a few glyphs, so it makes sense for them to be xobjects as opposed to being drawn directly in the content stream. It's important to keep the filesize down to a minimum.
If there is already a way of doing this, I would prefer to draw it as text.
For example: say I have a type 3 font with just the drawing operators for each glyph. E.g. "T" looks like this:
0.100000 0.000000 0.000000 0.100000 0.000000 0.000000 cm
0 g
118 542 m
66 539 58 536 35 506 c
-30 421 43 371 116 450 c
158 495 223 508 232 473 c
256 377 225 72 191 64 c
165 57 155 50 155 35 c
155 12 392 -2 413 19 c
429 35 402 60 369 60 c
329 60 328 62 330 270 c
331 512 351 544 450 460 c
490 425 540 419 540 449 c
540 488 510 540 487 541 c
413 544 166 545 118 542 c
h
f
Then I want to draw this at the coordinates x0,x1,y0,y1 = 20,90,30,80 on the page, stretched exactly to that size with 0 boundary, and as a text character.
You are saying this is possible, correct? Could you point me in the right direction?
First thing I noticed is that strange cm value – why are you using .1 instead of 1 for the a & d values? And if you are concerned about size, why all the unnecessary decimal places?
In order to place it at those coordinates, you will need to do the necessary matrix algebra using the glyph's Bbox (that you defined in the Type 3 font), the font size (according to the Tf operator), etc. You control all the pieces – you simply have to put them all together in the right way.
North America
Europe, Middle East and Africa
Asia Pacific