Use Inter custom font in ItemWebView
This commit is contained in:
parent
7b644cbc97
commit
d486bd92f9
BIN
appcompose/src/main/assets/fonts/Inter-Bold.woff2
Normal file
BIN
appcompose/src/main/assets/fonts/Inter-Bold.woff2
Normal file
Binary file not shown.
BIN
appcompose/src/main/assets/fonts/Inter-BoldItalic.woff2
Normal file
BIN
appcompose/src/main/assets/fonts/Inter-BoldItalic.woff2
Normal file
Binary file not shown.
BIN
appcompose/src/main/assets/fonts/Inter-Italic.woff2
Normal file
BIN
appcompose/src/main/assets/fonts/Inter-Italic.woff2
Normal file
Binary file not shown.
BIN
appcompose/src/main/assets/fonts/Inter-Regular.woff2
Normal file
BIN
appcompose/src/main/assets/fonts/Inter-Regular.woff2
Normal file
Binary file not shown.
@ -3,7 +3,6 @@ package com.readrops.app.compose.item.view
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
import android.util.Base64
|
||||
import android.webkit.WebView
|
||||
import android.webkit.WebViewClient
|
||||
import androidx.compose.ui.graphics.Color
|
||||
@ -50,8 +49,13 @@ class ItemWebView(
|
||||
formatText(itemWithFeed)
|
||||
)
|
||||
|
||||
val data = Base64.encodeToString(string.encodeToByteArray(), Base64.NO_PADDING)
|
||||
loadData(data, "text/html; charset=utf-8", "base64")
|
||||
loadDataWithBaseURL(
|
||||
"file:///android_asset/",
|
||||
string,
|
||||
"text/html; charset=utf-8",
|
||||
"UTF-8",
|
||||
null
|
||||
)
|
||||
}
|
||||
|
||||
private fun formatText(itemWithFeed: ItemWithFeed): String {
|
||||
|
@ -15,6 +15,14 @@
|
||||
%3$s: background color
|
||||
*/
|
||||
|
||||
@font-face {
|
||||
font-family: Inter;
|
||||
font-style: normal;
|
||||
font-weight: normal;
|
||||
font-display: swap;
|
||||
src: url("fonts/Inter-Regular.woff2") format("woff2");
|
||||
}
|
||||
|
||||
a:link, a:active, a:hover { color: %1$s }
|
||||
|
||||
* {
|
||||
@ -31,6 +39,7 @@
|
||||
margin-right: 3%%;
|
||||
color: %2$s;
|
||||
background-color: %3$s;
|
||||
font-family: Inter !important;
|
||||
}
|
||||
|
||||
figure, img, iframe, video {
|
||||
|
Loading…
x
Reference in New Issue
Block a user