mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-22 01:40:07 +01:00
Add and use special monospace typeface for AEP.
This commit is contained in:
@@ -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 })
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user