Skip to content

Paywall V2 GoogleFont Provider not working #2292

@oguzsout

Description

@oguzsout

Although I use Google Fonts in RevenueCat Paywall, the fonts do not change. I use Jetpack Compose and have the latest version of the SDK. When I specify custom fonts for Paywall, the default fonts keep showing.

  1. Environment
    1. Platform: Android
    2. SDK version: 8.15.0
    3. OS version: Various Android versions (12, 13, 14, 15)
    4. Android Studio version: Meerkat
@Composable
fun PaywallScreenRevenueCat(onDismiss: () -> Unit) {
    PaywallDialog(
        PaywallDialogOptions(
            builder = PaywallDialogOptions.Builder()
                .setDismissRequest { onDismiss() }
                .setFontProvider(CustomFontProvider(displayFontFamily))
                .setRequiredEntitlementIdentifier("premium")
                .setListener(object : PaywallListener {
                    override fun onPurchaseCompleted(
                        customerInfo: CustomerInfo,
                        storeTransaction: StoreTransaction
                    ) {
                        super.onPurchaseCompleted(customerInfo, storeTransaction)
                        Log.d("TAG", "Completed!")
                    }

                    override fun onPurchaseError(error: PurchasesError) {
                        super.onPurchaseError(error)
                        Log.d("TAG", error.message)
                    }

                    override fun onRestoreError(error: PurchasesError) {
                        super.onRestoreError(error)
                        Log.d("TAG", error.message)
                    }

                    override fun onRestoreCompleted(customerInfo: CustomerInfo) {
                        super.onRestoreCompleted(customerInfo)
                        Log.d("TAG", "On Restore Completed!")
                    }

                    override fun onPurchaseStarted(rcPackage: Package) {
                        super.onPurchaseStarted(rcPackage)
                        Log.d("TAG", "On Purchase Started!")
                    }
                })
        )
    )
}
val provider = GoogleFont.Provider(
    providerAuthority = "com.google.android.gms.fonts",
    providerPackage = "com.google.android.gms",
    certificates = R.array.com_google_android_gms_fonts_certs
)

val displayFontFamily = FontFamily(
    Font(
        googleFont = GoogleFont("DM Sans"),
        fontProvider = provider,
    )
)
val baseline = Typography()

val AppTypography = Typography(
    displayLarge = baseline.displayLarge.copy(fontFamily = displayFontFamily),
    displayMedium = baseline.displayMedium.copy(fontFamily = displayFontFamily),
    displaySmall = baseline.displaySmall.copy(fontFamily = displayFontFamily),
    headlineLarge = baseline.headlineLarge.copy(fontFamily = displayFontFamily),
    headlineMedium = baseline.headlineMedium.copy(fontFamily = displayFontFamily),
    headlineSmall = baseline.headlineSmall.copy(fontFamily = displayFontFamily),
    titleLarge = baseline.titleLarge.copy(fontFamily = displayFontFamily),
    titleMedium = baseline.titleMedium.copy(fontFamily = displayFontFamily),
    titleSmall = baseline.titleSmall.copy(fontFamily = displayFontFamily),
    bodyLarge = baseline.bodyLarge.copy(fontFamily = displayFontFamily),
    bodyMedium = baseline.bodyMedium.copy(fontFamily = displayFontFamily),
    bodySmall = baseline.bodySmall.copy(fontFamily = displayFontFamily),
    labelLarge = baseline.labelLarge.copy(fontFamily = displayFontFamily),
    labelMedium = baseline.labelMedium.copy(fontFamily = displayFontFamily),
    labelSmall = baseline.labelSmall.copy(fontFamily = displayFontFamily),
)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions