Skip to content
This repository has been archived by the owner on Oct 17, 2023. It is now read-only.

Figure out how to use SKIA in MAUI #6

Closed
jahu00 opened this issue Jun 23, 2023 · 5 comments
Closed

Figure out how to use SKIA in MAUI #6

jahu00 opened this issue Jun 23, 2023 · 5 comments

Comments

@jahu00
Copy link
Owner

jahu00 commented Jun 23, 2023

No description provided.

@jahu00
Copy link
Owner Author

jahu00 commented Jun 23, 2023

Following this (https://ewerspej.hashnode.dev/how-to-write-a-custom-control-for-net-maui-using-skiasharp) tutorial I was able to make a simple SKIA based control.

If there are problems with SKIA on some platform (like Android), I can try replacing it with GraphicsView.

@jahu00 jahu00 closed this as completed Jun 23, 2023
@jahu00 jahu00 reopened this Jun 23, 2023
@jahu00
Copy link
Owner Author

jahu00 commented Jun 23, 2023

SKCanvasView is easier to start using, but I can't get it to use a font from the resources. I'll try GraphicsView or SkiaGraphicsView next. Having 3 ways to do the same thing isn't helpful.

@jahu00
Copy link
Owner Author

jahu00 commented Jun 25, 2023

App crashes when I try to use GraphicsView on Windows, but after a lot of trail and error I figured out that I can embed fonts as resources and load them into SKIA (with SkiaGraphicsView). Trying to load MauiFont proved to be next to impossible (I can't access FontCollection, it's not even available through DI).

I'll probably need a manager for loading all the needed resources once and keeping them in memory, but that can wait.

Once I am successful rendering Japanese text on Windows, I need to try it also on Android. App needs to run on Windows for development, but the real target is Android.

@jahu00
Copy link
Owner Author

jahu00 commented Jun 25, 2023

Not only MAUI app worked on Android (both 7 and 13) without much hassle, but SKCanvasView also worked with custom font as well.

There are some issues, control width appears to be wrong (something to solve in another issue).

@jahu00 jahu00 closed this as completed Jun 25, 2023
@jahu00
Copy link
Owner Author

jahu00 commented Jul 20, 2023

There is a known issue concerning using MAUI fonts on Windows with unpacked app (as opposed to a store app). They appear to not work at all.

dotnet/maui#9104

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant