I recently was helped to get custom fonts installed and visible on screen in iOS.
This works
Now I need to recreate the same font in a DynaPDFMBS document
I’m using the normal syntax
Call pdf.setfont "MyInstalledFont", pdf.kfsNormal, thesize , True, pdf.kcpunicode
And unsurprisingly , I get this error:
SetFont: Font "MyInstalledFont" not found!
In desktop, I use
call pdf.AddFontSearchPath (specialfolderresources, false)
to tell the PDF where to find the font.
I cannot work out what to do for iOS.
Has anyone done this sucessfully?
Screen display requires me to create a New Font (Fontname,size) each time I change.
The Font generated doesn’t feel compatible with DynaPDFMBS syntax…
Could you run one of the examples to list installed fonts and check what the name of the font is?
Sometimes the file name and the family name or postscript names don’t match.
I thought of that, but the font name is correct: it works for the iOS screen , and it works in desktop environment screen and PDF
The real issue is getting the iOS plugin to see the font file, I suspect.
Thing is, you cant ‘install’ a font on iOS as such.
You just tell iOS that your app has a bundled one you would like to use for this session.
I think I have a solution.
My fonts are in resources, but the AddFontSearchPath needs a folder
This seems to work, more testing required. (Photo.png is a file that is bundled into resources)
var f as folderitem
f = specialfolder.Resource("photo.png").Parent
var szname as string = f.NativePath
call pdf.AddFontSearchPath (szname, true)
AddFontSearchPath can just take a file or folder.
I have more than one font, so I need a folder
Specialfolder.resource is a method, so I needed to get the parent of an object
Tim_Hare
(Tim Hare)
September 8, 2023, 6:32pm
7
But you don’t, do you? Wouldn’t
f = specialfolder.Resources
be enough?
You’ld imagine so, wouldn’t you?
But it isn’t exposed…
Tim_Hare
(Tim Hare)
September 8, 2023, 7:22pm
9
Huh. Is that an autocomplete bug or a documentation bug?
Well, if specialfolder.resources works (I haven’t tried it), then it’s at least an autocomplete bug.
The docs say:
’ * Resources (This property is supported for Android only.)’
Tim_Hare
(Tim Hare)
September 8, 2023, 8:26pm
11
I had not noticed that. Thought I had seen it used elsewhere. Sorry for the noise.
Greg_O
(Greg O)
September 8, 2023, 8:42pm
12
You could point to a file in the Resources directory and then ask for its parent:
Dim f as FolderItem = SpecialFolder.Resource("myfont.ttf").parent
Yup.
Thats what I did up there ^^^