Add and use special monospace typeface for AEP.

This commit is contained in:
Cody Henthorne
2025-03-25 10:54:18 -04:00
parent e88db06c8b
commit 75e24ff7d5
5 changed files with 33 additions and 13 deletions

View File

@@ -0,0 +1,24 @@
/*
* Copyright 2025 Signal Messenger, LLC
* SPDX-License-Identifier: AGPL-3.0-only
*/
package org.thoughtcrime.securesms.fonts
import android.graphics.Typeface
import androidx.compose.runtime.Composable
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.text.font.FontFamily
/**
* Special monospace font, primarily used for rendering AEPs.
*/
object MonoTypeface {
private var cached: Typeface? = null
@Composable
fun fontFamily(): FontFamily {
val context = LocalContext.current
return FontFamily(cached ?: Typeface.createFromAsset(context.assets, "fonts/MonoSpecial-Regular.otf").also { cached = it })
}
}