Difficulty using some fonts in DynaPDFMBS

Hi all.
When setting a font in DynaPDFMBS, I have no trouble with names such as Arial, Copperplate, Papyrus

But some fonts will not ‘stick’.
One example is Futura or Futura PT

Attempts to set that font using SetFont or SetFontAnsi fail, so I revert to Arial
The fonts are installed and available to other apps.

Reading up about it in DynaPDF manual, I thought I had a chance by switching to SetFontEx (which tries all 3 ways to identify the font by name), but without success.
(And DynaPDFTableMBS doesnt have a SetFontEx method anyway, so even if it had worked, I’d have a different problem afterwards)

I’m not expecting a miracle cure, but does anyone know what makes a font like Futura not want to play ball?

Please try using the postscript names of the fonts - Futura, for example, has no font named “Futura”, but “Futura-Medium”, “Futura-MediumItalic”, “Futura-Bold” etc.

Call pdf.SetFontSelMode(1)

1 Like

Maybe first you run the example project, that lists all fonts with their names and attributes in a list, so you can lookup your Futura font and learn about what’s font types are available?

Maybe first you run the example project, that lists all fonts

It’s worth a try.
Right now, I know that in a PDF which does work (created by Pages) ,
the font is shown as FuturaPT-Light
But that name doesnt work, nor does ‘FuturaPT’ with a style of light

That cannot be correct, surely? AAAAAI ?

It does have no Postscript name, incidently.
But as I say, Pages can handle it.

In PDF files the font names get prefixes to make the name unique.

Can you run the font list example?
It should show whether DynaPDF sees the font.

I think you meant the ‘Font Mapping’ sample, which I have now found.
That shows this particular font as Family name ‘Futura PT Light’ … spaces, no hyphens.
This is a minefield…
Given that my users are being asked ‘what font do you want’, I need to find a better font selector than just the usual iteration through the Fonts() collection.

No, something like the “List fonts” or “Show SysFont Fonts” to see whether DynaPDF finds the fonts.

Can also be non embed able font. Some fonts have them self’s flagged as not allowed to embed.

Some fonts have them self’s flagged as not allowed to embed.

This is true, and known. But the font was working when used with Pages into a PDF.

After some extensive testing, I find:
Most TTF fonts use the same name for

  • Xojo’ Fonts() representation
  • Family Name
  • PostScript Name

Thank you, those considerate designers…

But this particular Font chose to appear to
Xojo as Futura
Family Name as Futura PT
and Postscript name either missing, or Futura PT Light (depending upon where I looked)
and inside the PDF as FuturaPT-LIght

…gimme a break… :wink:

The PDF font search can be set to look for Name, or Family, or PostScript when you start.
If you use SetFontEx, it will (in theory), try all 3 for you, but the DynaPDFTableMBS doesnt have a SetFontEx method

I have a solution.
In the end, I have explicitly set searching to be by Family, and I have used Christian’s font examples to cross check the name of the selected font in my preferences screen before anyone goes near being able to create a PDF for real.
if it fails, I fall back on Arial.

I dont have a solution.
Works on Mac, doesnt work on Windows. Pah!

On Windows, using pdf.GetSysFontInfos to assemble a list of fonts doesn’t find the installed font at all.
GetSysFontInfos lists a lot of fonts (including one thrown together by me) which are by no means System fonts, but ignores some perfectly OK ones which do work in a PDF and can be embedded.
I’m confused.