Skip to content
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

Error when rendering in Compose Preview #24

Open
OskarPersson opened this issue Sep 24, 2024 · 0 comments
Open

Error when rendering in Compose Preview #24

OskarPersson opened this issue Sep 24, 2024 · 0 comments

Comments

@OskarPersson
Copy link
Contributor

When trying to render any MathView in a Preview, I get an error. My Composable looks like this:

@Composable
private fun _MathView(latex: String, modifier: Modifier = Modifier) {
    val currentTextStyle = LocalTextStyle.current.merge(
        MaterialTheme.colorScheme.onBackground
    )

    // Extract the font size from the current text style
    val currentFontSize = currentTextStyle.fontSize

    AndroidView(
        modifier = modifier,
        factory = { context ->
            MTMathView(context).apply {
                this.latex = latex
                this.fontSize = MTMathView.convertDpToPixel(currentFontSize.value)
                this.textColor = currentTextStyle.color.hashCode()
            }
        },
    )
}

And the error looks like this:

java.lang.UnsatisfiedLinkError: no main in java.library.path: C:\Users\oskar\AppData\Local\Programs\Android Studio 2\bin;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;...
	at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2434)
	at java.base/java.lang.Runtime.loadLibrary0(Runtime.java:818)
	at java.base/java.lang.System.loadLibrary(System.java:1993)
	at com.pvporbit.freetype.FreeType.<clinit>(FreeType.java:210)
	at com.agog.mathdisplay.render.MTFontMathTable.<init>(MTFontMathTable.kt:90)
	at com.agog.mathdisplay.render.MTFont.<init>(MTFont.kt:23)
	at com.agog.mathdisplay.render.MTFont.<init>(MTFont.kt:13)
	at com.agog.mathdisplay.MTFontManager$Companion.fontWithName(MTFontManager.kt:27)
	at com.agog.mathdisplay.MTFontManager$Companion.latinModernFontWithSize(MTFontManager.kt:44)
	at com.agog.mathdisplay.MTFontManager$Companion.defaultFont(MTFontManager.kt:56)
	at com.agog.mathdisplay.MTMathView.<init>(MTMathView.kt:126)
	at com.agog.mathdisplay.MTMathView.<init>(MTMathView.kt:29)
	at com.oskar.hp.android.MathViewKt._MathView$lambda$3$lambda$2(MathView.kt:110)
	at androidx.compose.ui.viewinterop.ViewFactoryHolder.<init>(AndroidView.android.kt:344)
	...
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
	at java.base/java.lang.Thread.run(Thread.java:840)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant