The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

sramsden (4) [Avatar] Offline
#1
In an application that requires large printed characters, we are trying to minimize printer toner by using a hatched or hollow font but at the same time maintaining readability.

From what I have read thus far, it appears that the only way to do this is to take one of the Standard Type 1 Font that I am using, customize to produce hatched or hollow characters and then embed the custom font. Does that sound right? I'd actually prefer not to do it this way due to the increase in PDF size due to embedding the font.

However, if I am forced to go down this path I would like to find suitable font that someone has already created rather than having to do it myself. So.. where would I find such a font if I am forced to?
blowagie (284) [Avatar] Offline
#2
Re: Hatched or Hollow Standard Type 1 Font?
I'm not sure I understand the solution you are proposing, but I think the problem is much easier to solve than you think.
Have a look at figure 4.8 in the book. I assume that you want to achieve something like the third 'Quick brown fox jumps over the lazy dog' in that example?
As you can read in the book, a font program describes the shapes of glyphs. When rendered on a page, these shapes are filled, if you don't fill them, but just draw the shapes, you get the hollow fonts.
If you look at figure 11.11, you can see that it's also possible to produce hatched glyphs: second line, second column: the shapes of 'AWAY AGAIN' are drawn and these shapes are filled with horizontal lines; last lines: the shapes are not drawn, only filled with horizontal lines.
sramsden (4) [Avatar] Offline
#3
Re: Hatched or Hollow Standard Type 1 Font?
Ahah! ... yes that's what I am looking for.
The only problem now, is that I am populating an AcroField... so how do I set the Text Rendering mode for a specific AcroField?
The setFieldProperty(..) method takes a limited set of property names.... textfont, textcolor etc. .. but not a text rendering mode?
blowagie (284) [Avatar] Offline
#4
Re: Hatched or Hollow Standard Type 1 Font?
I'm 99% sure AcroFields don't know about 'text rendering'.
Are you flattening the form after filling it?
If so, you could use the form to retrieve the coordinates,
and then add the content at those specific coordinates
instead of using setField().
sramsden (4) [Avatar] Offline
#5
Re: Hatched or Hollow Standard Type 1 Font?
Dang. I was hoping not having to do that, but I am flattening so at least a solution is available to me... Thankyou. I am already adding a barcode via image and coords because the 'barcode font' of the acro field didn't work either... but I'm happy with the solution.

While I have your attention though... can I make a suggestion in regards to the book? Obviously you can't release an electronic copy of it which would be helpful for text searching but maybe you could add a facility on this website which does a search and relays the hardcopy book's page numbers in any results set?
In my case I don't think it would have helped searching for "hollow" or "hatched" but it could be helpful for other things in the future.
blowagie (284) [Avatar] Offline
#6
Re: Hatched or Hollow Standard Type 1 Font?
I'm on vacation for the moment (and online less than an hour a day), but your suggestion is very good. Maybe you should post it on the 'Talk to us' forum, as it could be interesting for all Manning Books. As soon as I return from vacation, I'll see if I can work out a way to automate such a search function.
sramsden (4) [Avatar] Offline
#7
Re: Hatched or Hollow Standard Type 1 Font?
You are a very kind man indeed to be responding to questions while on holiday smilie
Feel free to let this one sit until you return to work....

I have successfully implemented some code to produce a hollow or hatched font as desired (again thanks), but have another query... Is it possible to dynamically determine how wide the resultant text string will be?
For example, 'IW0W' is wider than 'IAIA' and I'd like to adjust the horizontal scale dynamically so I can fill my designated area with the text.
Note that this is for a single line, generally with only 4 characters so am hoping it will be easy to calculate based on font type, font size, character spacing and the specified characters.
blowagie (284) [Avatar] Offline
#8
Re: Hatched or Hollow Standard Type 1 Font?
There are different ways to calculate the width. There's a method in class Chunk and in class BaseFont. Look for something called getWidthPoint; that will give you the width in pt.