-
Notifications
You must be signed in to change notification settings - Fork 109
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
How is the Freetype native binary installed on iOS? #102
Comments
Based on this link it appears as though This StackOverflow question states that modifying the .dll.config should work, though no one was able to confirm. I don't have an iPhone or the toolchain setup to see if this works, but I could try and see if anyone I know would be willing to run some test code for me. @manu-silicon wrote the original changes, so perhaps he has the capacity to test such a change? The original change, #80, is supposed to work for UWP and Android as well, though perhaps it wasn't declared in the profile selected for PCL. Mac has been supported for a very long time, |
What causes it to be packed into the binary, since neither |
I think I'm starting to understand, but still some open questions. So here's a list of all supported platforms, with my understanding of how this works:
|
Yep. If you're publishing your own software that is more complex, you might also distribute both versions of the dll and do a runtime selection based on the host architecture. Or select a different version of MSVC that you choose to depend on instead.
Downstreams will typically publish a package on a package manager, and will mark freetype as a dependency to be installed before that package will be installed. So basically yes, assume that it is installed, or enforce installation prior to running the program/game
It should "just work" as long as the dll is included in the app package. Some MSBuild work might be handy to automate this if the
Will also just work. If the dllmap to linux doesn't resolve, Mono will search for variants of the existing dll name, and I believe some version of FreeType ships with Android.
I'm not 100% on the details here, but as I understand it, everything is packaged into one native binary by Xamarin. The native portion of the app essentially just bootstraps a Mono environment and hosts your C# assembly that's embedded in the binary. All your other native dependencies are supposed to be statically linked into this same binary. Mono uses the magic string "__Internal" to mean "the binary that's executing this code", since that's the one binary you're allowed to have at all. Depending on the details, a .dll.config might not actually be included here at all, ,making this solution impossible or just really hard. I think we'll need someone with the right environment to test some of this stuff for us eventually. I'm all about killing off the iOS specific package, so if there's some way to intercept DllImports and use your iOS detection function, then that will be our backup to the .dll.config change |
More questions :)
|
Sigh. You guys have absolutely no idea about how Mono works. Mono implements gdiplus, which Mono's implementation of System.Drawing and System.Windows.Forms depends on, via a whole bunch of libraries, one of which is freetype. This is on non-windows. On windows, mono uses the native microsoft's gdiplus so mono does not depends on freetype through gdiplus; but gtk# depends on gtk and gtk depends on cairo which in turn depends on freetype. So anything that has a GUI with mono basically can assume freetype is present, except mono on windows with winforms. |
You are right, Xamarin.Mac does not need or ship freetype. You want to know whether freetype can be assumed to be around, I gave you the answer: gtk# on all platforms and winforms on non-windows. |
FWIW, mono is not a variant of microsoft CLR, although microsoft now owns xamarin. There are distinct differences (and different bugs) between mono's implemention of various CLR libraries vs Microsoft's. |
? Xamarin uses microsoft CLR? The last time I checked (around Christmas?) , netcore was still essentially windows only... |
Yup, freetype makes little use of CRT/Win32 calls. The most would be opening a file to read it's contents. If that doesn't work because of the sandboxing, there's a For ARM, it looks like the solution is to simply build an ARM version of freetype and use that, like how OpenCV does it among others: https://blogs.msdn.microsoft.com/lucian/2015/11/27/opencv-building-uwp-binaries/
Part of the build process for a Xamarin app is to statically link freetype into the final binary, and you'd have to build freetype yourself for that currently. I suppose UWP ARM and iOS builds of freetype would be helpful in this case |
This is where I wish github markdown supported tables :) Can we agree on this goal: the user only needs to include the
All told, that is quite a lot of work. But we'll get there. :) And along with that - HarfBuzz! |
FYI I will open separate issues for each platform, intended to be closed only when each platform is fully verified. |
Chill with the condescending tone, please. No, we don't all know everything about Mono, but I'd like to at least keep the discussions constructive.
Not all distributions of Mono have to include libgdiplus or cairo. One example would be Unity3D.
Yup, it's a rewrite of the runtime back when the CLR was only "open" in that the spec was published as an ECMA and ISO standard and everything else was closed source. I'm aware that they are separate runtimes.
That's not what I said, Mono can be embedded into a native executable and I believe this was what Xamarin did in order to bypass restrictions on iOS apps. Unity3D does this as well, which is how C# scripts can be hosted inside their C++ engine. .NET Core SDK is currently available for Windows, OS X, and Linux as well: https://www.microsoft.com/net/download/core If you are running on Linux or OS X, though, SharpFont won't work as they're still trying to figure out DLL mapping: https://github.com/dotnet/coreclr/issues/930 |
Yes, this should be the goal.
I believe FreeType also has a system of loading fonts from a file stream, haven't taken the time to look into the feasibility of making that interop properly with C# streams.
Definitely still needs a test, hopefully it's just hanging around /usr/lib or something.
I misspoke/forgot - only older versions of OS X distributed freetype.6.dylib, so now we depend on the copy distributed with the default Mono package.
Be prepared for a mapping to |
In that case, is it possible to get help re: iOS? Just in terms of understanding where it currently finds the library. There are many threads on the internet of people wanting to build FreeType for iOS, which leads me to believe that it does not come preinstalled on the system. |
Yeah, it's not pre-installed as far as I know, the user must download, build, and link it themselves. I tried to explain this earlier, probably a bit poorly:
|
How is the iOS Freetype binary located and installed? The p/invoke code previously used the path "__Internal", which I removed as part of the Portable unification checkin. But I wasn't able to locate a binary with that name either in this repo or in the Dependencies repo. So where did that come from?
We should also add support for
The SharpFont PCL will suffice, together with per-platform native freetype binaries. A single nuspec can handle this, I think, by having the correct binaries in the correct subfolders of
lib
.The text was updated successfully, but these errors were encountered: