Closed jahu00 closed 1 year ago
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.
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.
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).
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.
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.