-
Notifications
You must be signed in to change notification settings - Fork 68
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
Add OTF Font in Xamarin.Forms #28
Comments
Yes see #20 |
@donmesserli Please respond if the referenced issue helped you 😀 |
I saw that question; but the answer is very terse. Can you provide a code snippet and tell me where in my application I need to call it? |
CSharpMath.SkiaSharp.MathPainter painter = ...;
using (System.IO.Stream otf = ...)
painter.LocalTypefaces.Add(new Typography.OpenFont.OpenFontReader().Read(otf));
//use painter as usual |
I'm doing this in Xamarin.Forms. Not using a painter. |
Then try |
That's what I want to do; but I still need a code snippet. |
The code is as above with GlobalTypeFaces instead of painter.LocalTypefaces. using (System.IO.Stream otf = System.IO.File.OpenRead fileName)
{
CSharpMath.Settings.GlobalTypefaces.Add(new Typography.OpenFont.OpenFontReader().Read(otf));
} Put this somewhere where it will be called when your app starts, i.e. before rendering happens. |
Also applicable: CSharpMath.Forms.MathView mathView = ...;
using (System.IO.Stream otf = ...)
mathView.LocalTypefaces.Add(new Typography.OpenFont.OpenFontReader().Read(otf)); |
@donmesserli Please respond if the answers helped you 😃 |
Thank you! It was a lot of help. |
Is it possible to use a different OpenType font than the one included in the library without building the library from source? Are there calls my app can make to load and use a font? If so, can you provide instructions on how to do it?
The text was updated successfully, but these errors were encountered: