Add Lexend font to Android, iOS, Web

This commit is contained in:
Jackson Harper
2023-11-22 12:03:52 +08:00
parent eabf5aff26
commit 2ad68498ef
16 changed files with 39 additions and 118 deletions

Binary file not shown.

File diff suppressed because one or more lines are too long

View File

@ -16,6 +16,7 @@ enum class WebFont(val displayText: String, val rawValue: String) {
CRIMSON_TEXT("Crimson Text", "Crimson Text"),
SOURCE_SERIF_PRO("Source Serif Pro", "Source Serif Pro"),
NEWSREADER("Newsreader", "Newsreader"),
LEXEND("Lexend", "Lexend"),
LXGWWENKAI("LXGW WenKai", "LXGWWenKai"),
ATKINSON_HYPERLEGIBLE("Atkinson Hyperlegible", "AtkinsonHyperlegible"),
SOURCE_SANS_PRO("Source Sans Pro", "SourceSansPro"),

View File

@ -25,7 +25,8 @@ public func registerFonts() -> Bool {
registerFont(bundle: .module, fontName: "SourceSerifPro-Regular", fontExtension: "ttf"),
registerFont(bundle: .module, fontName: "SourceSansPro-Regular", fontExtension: "ttf"),
registerFont(bundle: .module, fontName: "IBMPlexSans-Regular", fontExtension: "ttf"),
registerFont(bundle: .module, fontName: "LXGWWenKai-Regular", fontExtension: "ttf")
registerFont(bundle: .module, fontName: "LXGWWenKai-Regular", fontExtension: "ttf"),
registerFont(bundle: .module, fontName: "Lexend-Regular", fontExtension: "ttf")
]
.allSatisfy { $0 }
}

View File

@ -17,6 +17,7 @@ public enum WebFont: String, CaseIterable {
case atkinsonHyperlegible = "AtkinsonHyperlegible"
case lxgWWenKai = "LXGWWenKai"
case sourceSansPro = "SourceSansPro"
case lexend = "Lexend"
case IBMPlexSans
static var sorted: [WebFont] {
@ -48,7 +49,8 @@ public enum WebFont: String, CaseIterable {
.georgia,
.montserrat,
.newsreader,
.lxgWWenKai:
.lxgWWenKai,
.lexend:
return rawValue
case .atkinsonHyperlegible:
return "Atkinson Hyperlegible"

File diff suppressed because one or more lines are too long

View File

@ -1,112 +0,0 @@
import { HStack, Box } from '../../elements/LayoutPrimitives'
import { StyledText } from '../../elements/StyledText'
import { theme } from '../../tokens/stitches.config'
import { CaretLeft, Check } from 'phosphor-react'
const FONT_FAMILIES = [
'AtkinsonHyperlegible',
'Inter',
'System Default',
'Merriweather',
'Lora',
'Open Sans',
'IBMPlexSans',
'Roboto',
'Newsreader',
'Montserrat',
'Crimson Text',
'OpenDyslexic',
'Source Serif Pro',
]
type FontFamiliesListProps = {
selected: string
setShowFontFamilies: (value: boolean) => void
onSelect: (value: string) => void
}
type FontOptionProps = {
family: string
selected: string
onSelect: (value: string) => void
}
function FontOption(props: FontOptionProps): JSX.Element {
const isSelected = props.selected === props.family
return (
<HStack
distribution="between"
alignment="start"
css={{ width: '100%', pt: '14px' }}
>
<StyledText
css={{
m: '0px',
fontSize: 16,
fontFamily: props.family,
textTransform: 'capitalize',
cursor: 'pointer',
}}
onClick={() => props.onSelect(props.family)}
>
{props.family}
</StyledText>
{isSelected && (
<Check color={theme.colors.grayTextContrast.toString()} weight="bold" />
)}
</HStack>
)
}
export function FontFamiliesOptions(props: FontFamiliesListProps): JSX.Element {
return (
<>
<Box
css={{
borderBottom: `1px solid ${theme.colors.grayLine.toString()}`,
width: '100%',
}}
>
<HStack
alignment="center"
distribution="between"
css={{ width: '100%', py: 10, px: 15 }}
>
<HStack
alignment="center"
distribution="start"
css={{ cursor: 'pointer', py: '4px', width: '100%' }}
onClick={() => props.setShowFontFamilies(false)}
>
<CaretLeft
color={theme.colors.utilityTextSubtle.toString()}
size={15}
/>
<StyledText
css={{
textAlign: 'center',
m: 0,
fontSize: 14,
fontWeight: 'bold',
width: '100%',
wordWrap: 'revert',
}}
>
Choose Font
</StyledText>
</HStack>
</HStack>
</Box>
<Box css={{ px: 15, pb: 15, width: '100%' }}>
{FONT_FAMILIES.map((family) => (
<FontOption
selected={props.selected}
family={family}
onSelect={props.onSelect}
key={`font-${family}`}
/>
))}
</Box>
</>
)
}

View File

@ -36,6 +36,7 @@ const FONT_FAMILIES = [
'Open Sans',
'Roboto',
'Newsreader',
'Lexend',
'Montserrat',
'Crimson Text',
'OpenDyslexic',

View File

@ -359,6 +359,20 @@ div#appleid-signin {
src: url('/static/fonts/IBMPlexSans/IBMPlexSans-Italic.ttf');
}
@font-face {
font-family: 'Lexend';
font-weight: 400;
font-style: normal;
src: url('/static/fonts/Lexend/Lexend-Regular.ttf');
}
@font-face {
font-family: 'Lexend';
font-weight: 700;
font-style: normal;
src: url('/static/fonts/Lexend/Lexend-Bold.ttf');
}
.dropdown-arrow {
display: inline-block;
width: 0;

View File

@ -13,10 +13,24 @@ firefox:
yarn build-firefox
FIREFOX_PKG_NAME="firefox-$(shell cat dist/manifest.json| jq -j .version).zip" ; \
FIREFOX_SRC_NAME="firefox-$(shell cat dist/manifest.json| jq -j .version)-src.zip" ; \
pushd dist; zip -r ../$$FIREFOX_PKG_NAME *; popd; \
cd dist; zip -r ../$$FIREFOX_PKG_NAME *; cd ..;\
zip -r $$FIREFOX_SRC_NAME src/* Makefile yarn.lock package.json .env.firefox webpack.js replace-with-process-env.js; \
echo "done"
firefox-verify:
mkdir "firefox-$(shell cat dist/manifest.json| jq -j .version)-build"; \
mkdir "firefox-$(shell cat dist/manifest.json| jq -j .version)-build/build"; \
cp "firefox-$(shell cat dist/manifest.json| jq -j .version).zip" "firefox-$(shell cat dist/manifest.json| jq -j .version)-build/uploaded.zip"; \
cp "firefox-$(shell cat dist/manifest.json| jq -j .version)-src.zip" "firefox-$(shell cat dist/manifest.json| jq -j .version)-build/build/."; \
cd "firefox-$(shell cat dist/manifest.json| jq -j .version)-build/uploaded/"; \
unzip "firefox-$(shell cat dist/manifest.json| jq -j .version).zip"; \
rm "firefox-$(shell cat dist/manifest.json| jq -j .version).zip"; \
cd ../build/; \
unzip "firefox-$(shell cat dist/manifest.json| jq -j .version)-src.zip"; \
yarn && yarn build-firefox; \
diff -r dist/ ../uploaded/
chrome: build
echo "building chrome package"
zip -r chrome-$(shell cat dist/manifest.json| jq -j .version).zip ./dist/*

View File

@ -2,7 +2,7 @@
"manifest_version": 2,
"name": "process.env.EXTENSION_NAME",
"short_name": "process.env.EXTENSION_NAME",
"version": "2.8.6",
"version": "2.8.9",
"description": "Save PDFs and Articles to your Omnivore library",
"author": "Omnivore Media, Inc",
"default_locale": "en",