mainFree UCS Outline Fonts - Support: sr #108357, Properties confusion / Usage advice

 
 

sr #108357: Properties confusion / Usage advice

Submitter:  None
Submitted:  Tue 06 Aug 2013 07:35:15 PM UTC
   
 
Category:  None Priority:  5 - Normal
Severity:  3 - Normal Status:  Not a bug
Privacy:  Public Assigned to:  Stevan_White
Originator Email:  -email is unavailable- Open/Closed:  Closed
Operating System:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Tue 06 Aug 2013 11:11:34 PM UTC, comment #4: 

Hi,

My first recommendation is: don't panic.
Trying to write a PDF generator sounds to me like panic.
To write code to take apart OpenType/TrueType files is not trivial and not fun. 
Even if you have libraries to do each of these things ... you're in for a huge amount of work.

PDF font embedding involves a dictionary of graphical parts of glyphs from the fonts, together with positioning information for each appearance of each glyph in the document.  The positioning info has to be calculated by font rendering software.  The glyph table of the font is totally dismantled, and other tables are used to do replacements and fine positioning.

This is severely non-trivial.

FreeMono doesn't have a large number of tables, and as it's a monospace font the positioning is of less importance.  But still.

I'm wondering, if you're working in a historical simulator, why not have your app generate something like HTML?  You could specify the font and its properties, and the width of the page using CSS.  That file could then be moved to a Windows box, where the HTML could be exported as PDF by several different means. 

Cfont Pro seems to be ignorant of multi-byte character encodings.  That's why the number staops at 255.  Not sure about the 30.  In my case, the font was installed, maybe that explains the difference. 

If you want to have a look at the innards of fonts, I can recommend Fontforge (runs in Linux).  It's horribly complicated and buggy as hell, but it's also pretty sophisticated.

The Fontforge SFD format is a sort of text dump.

Cheers!

Steve White <Stevan_White>
Group administrator
Tue 06 Aug 2013 10:21:47 PM UTC, comment #3: 

Thanks for the quick responses.

Answers:

PDF-writing software - it's software I'm writing in a historical machine simulator.  Not point and click.  Since I'm emulating various multi-lingual devices, I need to use Unicode...and can't rely on the standard PDF fonts.

So I get the joy of decoding the various specs and figuring out how to embed the font.  It doesn't appear that I can just embed the whole .ttf file.  (That would be too easy.)  I think I need to pull some of the tables out and stuff them into the PDF in slightly different format.  But I'm not sure - the specs are rather opaque.  It's the technical details of how to embed that I could use some help with, not the license. 

Cfont pro - the version pointed to by the link - 4.0.0.20.  Same as you tried.

FreeFont - just downloaded today.  The 2012 version. freefont-ttf-20120503.zip, 6,076,197 bytes.  I'm looking at FreeMono.ttf, but I get the same results with bold, oblique and boldoblique.

I'm on Windows 7, thru this month's patches.  So we should see the same results.  Attaching a screen capture so you can see that I'm not hallucinating...and all the version data (if cfont pro can be trusted for that.)

FWIW, I don't have the font installed on windows (and don't plan to.)  Just need it in the generated PDFs.

If FreeMono has thousands of glyphs, why is last character only 255?  And first should be 32, not 30.  I'm willing to believe that CFont  is buggy.  Suggestions for a better tool?  I'm new to this world.

Can you point me to a source file that shows the TTF format (C structs would be fine)?  I can certainly decode a hex dump and get CFont pro out of the picture.




Anonymous
Tue 06 Aug 2013 08:46:00 PM UTC, comment #2: 

Hi again,

I just installed CFont Pro 4.0.0.20, and ran it on Windows 7.
I looked at a recent copy of FreeMono (a testing one, yes),
and it reports

First Character 30
Last Character 255

This is probably a bug in CFont Pro: FreeMono has thousands of glyphs.

But it's also different from your results.

  • Which version of FreeFont are you using?  The last release was in 2012.


Steve White <Stevan_White>
Group administrator
Tue 06 Aug 2013 08:23:21 PM UTC, comment #1: 

Hi,

PDF
---

Normally, to produce a PDF, depending on the applicaition, you may "print to file" using the Print dialog, or "Export as PDF".
In Linux, this is very easy.
Nothing more needs to be done.

I do it all the time, using FreeFont.  Works like a charm.

You said "special software".  Don't know what that means.

On Windows, there isn't any default means to print to PDF.  I know there are several printer drivers that produce a PDF from a print job.

If you open the PDF with (say) Acrobat, you can see which fonts were embedded under File->Properties.

FreeFont licensing and PDF
--------------------------

Yes, you can embed the font in a PDF without incurring the license in any way.

This is what the "font execption is all about.
http://www.gnu.org/software/freefont/license.html

CFont Pro
---------

I haven't tried CFont Pro in a while.  I don't know what it's talking about.  I'll give it a try.

Steve White <Stevan_White>
Group administrator
Tue 06 Aug 2013 07:35:15 PM UTC, original submission:  

I would like to used FreeFont to render Unicode in a PDF file that's created by some special software.  The FAQ mentions that this is OK from a licensing point of view, but there are no technical details.

Up front: I'm not expert at fonts/typography and I'm confused. 

I have tried to make sense of the PDF spec, and rapidly get lost in the cross references and jargon.

However, I do have FreeFont questions:

I have looked at FreeMono.ttf with cfont Pro. (http://veign.com/cfontpro/download.php)

It says First Character is 0, Last Character is 0 and Max Char Width is zeo.  It also says Monospaced is False.  And there are no entries for pitch and weight.  This doesn't seem right.

PDF seems to want real values for these.  Further, the specification (see http://www.adobe.com/content/dam/Adobe/en/devnet/acrobat/pdfs/pdf_reference_1-7.pdf p. 430ish) talks about encoding tables and vlags that the font should have.


Questions:

a) Why are the font attributes all zero?

b) Has anyone successfully written software to embed FreeFont fonts in a PDF file?  Can one simply embed the whole file as an object, or does one have to parse the font file and extract subsections?  If the latter, is there a simple explanation of the format of the ttf file?  Are you writing platform/encoding IDs?

This seems like it ought to be simple - define some mappings from ASCII input to  collections of Unicode glyphs from FreeFont as a PDF Font, and just display text; switching mappings as needed.  I'm obviously missing several somethings...


Thanks in advance for any clarifications/advice.

P.S. No, switching to a PDF manipulation library isn't an option for reasons to involved to go into here.

Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #28778:  Untitled.png added by None (155KiB - image/png)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by Stevan_White (Posted a comment)
  • -email is unavailable- added by None (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 5 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2015-03-24 Stevan_White StatusNeed Info Not a bug
        Open/ClosedOpen Closed
    2013-08-06 None Attached File- Added Untitled.png, #28778
    2013-08-06 Stevan_White StatusNone Need Info
        Assigned toNone Stevan_White

    Back to the top

    Powered by Savane 3.13-caa5.
    Corresponding source code