PDFDoc Fonts embedding questions

TrueType fonts can have table in their header information called OS/2. In that there is a Field called FSType that is a bitmap which, if present, specifies embedding permissions.

Does PDFDocument.AddFonts look at and respects those permissions if they are there?

Also what types of fonts/file types are supported?

I assume .ttf…

What about .ttc or .otf?

-Karen

Hum,

OS/2 like IBM OS/2 ? Quite strange.

See:

Thanks for the link !

All my fonts are embeddable, but you cannot expect that from every font around.

If the embeddable flag is not there (it has been there for decades and can apply to TTF and OTF), chances are AddFonts should trigger an error.

I think Xojo inc should comment on what the behavior actually is and if they support OTF as well as ttc files

As you are a font expert let me ask you about the flags. The info fro TSType I found said

Note: In the following algorithm, x represents a bit that may be ignored.

But 2 things are not clear to me… From hat this says I would interpret no bits sets to be embeddable… But is that a safe assumption or might to jus mean step author simply did not use that field and might restrict embedding in the human readable license? In other words should I depend only on setting that explicitly permit embedding?

Also I read that the OS/2 table itself is optional.

If the OS/2 Table is not present, should I assume the font is or is not embeddable? Should I not assume it is in that case unless a human readable license says it is?

Thanks,

  • Karen

I am sorry, I did not dive into the font structure, since the tools I use give me access to the embeddable feature through the UI.

You can actually download a free evaluation version of FontLab 7 here:

Open the font, and select “Font Info” in the File menu.

I can tell you that most every font I looked at is not embeddable.

@Javier_Menendez

Are the FSTYPE permissions flags in the OS/2 Table (if present) taken into account with AddFonts?

Also do you currently support OpenType (.otf) and TrueType Collection (.ttc) files?

Thank
-Karen

Thanks

I will compare what the OS/2 FSTYPE flags tell me to what the tool says.

-Karen

1 Like

@Javier_Menendez

More questions about fonts…

First the old ones…
Can you clarify support .otf ,.ttc, .otc font files as well a opentype fonts that are NOT based on truetype outlines… And will addFonts NOT embed fonts that have the bit sent not to allow embedding?

Now the new question:
Fonts can have more styles besides plain, Bold Italic and BoldItalic… the can have different weights like Light, Mediums Semi-bold and Black (and they are often packaged together in etc font file). Is there any way to use these fonts styles in the Xojo PDF implementation?

BTW I have written some Xojo code to get the font info both from ttf font files as well as for all the fonts contained in etc files where on can get information on all the styles/weights available…

One thing I don’t know how to deal with are variable weight fonts with respect to that.

-Karen

I just checked… Unless I messed up my code, almost all of the fonts installed on this Mac are embeddable… the only ones that definitely are not are:
Futura
Gill Sans
Ayuthaya
Brush Script
NISC18030

There are 2 fonts that do not have an OS/2 table and so info on licensing requirements are not specified:
Apple Gothic
Apple Myungjo

Which probably means they are embeddable but I don’t know for sure.

-Karen

I guess I’m not going to get a reply.

-Karen

OTF means “OpenType Font”. It usually contains PostScript outlines.

TTC is actually a whole family of TTF fonts. A bit like in the past several fonts could be added to a suitcase.

Download Fontlab, and use it to look at the fonts permissions. Then you can compare with the values you found.

I know…BUT by the spec it can also contain truetype outlines. I know the Xojo implementation supports truetype outlines … I was asking if it supported postscript ones as well.

I know… I looked at the TrueType and OpenType specs and wrote Xojo code to read the tables I care about. I can pull out the the style information on each font in the file… Usually the names of the styles are supplied in the name table in all the languages the fonts support… I wrote my code to pull out the english ones so I could read them! :wink:

I can also pull out the name of the company that made it, copyright info , as well as for most fonts , if the font is embeddable ,and if embeddable if the font grants permission for the document to be editable or if the font can be subsetted when embedded, as well as font metrics such as units per em… This is for any truetype or opentype font.

They wanted me to give them my contact info and I don’t need more spam so I passed…

At this point I am pretty confident that my code is reading the permissions bit map from the font file correctly, as I know the other info I am pulling out is correct.

But maybe I will download it just to check one Font that my code says is embeddable and one that says it is not.

  • karen

@Karen:
Create a free Yahoo mail and use that to get what you want. An if there is SPAM there, you do not care… And you will know for sure from who came that SPAM.:rofl:

Hi @KarenA

.ttf, .ttc and .otf (TrueType) fonts are supported on PDFDocument. You’ll get the best experience using .ttf font files. With these you can use any of the provided styles, while when using .otf the mileage may vary (usually limited to Regular face).

If the font has the copy protection flags set enabled it is not embedded.

Also, and if you are on macOS, probably you will find of interest the example project found at Example Projects > Platform-Specific > macOS > macOSSystemFonts.xojo_binary_project

Thank you for your support!

The free open source FontForge tool is similar to FontLab Studio although a bit clunkier.