Embedding TTF Fonts

I want to allow my users to select a font for a PDF and then embed it.
Some can not be embedded…

Is there a way for me to know which ones would fail to embed, before trying?

Indeed some fonts cannot be embedded.

I could not find any description of the TTF format where the embedable flag is described.

However, i found this tool which changes the embeddable flag, and comes with the source. You may be able to analyze that source to see where the flag is.

you can read the ttf file in xojo and get that info. I have written code that can pull out that info and more from ttf and ttc files.

Can you share? It would save me a day or two translating the ‘C’ code… :slight_smile:

The OpenType spec can be found here: ISO_IEC_14496-22_2019

Field “fsType”, page 46. From the internal “OS/2” table.

When I get home this evening let me see what state the code is in. It will be API 1 in any case.

IIRC the code has structures from some of the tables in the file… I was pulling out more info than just if it was embeddable.


1 Like

Me too. :slight_smile:

Did you see my last edit? I was pulling out more info than just that flag. BTW there are some platform differences in some things (but not that) with file file having info for both Mac And Windows for some things


1 Like

I checked and I have it on my work computer too. Do you have someplace I can upload it to? (don’t want to Email its from work)

The Demo I have for debugging (which I only have tried on Mac ) loads info on all the TTF (and TTC) files in your font folder into a listbox using this code to fine the fonts:

#if TargetMacOS
  Dim F as New FolderItem("/Library/Fonts", FolderItem.PathTypeNative)
  Dim F as  FolderItem = Volume(0).Child("Windows").Child("Fonts")

Not sure that is the right path for the Windows font folder.


Looks like I dont have a publicly writable area set up anywhere. I’ll try setting something up

Sorted out an upload folder, but I cant send you a private message on this forum, it seems?

I have no clue why. In the past I have gotten PMs here! Are you on the “other” forum?


Not any more, Here, where I would get a ‘message’ button, it just comes up with ‘Profile is private’ … looks like the property is linked. If you can PM me, that would probably work.

If you have Google Drive, OneDrive or DropBox, you can share a file solely with a correspondent.

I picked this for iCloud:

1 Like

I never set that AFAIK… If I did it accidentally somehow, I would like to know how to unset it… If I did not set that and Xojo In Did I would like to know why.

Its probably this setting:

Just checked… That is not set… Kind of makes me wonder how my account got set to private!


Maybe this one:

That was it!

I may have set that, not realizing it would have an effect on PM’s!


Code works nicely on a Mac for the files it can find.
Thank you!

I’ll test it on Windows soon. :slight_smile: