Chlumsky / msdf-atlas-gen

MSDF font atlas generator
MIT License
802 stars 177 forks source link

iOS, Android support #35

Closed mon9403 closed 2 years ago

mon9403 commented 2 years ago

Hello there,

Can we integrate msdf-atlas-gen on the mobile apps and generate msdf type atlas on mobile for drawing text in real-time?

Thank You for Your hard work.

Chlumsky commented 2 years ago

I don't know, I'm not a mobile developer, but I don't think there's anything that would prevent it, have you tried?

mon9403 commented 2 years ago

There is way to Compiling C++ code in iOS, Android.

Here is answer https://stackoverflow.com/questions/15211277/compiling-c-code-xcode-for-ios-and-android-is-it-real

So i want try it this week, i will let you to know.

saidwho12 commented 2 years ago

Your question is unrelated to msdf-atlas-gen, but I will answer you. There's two ways of using C/C++ on Android with the NDK either with the JNI method or the native-activity method. Good luck on it though cause you still have to write some XML/Java code.

mon9403 commented 2 years ago

@saidwho13 actually i want to know, will msdf-atlas-gen work on mobile app for real-time drawing, i mean what is algorithm speed? how much time it's take to generate atlas on mobile app or on desktop?

saidwho12 commented 2 years ago

@mon9403 It's a cpu generator so it's not that fast, if you enable omp (multi-threading) you can get a significant performance boost depending on the number of cores of the processor. It's probably not enough though for dynamically caching glyphs of random fonts especially if they have more complex shapes. My current project of year and a half is a fast font shaper, and it will also have an optional renderer which will utilize a gpu msdf generator and glyph cache. I can't talk much about it though since it's still in the experimental stage. There's msdfgl though that's a proof of concept of this and you could use it if speed is an issue. If you are only generating an atlas once at loading time, then msdf-atlas-gen is fine. If you want I can show you my results of using msdfgen in my renderers, you can get very good crisp results, scalable fonts, do cheap font effects like shadows and outlines. This is the advantage of this method and it's fast on gpu the shader to actually render the glyphs is baby simple.