Hello together,
I am new in this Forum and I want to thank everbody in advance for helping me.
I thougt it wouldn't be a big thing to embed a truetype font but obviously for me it is.
The facts: I try to embed a tt-font which is located at the highest level of my project into a pdf document with vb.net (framework 4) and MigraDoc 1.31. I read much on how to do that so in my opinion it should work like this:
-------------------------------
Imports PdfSharp.Drawing
Dim FontCollection = New PdfSharp.Drawing.XPrivateFontCollection
FontCollection.Add(New Uri(BaseURI), "./#FamilyName")
Dim xFont = New XFont("FamilyName", 11)
-------------------------------
When I run the program I get always "Cannot get a matching glyph typeface for font 'FamilyName'."
- For FamiliyName I tried the FontName and FontFileName.
- For BaseURI I tried a path like file:///c:/ and
pack://application:,,,/AssemblyName;component/. I tried both BaseURI also with FontFileName at the end.
- I tried to use SystemFonts like Tahoma, what certainly worked.
- I tried around with artificial FamilyNames like "qkjhdflkqfh", what didn't make any difference
I am wondering that according to the examples, it should work without ever mention the FontFileName. Is that right? And what about this FamilyName? I know what it is but I never created one and assigned my font or something like this. Could some please explain me that, because I already spent hours fixing that.
Thanks
Timo