Is compose-desktop feasible for desktop-only apps?...
# compose-desktop
v
Is compose-desktop feasible for desktop-only apps? Or am always going to be constrained by its mobile-centric roots? I'm needing tooltips, file pickers, font pickers, that sort of thing...
t
Is compose-desktop feasible for desktop-only apps?
Yes. you can develop desktop only apps.
j
Yes, as @theapache64 mentions, it's entirely possible to build desktop only apps. In addition to the full power of the canvas (allowing you to implement nearly any widget you want), Compose-desktop also offers good swing interoperability, allowing you to embed swing widgets in your compose app and vice versa. Between those two features, you should have everything you need to build a desktop app. And of course, we will continue to add more desktop features over time.
💪 1
v
I think I have just hit an insurmountable problem, sadly. I want to draw text in any system font on my desktop - and I'm pretty certain that Jetpack Compose can't take a
java.awt.font
and use it to style text. Which rather renders my desktop app idea dead in the water 😢.
j
I'm pretty sure the java/system fonts are all just TrueType fonts, and that Compose can load TrueType fonts, so with a little digging it shouldn't be hard to find the file location via swing and load it with Compose.
v
Sadly... probably not without reflection. https://stackoverflow.com/questions/2019249/get-font-file-as-a-file-object-or-get-its-path . I'll keep looking; I might have to start hard-coding the Windows C:\Windows\Fonts\... folder. Bad idea, I know.
I've raised a ticket, https://github.com/JetBrains/compose-jb/issues/558, and I have found a creatively dangerous solution abusing a
toString()
method call.