feat: update font versions, replace jb mono

Signed-off-by: Infi <infi@infi.sh>
This commit is contained in:
Infi 2024-03-02 21:56:24 +01:00
parent a63f142bbc
commit 90742b0f58
48 changed files with 207 additions and 27 deletions

99
OFL.txt Normal file
View File

@ -0,0 +1,99 @@
============================================================================================================================
THIS FILE APPLIES TO SOME OF THE FONT SOFTWARE CONTAINED WITHIN THE `app/src/main/res/font` DIRECTORY RELATIVE TO THIS FILE.
THIS FILE DOES NOT APPLY TO ANY OTHER PART OF THIS PROJECT UNLESS OTHERWISE STATED.
============================================================================================================================
Copyright (c) 2016 The Inter Project Authors (https://github.com/rsms/inter)
Copyright 2022 The Fragment-Mono Project Authors (https://github.com/weiweihuanghuang/fragment-mono)
This Font Software is licensed under the SIL Open Font License, Version 1.1.
This license is copied below, and is also available with a FAQ at:
https://openfontlicense.org
-----------------------------------------------------------
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
-----------------------------------------------------------
PREAMBLE
The goals of the Open Font License (OFL) are to stimulate worldwide
development of collaborative font projects, to support the font creation
efforts of academic and linguistic communities, and to provide a free and
open framework in which fonts may be shared and improved in partnership
with others.
The OFL allows the licensed fonts to be used, studied, modified and
redistributed freely as long as they are not sold by themselves. The
fonts, including any derivative works, can be bundled, embedded,
redistributed and/or sold with any software provided that any reserved
names are not used by derivative works. The fonts and derivatives,
however, cannot be released under any other type of license. The
requirement for fonts to remain under this license does not apply
to any document created using the fonts or their derivatives.
DEFINITIONS
"Font Software" refers to the set of files released by the Copyright
Holder(s) under this license and clearly marked as such. This may
include source files, build scripts and documentation.
"Reserved Font Name" refers to any names specified as such after the
copyright statement(s).
"Original Version" refers to the collection of Font Software components as
distributed by the Copyright Holder(s).
"Modified Version" refers to any derivative made by adding to, deleting,
or substituting -- in part or in whole -- any of the components of the
Original Version, by changing formats or by porting the Font Software to a
new environment.
"Author" refers to any designer, engineer, programmer, technical
writer or other person who contributed to the Font Software.
PERMISSION & CONDITIONS
Permission is hereby granted, free of charge, to any person obtaining
a copy of the Font Software, to use, study, copy, merge, embed, modify,
redistribute, and sell modified and unmodified copies of the Font
Software, subject to the following conditions:
1) Neither the Font Software nor any of its individual components,
in Original or Modified Versions, may be sold by itself.
2) Original or Modified Versions of the Font Software may be bundled,
redistributed and/or sold with any software, provided that each copy
contains the above copyright notice and this license. These can be
included either as stand-alone text files, human-readable headers or
in the appropriate machine-readable metadata fields within text or
binary files as long as those fields can be easily viewed by the user.
3) No Modified Version of the Font Software may use the Reserved Font
Name(s) unless explicit written permission is granted by the corresponding
Copyright Holder. This restriction only applies to the primary font name as
presented to the users.
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
Software shall not be used to promote, endorse or advertise any
Modified Version, except to acknowledge the contribution(s) of the
Copyright Holder(s) and the Author(s) or with their explicit written
permission.
5) The Font Software, modified or unmodified, in part or in whole,
must be distributed entirely under this license, and must not be
distributed under any other license. The requirement for fonts to
remain under this license does not apply to any document created
using the Font Software.
TERMINATION
This license becomes null and void if any of the above conditions are
not met.
DISCLAIMER
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
OTHER DEALINGS IN THE FONT SOFTWARE.

View File

@ -20,8 +20,8 @@
} }
@font-face { @font-face {
font-family: "JetBrains Mono"; font-family: "Fragment Mono";
src: url("/_android_res/font/jetbrainsmono_regular.ttf"); src: url("/_android_res/font/fragmentmono_regular.ttf");
font-weight: 400; font-weight: 400;
font-style: normal; font-style: normal;
} }
@ -39,7 +39,7 @@
} }
pre, code { pre, code {
font-family: "JetBrains Mono", monospace; font-family: "Fragment Mono", monospace;
} }
#markdown { #markdown {

View File

@ -9,11 +9,9 @@ import androidx.compose.material3.surfaceColorAtElevation
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip import androidx.compose.ui.draw.clip
import androidx.compose.ui.text.font.Font
import androidx.compose.ui.text.font.FontFamily
import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.dp
import chat.revolt.R
import chat.revolt.ndk.AstNode import chat.revolt.ndk.AstNode
import chat.revolt.ui.theme.FragmentMono
@Composable @Composable
fun MarkdownCodeBlock(node: AstNode, modifier: Modifier = Modifier) { fun MarkdownCodeBlock(node: AstNode, modifier: Modifier = Modifier) {
@ -32,7 +30,7 @@ fun MarkdownCodeBlock(node: AstNode, modifier: Modifier = Modifier) {
) { ) {
Text( Text(
text = node.text?.removeSuffix("\n") ?: "", text = node.text?.removeSuffix("\n") ?: "",
fontFamily = FontFamily(Font(R.font.jetbrainsmono_regular)), fontFamily = FragmentMono,
) )
} }
} }

View File

@ -28,14 +28,11 @@ import androidx.compose.ui.text.Placeholder
import androidx.compose.ui.text.PlaceholderVerticalAlign import androidx.compose.ui.text.PlaceholderVerticalAlign
import androidx.compose.ui.text.TextLayoutResult import androidx.compose.ui.text.TextLayoutResult
import androidx.compose.ui.text.buildAnnotatedString import androidx.compose.ui.text.buildAnnotatedString
import androidx.compose.ui.text.font.Font
import androidx.compose.ui.text.font.FontFamily
import androidx.compose.ui.text.font.FontStyle import androidx.compose.ui.text.font.FontStyle
import androidx.compose.ui.text.font.FontSynthesis import androidx.compose.ui.text.font.FontSynthesis
import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.dp
import androidx.core.net.toUri import androidx.core.net.toUri
import chat.revolt.R
import chat.revolt.api.REVOLT_FILES import chat.revolt.api.REVOLT_FILES
import chat.revolt.api.RevoltAPI import chat.revolt.api.RevoltAPI
import chat.revolt.api.routes.custom.fetchEmoji import chat.revolt.api.routes.custom.fetchEmoji
@ -45,6 +42,7 @@ import chat.revolt.components.generic.RemoteImage
import chat.revolt.components.utils.detectTapGesturesConditionalConsume import chat.revolt.components.utils.detectTapGesturesConditionalConsume
import chat.revolt.internals.resolveTimestamp import chat.revolt.internals.resolveTimestamp
import chat.revolt.ndk.AstNode import chat.revolt.ndk.AstNode
import chat.revolt.ui.theme.FragmentMono
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
@ -149,7 +147,7 @@ fun annotateText(node: AstNode): AnnotatedString {
pushStyle( pushStyle(
LocalTextStyle.current.toSpanStyle() LocalTextStyle.current.toSpanStyle()
.copy( .copy(
fontFamily = FontFamily(Font(R.font.jetbrainsmono_regular)), fontFamily = FragmentMono,
background = MaterialTheme.colorScheme.primary.copy(alpha = 0.2f) background = MaterialTheme.colorScheme.primary.copy(alpha = 0.2f)
) )
) )
@ -234,7 +232,7 @@ fun annotateText(node: AstNode): AnnotatedString {
pushStyle( pushStyle(
LocalTextStyle.current.toSpanStyle() LocalTextStyle.current.toSpanStyle()
.copy( .copy(
fontFamily = FontFamily(Font(R.font.jetbrainsmono_regular)), fontFamily = FragmentMono,
fontSynthesis = FontSynthesis.All, fontSynthesis = FontSynthesis.All,
background = MaterialTheme.colorScheme.surfaceColorAtElevation(2.dp) background = MaterialTheme.colorScheme.surfaceColorAtElevation(2.dp)
) )

View File

@ -36,15 +36,16 @@ import androidx.compose.ui.platform.LocalClipboardManager
import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.stringResource import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.AnnotatedString import androidx.compose.ui.text.AnnotatedString
import androidx.compose.ui.text.font.Font import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.font.FontFamily
import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import chat.revolt.R import chat.revolt.R
import chat.revolt.api.REVOLT_INVITES import chat.revolt.api.REVOLT_INVITES
import chat.revolt.api.RevoltAPI import chat.revolt.api.RevoltAPI
import chat.revolt.api.routes.channel.createInvite import chat.revolt.api.routes.channel.createInvite
import chat.revolt.internals.Platform import chat.revolt.internals.Platform
import chat.revolt.ui.theme.FragmentMono
private val inviteChars = ('a'..'z') + ('A'..'Z') + ('0'..'9') private val inviteChars = ('a'..'z') + ('A'..'Z') + ('0'..'9')
@ -144,8 +145,11 @@ fun InviteDialog(channelId: String, onDismissRequest: () -> Unit) {
) { state -> ) { state ->
Text( Text(
state.char.toString(), state.char.toString(),
style = MaterialTheme.typography.displayLarge, style = MaterialTheme.typography.displayLarge.copy(
fontFamily = FontFamily(Font(R.font.jetbrainsmono_regular)), fontSize = 48.sp,
fontWeight = FontWeight.Normal
),
fontFamily = FragmentMono,
modifier = Modifier modifier = Modifier
.alpha(if (state.isActual) 1f else 0f) .alpha(if (state.isActual) 1f else 0f)
) )

View File

@ -4,6 +4,7 @@ import androidx.compose.material3.Typography
import androidx.compose.ui.text.TextStyle import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.text.font.Font import androidx.compose.ui.text.font.Font
import androidx.compose.ui.text.font.FontFamily import androidx.compose.ui.text.font.FontFamily
import androidx.compose.ui.text.font.FontStyle
import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.unit.sp import androidx.compose.ui.unit.sp
import chat.revolt.R import chat.revolt.R
@ -17,54 +18,87 @@ private val Inter = FontFamily(
Font(R.font.inter_semibold, FontWeight.SemiBold), Font(R.font.inter_semibold, FontWeight.SemiBold),
Font(R.font.inter_bold, FontWeight.Bold), Font(R.font.inter_bold, FontWeight.Bold),
Font(R.font.inter_extrabold, FontWeight.ExtraBold), Font(R.font.inter_extrabold, FontWeight.ExtraBold),
Font(R.font.inter_black, FontWeight.Black) Font(R.font.inter_black, FontWeight.Black),
Font(R.font.inter_thin_italic, FontWeight.Thin, FontStyle.Italic),
Font(R.font.inter_extralight_italic, FontWeight.ExtraLight, FontStyle.Italic),
Font(R.font.inter_light_italic, FontWeight.Light, FontStyle.Italic),
Font(R.font.inter_italic, FontWeight.Normal, FontStyle.Italic),
Font(R.font.inter_medium_italic, FontWeight.Medium, FontStyle.Italic),
Font(R.font.inter_semibold_italic, FontWeight.SemiBold, FontStyle.Italic),
Font(R.font.inter_bold_italic, FontWeight.Bold, FontStyle.Italic),
Font(R.font.inter_extrabold_italic, FontWeight.ExtraBold, FontStyle.Italic),
Font(R.font.inter_black_italic, FontWeight.Black, FontStyle.Italic)
)
private val InterDisplay = FontFamily(
Font(R.font.inter_display_thin, FontWeight.Thin),
Font(R.font.inter_display_extralight, FontWeight.ExtraLight),
Font(R.font.inter_display_light, FontWeight.Light),
Font(R.font.inter_display_regular, FontWeight.Normal),
Font(R.font.inter_display_medium, FontWeight.Medium),
Font(R.font.inter_display_semibold, FontWeight.SemiBold),
Font(R.font.inter_display_bold, FontWeight.Bold),
Font(R.font.inter_display_extrabold, FontWeight.ExtraBold),
Font(R.font.inter_display_black, FontWeight.Black),
Font(R.font.inter_display_thin_italic, FontWeight.Thin, FontStyle.Italic),
Font(R.font.inter_display_extralight_italic, FontWeight.ExtraLight, FontStyle.Italic),
Font(R.font.inter_display_light_italic, FontWeight.Light, FontStyle.Italic),
Font(R.font.inter_display_italic, FontWeight.Normal, FontStyle.Italic),
Font(R.font.inter_display_medium_italic, FontWeight.Medium, FontStyle.Italic),
Font(R.font.inter_display_semibold_italic, FontWeight.SemiBold, FontStyle.Italic),
Font(R.font.inter_display_bold_italic, FontWeight.Bold, FontStyle.Italic),
Font(R.font.inter_display_extrabold_italic, FontWeight.ExtraBold, FontStyle.Italic),
Font(R.font.inter_display_black_italic, FontWeight.Black, FontStyle.Italic)
)
val FragmentMono = FontFamily(
Font(R.font.fragmentmono_regular, FontWeight.Normal),
Font(R.font.fragmentmono_italic, FontWeight.Normal, FontStyle.Italic)
) )
val RevoltTypography = Typography( val RevoltTypography = Typography(
displayLarge = TextStyle( displayLarge = TextStyle(
fontFamily = Inter, fontFamily = InterDisplay,
fontWeight = FontWeight.Black, fontWeight = FontWeight.Black,
fontSize = 57.sp fontSize = 57.sp
), ),
displayMedium = TextStyle( displayMedium = TextStyle(
fontFamily = Inter, fontFamily = InterDisplay,
fontWeight = FontWeight.ExtraBold, fontWeight = FontWeight.ExtraBold,
fontSize = 45.sp fontSize = 45.sp
), ),
displaySmall = TextStyle( displaySmall = TextStyle(
fontFamily = Inter, fontFamily = InterDisplay,
fontWeight = FontWeight.Bold, fontWeight = FontWeight.Bold,
fontSize = 36.sp fontSize = 36.sp
), ),
headlineLarge = TextStyle( headlineLarge = TextStyle(
fontFamily = Inter, fontFamily = InterDisplay,
fontWeight = FontWeight.SemiBold, fontWeight = FontWeight.SemiBold,
fontSize = 32.sp fontSize = 32.sp
), ),
headlineMedium = TextStyle( headlineMedium = TextStyle(
fontFamily = Inter, fontFamily = InterDisplay,
fontWeight = FontWeight.SemiBold, fontWeight = FontWeight.SemiBold,
fontSize = 28.sp fontSize = 28.sp
), ),
headlineSmall = TextStyle( headlineSmall = TextStyle(
fontFamily = Inter, fontFamily = InterDisplay,
fontWeight = FontWeight.Bold, fontWeight = FontWeight.Bold,
fontSize = 24.sp fontSize = 24.sp
), ),
titleLarge = TextStyle( titleLarge = TextStyle(
fontFamily = Inter, fontFamily = InterDisplay,
fontWeight = FontWeight.SemiBold, fontWeight = FontWeight.SemiBold,
fontSize = 22.sp fontSize = 22.sp
), ),
titleMedium = TextStyle( titleMedium = TextStyle(
fontFamily = Inter, fontFamily = InterDisplay,
fontWeight = FontWeight.SemiBold, fontWeight = FontWeight.SemiBold,
fontSize = 16.sp fontSize = 16.sp
), ),
titleSmall = TextStyle( titleSmall = TextStyle(
fontFamily = Inter, fontFamily = InterDisplay,
fontWeight = FontWeight.Bold, fontWeight = FontWeight.Bold,
fontSize = 14.sp fontSize = 14.sp
), ),

View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<font-family xmlns:app="http://schemas.android.com/apk/res-auto">
<font
app:font="@font/fragmentmono_regular"
app:fontStyle="normal"
app:fontWeight="400" />
<font
app:font="@font/fragmentmono_italic"
app:fontStyle="italic"
app:fontWeight="400" />
</font-family>

Binary file not shown.

Binary file not shown.

View File

@ -36,4 +36,40 @@
app:font="@font/inter_black" app:font="@font/inter_black"
app:fontStyle="normal" app:fontStyle="normal"
app:fontWeight="900" /> app:fontWeight="900" />
<font
app:font="@font/inter_thin_italic"
app:fontStyle="italic"
app:fontWeight="100" />
<font
app:font="@font/inter_extralight_italic"
app:fontStyle="italic"
app:fontWeight="200" />
<font
app:font="@font/inter_light_italic"
app:fontStyle="italic"
app:fontWeight="300" />
<font
app:font="@font/inter_italic"
app:fontStyle="italic"
app:fontWeight="400" />
<font
app:font="@font/inter_medium_italic"
app:fontStyle="italic"
app:fontWeight="500" />
<font
app:font="@font/inter_semibold_italic"
app:fontStyle="italic"
app:fontWeight="600" />
<font
app:font="@font/inter_bold_italic"
app:fontStyle="italic"
app:fontWeight="700" />
<font
app:font="@font/inter_extrabold_italic"
app:fontStyle="italic"
app:fontWeight="800" />
<font
app:font="@font/inter_black_italic"
app:fontStyle="italic"
app:fontWeight="900" />
</font-family> </font-family>

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -4,7 +4,7 @@
<style name="Code.TextAppearance" parent=""> <style name="Code.TextAppearance" parent="">
<item name="android:textSize">14sp</item> <item name="android:textSize">14sp</item>
<item name="android:textColor">@color/foreground</item> <item name="android:textColor">@color/foreground</item>
<item name="android:fontFamily">@font/jetbrainsmono_regular</item> <item name="android:fontFamily">@font/fragmentmono</item>
</style> </style>
<style name="Code.TextAppearance.Comment" parent=""> <style name="Code.TextAppearance.Comment" parent="">