-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to load DLL 'freetype6' or one of its dependencies #32
Comments
Thank you for this bug report.
I noted in the stack trace that the exception message appears to be in
French. Can you confirm which language settings are installed on your
machine and dotnet runtime. I suspect that either sharpfont or I have an
internationalization bug that is looking in the wrong place for the
FreeType binary. I would love to work on this with you.
Sorry but I am a monolingual American. (I did take 3 years of French in
high school, but that was 30 years ago.) I suspect this may not be the
only internationalization bug that you shake loose. (My font mapping for
European languages should be pretty secure. I am almost sure that I have
large feature holes in right-to-left and vertical asian languages, but I am
waiting until I get real files with problems before I implement them.
Let me know what your configuration is and I will see if I can duplicate
your bug locally.
JDM
…On Tue, Jan 3, 2023 at 9:19 AM Mathieu Jolivet ***@***.***> wrote:
Hello,
I tried to use Melville.Pdf on a .NET7 project (on a windows machine), and
when testing the code in the readme, I had the following error :
System.TypeInitializationException: The type initializer for 'Melville.Pdf.Model.Renderers.FontRenderings.FreeType.GlobalFreeTypeResources' threw an exception.
---> System.DllNotFoundException: Unable to load DLL 'freetype6' or one of its dependencies: Le module spécifié est introuvable. (0x8007007E)
at SharpFont.FT.FT_Init_FreeType(IntPtr& alibrary)
at SharpFont.Library..ctor()
at Melville.Pdf.Model.Renderers.FontRenderings.FreeType.GlobalFreeTypeResources.LoadFontLibrary()
at Melville.Pdf.Model.Renderers.FontRenderings.FreeType.GlobalFreeTypeResources..cctor()
--- End of inner exception stack trace ---
at Melville.Pdf.Model.Renderers.FontRenderings.FreeType.FreeTypeFontFactory.FromCSharpStream(Stream source, Int32 index)
at Melville.Pdf.Model.Renderers.FontRenderings.FreeType.FreeTypeFontFactory.FromStream(PdfStream pdfStream)
at Melville.Pdf.Model.Renderers.FontRenderings.FreeType.FreeTypeFontFactory.FromStream(PdfStream pdfStream)
at Melville.Pdf.Model.Renderers.FontRenderings.FontReader.CreateRealizedFont(PdfFont fontStreamSource, FreeTypeFontFactory factory)
at Melville.Pdf.Model.Renderers.DocumentPartCaches.DocumentPartCache.FindAndStoreValue[T,TSource](TSource source, Func`2 creator)
at Melville.Pdf.Model.Renderers.DocumentPartCaches.DocumentPartCache.Get[TSource,T](TSource source, Func`2 creator)
at Melville.Pdf.Model.Renderers.RenderEngine.FontFromDictionary(PdfDictionary fontDic)
at Melville.Pdf.Model.Renderers.RenderEngine.SetFont(PdfName font, Double size)
at Melville.Pdf.LowLevel.Parsing.ContentStreams.ContentStreamContext.HandleOpCode(ContentStreamOperatorValue opCode)
at Melville.Pdf.LowLevel.Parsing.ContentStreams.ContentStreamParser.RunOpcode(UInt32 opCode)
at Melville.Pdf.LowLevel.Parsing.ContentStreams.ContentStreamParser.ParseReadResult(BufferFromPipe bfp)
at Melville.Pdf.LowLevel.Parsing.ContentStreams.ContentStreamParser.Parse(PipeReader source)
at Melville.Pdf.Model.Renderers.RenderEngine.RunContentStream()
at Melville.Pdf.Model.Renderers.DocumentRenderers.DocumentRenderer.RenderPageTo(Int32 oneBasedPageNumber, Func`3 target)
at Melville.Pdf.SkiaSharp.RenderWithSkia.ToSurfaceAsync(DocumentRenderer doc, Int32 oneBasedPageNumber, Int32 width, Int32 height)
at Melville.Pdf.SkiaSharp.RenderWithSkia.ToPngStreamAsync(DocumentRenderer doc, Int32 oneBasedPageNumber, Stream target, Int32 width, Int32 height)
I use Melville.Pdf.SkiaSharp 0.2.0. It implicitely referenced
SharpFont.NetStandard 1.0.5. I tried to also install SharpFont 4.0.1 but
nothing changed.
—
Reply to this email directly, view it on GitHub
<#32>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AHH3QDXACX2QRIJWZMSSQTTWQQYQTANCNFSM6AAAAAATPXTESU>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
You are right, I am french, and I only have French language installed on my computer. Same for everything regarding format. |
I just installed a French version of windows 10 on a virtual machine. I can repro the bug exactly as you indicated above. Let me setup a remote debugger and see if I can figure out what is going on. |
I now know what is going on. Freetype6 (as distributed by SharpFont) depends on MSVCRT120.dll. (A version of the microsoft visual C runtime.) I happened to have MSVCRT120.dll in my windows folder, and I will attach it to this comment. The file is not present on the plain-vanilla/french image I have in the virtual machine. (I now suspect that the bug has nothing to do with language, and everything to do with being a plain-vanilla windows install.) If I copy MSVCRT120.dlll to the [App]\bin\debug\net7.0-windows\lib\x64 (which puts it right next to freetype6.dll) then everything works. I can break and fix the problem by adding or deleting that single file. I would really appreciate it if you could confirm that this hack makes it work on your machine as well. This bug was reported to sharpfont 4 years ago (Robmaister/SharpFont#119) and has not been fixed so it is probably time to fork the repo and link a version of freetype without external dependencies. This will take me a little bit of time. If I am going to fork the repository, I an going to fix some other problems that I do not like as well. See also: |
So I think I got this fixed -- with a hack. I created a new Nuget package, Melville.Sharpfont that packages msvcr120.dll into the nuget package. I believe that fixes this issue for windows 32 and windows 64. I had a little problem that I am in the middle of an effort to make a bunch of work to make most of the library's members internal. I am halfway done with that. In order to make this available without breaking the version, I released a prerelease version 0.3.0-preview1 that incorporates the DLLs needed to fix this problem, but the internal/public status is an odd state. When I finish locking down and documenting the interface, I would like to release a 0.3 version with a lot of the public surface area removed, This is a big blocker to going to version 1.0. |
Hello,
I tried to use Melville.Pdf on a .NET7 project (on a windows machine), and when testing the code in the readme, I had the following error :
I use Melville.Pdf.SkiaSharp 0.2.0. It implicitely referenced SharpFont.NetStandard 1.0.5. I tried to also install SharpFont 4.0.1 but nothing changed.
The text was updated successfully, but these errors were encountered: