Fix issue where System Default font overrides the browser agent font settings

This commit is contained in:
Jackson Harper 2024-03-07 11:37:25 +08:00
parent ee5000393f
commit 1a358585b6

View file

@ -348,12 +348,22 @@ export function ArticleContainer(props: ArticleContainerProps): JSX.Element {
return isJustified ? 'justify' : 'start'
}
const appliedFont = (name: string | undefined | null) => {
if (name === 'System Default') {
return 'unset'
}
return name
}
const styles = {
fontSize,
margin: props.margin ?? 360,
maxWidthPercentage: maxWidthPercentageOverride ?? props.maxWidthPercentage,
lineHeight: lineHeightOverride ?? props.lineHeight ?? 150,
fontFamily: fontFamilyOverride ?? props.fontFamily ?? 'inter',
fontFamily:
appliedFont(fontFamilyOverride) ??
appliedFont(props.fontFamily) ??
'inter',
readerFontColor:
highContrastTextOverride != undefined
? textColorValue(highContrastTextOverride)