feat: use ubuntu font as default

This commit is contained in:
kangfenmao 2024-08-07 13:56:32 +08:00
parent 61934cd65c
commit 6185068353
30 changed files with 91 additions and 79 deletions

View File

@ -1,47 +0,0 @@
@font-face {
font-family: 'Poppins';
src: url(Poppins-Thin.ttf) format('truetype');
font-weight: 100;
}
@font-face {
font-family: 'Poppins';
src: url(Poppins-ExtraLight.ttf) format('truetype');
font-weight: 200;
}
@font-face {
font-family: 'Poppins';
src: url(Poppins-Light.ttf) format('truetype');
font-weight: 300;
}
@font-face {
font-family: 'Poppins';
src: url(Poppins-Regular.ttf) format('truetype');
font-weight: 400;
}
@font-face {
font-family: 'Poppins';
src: url(Poppins-Medium.ttf) format('truetype');
font-weight: 500;
}
@font-face {
font-family: 'Poppins';
src: url(Poppins-SemiBold.ttf) format('truetype');
font-weight: 600;
}
@font-face {
font-family: 'Poppins';
src: url(Poppins-Bold.ttf) format('truetype');
font-weight: 700;
}
@font-face {
font-family: 'Poppins';
src: url(Poppins-ExtraBold.ttf) format('truetype');
font-weight: 800;
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,55 @@
@font-face {
font-family: 'Ubuntu';
src: url('Ubuntu-Regular.ttf') format('truetype');
font-weight: normal;
font-style: normal;
}
@font-face {
font-family: 'Ubuntu';
src: url('Ubuntu-Italic.ttf') format('truetype');
font-weight: normal;
font-style: italic;
}
@font-face {
font-family: 'Ubuntu';
src: url('Ubuntu-Bold.ttf') format('truetype');
font-weight: bold;
font-style: normal;
}
@font-face {
font-family: 'Ubuntu';
src: url('Ubuntu-BoldItalic.ttf') format('truetype');
font-weight: bold;
font-style: italic;
}
@font-face {
font-family: 'Ubuntu';
src: url('Ubuntu-Light.ttf') format('truetype');
font-weight: 300;
font-style: normal;
}
@font-face {
font-family: 'Ubuntu';
src: url('Ubuntu-LightItalic.ttf') format('truetype');
font-weight: 300;
font-style: italic;
}
@font-face {
font-family: 'Ubuntu';
src: url('Ubuntu-Medium.ttf') format('truetype');
font-weight: 500;
font-style: normal;
}
@font-face {
font-family: 'Ubuntu';
src: url('Ubuntu-MediumItalic.ttf') format('truetype');
font-weight: 500;
font-style: italic;
}

View File

@ -1,7 +1,7 @@
@import './markdown.scss'; @import './markdown.scss';
@import './scrollbar.scss'; @import './scrollbar.scss';
@import '../fonts/icon-fonts/iconfont.css'; @import '../fonts/icon-fonts/iconfont.css';
@import '../fonts/Poppins/Poppins.css'; @import '../fonts/Ubuntu/Ubuntu.css';
:root { :root {
--color-white: #ffffff; --color-white: #ffffff;
@ -108,18 +108,8 @@ body {
line-height: 1.6; line-height: 1.6;
overflow: hidden; overflow: hidden;
background: transparent !important; background: transparent !important;
font-family: font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans',
-apple-system, 'Helvetica Neue', sans-serif;
BlinkMacSystemFont,
'Microsoft YaHei',
'Segoe UI',
Roboto,
Oxygen,
Ubuntu,
Cantarell,
'Fira Sans',
'Droid Sans',
'Helvetica Neue' sans-serif;
text-rendering: optimizeLegibility; text-rendering: optimizeLegibility;
-webkit-font-smoothing: antialiased; -webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale; -moz-osx-font-smoothing: grayscale;

View File

@ -4,14 +4,6 @@
line-height: 1.6; line-height: 1.6;
user-select: text; user-select: text;
p:last-child {
margin-bottom: 5px;
}
p:first-child {
margin-top: 0;
}
h1:first-child, h1:first-child,
h2:first-child, h2:first-child,
h3:first-child, h3:first-child,
@ -29,6 +21,8 @@
h6 { h6 {
margin: 1em 0 1em 0; margin: 1em 0 1em 0;
font-weight: 800; font-weight: 800;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans',
'Helvetica Neue', sans-serif;
} }
h1 { h1 {
@ -61,6 +55,13 @@
p { p {
margin: 1em 0; margin: 1em 0;
&:last-child {
margin-bottom: 5px;
}
&:first-child {
margin-top: 0;
}
} }
ul, ul,
@ -105,6 +106,7 @@
padding: 1em; padding: 1em;
border-radius: 5px; border-radius: 5px;
overflow-x: auto; overflow-x: auto;
font-family: 'Fira Code', 'Courier New', Courier, monospace;
pre { pre {
margin: 0 !important; margin: 0 !important;
} }
@ -120,6 +122,7 @@
padding-left: 1em; padding-left: 1em;
color: var(--color-text-light); color: var(--color-text-light);
border-left: 4px solid var(--color-border); border-left: 4px solid var(--color-border);
font-family: Georgia, 'Times New Roman', Times, serif;
} }
table { table {
@ -137,6 +140,8 @@
th { th {
background-color: var(--color-background-mute); background-color: var(--color-background-mute);
font-weight: bold; font-weight: bold;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans',
'Helvetica Neue', sans-serif;
} }
img { img {

View File

@ -150,11 +150,12 @@ export const BaseTypography = styled(Box)<{
` `
export const TypographyNormal = styled(BaseTypography)` export const TypographyNormal = styled(BaseTypography)`
font-family: 'Poppins'; font-family: 'Ubuntu';
` `
export const TypographyBold = styled(BaseTypography)` export const TypographyBold = styled(BaseTypography)`
font-family: 'Poppins Bold'; font-family: 'Ubuntu';
font-weight: bold;
` `
export const Container = styled.main<ContainerProps>` export const Container = styled.main<ContainerProps>`

View File

@ -1,5 +1,7 @@
export const DEFAULT_TEMPERATURE = 0.7 export const DEFAULT_TEMPERATURE = 0.7
export const DEFAULT_CONEXTCOUNT = 5 export const DEFAULT_CONEXTCOUNT = 5
export const FONT_FAMILY =
"Ubuntu, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif"
export const platform = window.electron?.process?.platform === 'darwin' ? 'macos' : 'windows' export const platform = window.electron?.process?.platform === 'darwin' ? 'macos' : 'windows'
export const isMac = platform === 'macos' export const isMac = platform === 'macos'
export const isWindows = platform === 'windows' export const isWindows = platform === 'windows'

View File

@ -147,7 +147,7 @@ const AssistantItem = styled.div`
position: relative; position: relative;
border-radius: 8px; border-radius: 8px;
cursor: pointer; cursor: pointer;
font-family: Poppins; font-family: Ubuntu;
.anticon { .anticon {
display: none; display: none;
} }

View File

@ -8,6 +8,7 @@ import {
SaveOutlined, SaveOutlined,
SyncOutlined SyncOutlined
} from '@ant-design/icons' } from '@ant-design/icons'
import { FONT_FAMILY } from '@renderer/config/constant'
import { getModelLogo } from '@renderer/config/provider' import { getModelLogo } from '@renderer/config/provider'
import { useAssistant } from '@renderer/hooks/useAssistant' import { useAssistant } from '@renderer/hooks/useAssistant'
import useAvatar from '@renderer/hooks/useAvatar' import useAvatar from '@renderer/hooks/useAvatar'
@ -70,8 +71,10 @@ const MessageItem: FC<Props> = ({ message, index, showMenu, onDeleteMessage }) =
return userName || t('common.you') return userName || t('common.you')
}, [assistant?.name, message.id, message.modelId, message.role, t, userName]) }, [assistant?.name, message.id, message.modelId, message.role, t, userName])
const serifFonts = "Georgia, Cambria, 'Times New Roman', Times, serif" const fontFamily = useMemo(() => {
const fontFamily = messageFont === 'serif' ? serifFonts : 'Poppins, -apple-system, sans-serif' return messageFont === 'serif' ? FONT_FAMILY.replace('sans-serif', 'serif').replace('Ubuntu, ', '') : FONT_FAMILY
}, [messageFont])
const messageBorder = showMessageDivider ? undefined : 'none' const messageBorder = showMessageDivider ? undefined : 'none'
const avatarSource = useMemo(() => (message.modelId ? getModelLogo(message.modelId) : undefined), [message.modelId]) const avatarSource = useMemo(() => (message.modelId ? getModelLogo(message.modelId) : undefined), [message.modelId])
const avatarName = useMemo(() => firstLetter(assistant?.name).toUpperCase(), [assistant?.name]) const avatarName = useMemo(() => firstLetter(assistant?.name).toUpperCase(), [assistant?.name])

View File

@ -100,14 +100,14 @@ const Messages: FC<Props> = ({ assistant, topic }) => {
}, [assistant, messages, provider, topic, autoRenameTopic, updateTopic, onSendMessage]) }, [assistant, messages, provider, topic, autoRenameTopic, updateTopic, onSendMessage])
useEffect(() => { useEffect(() => {
runAsyncFunction(async () => setMessages((await LocalStorage.getTopicMessages(topic.id)) || [])) runAsyncFunction(async () => {
const messages = (await LocalStorage.getTopicMessages(topic.id)) || []
setMessages(messages)
})
}, [topic.id]) }, [topic.id])
const scrollTop = useCallback( const scrollTop = useCallback(
debounce(() => containerRef.current?.scrollTo({ top: 100000, behavior: 'auto' }), 500, { debounce(() => containerRef.current?.scrollTo({ top: 100000, behavior: 'auto' }), 500),
leading: true,
trailing: false
}),
[] []
) )

View File

@ -37,6 +37,7 @@ const AssistantName = styled.span`
font-weight: bold; font-weight: bold;
margin-left: 5px; margin-left: 5px;
margin-right: 10px; margin-right: 10px;
font-family: Ubuntu;
` `
export default NavigationCenter export default NavigationCenter

View File

@ -147,7 +147,7 @@ const TopicListItem = styled.div`
white-space: nowrap; white-space: nowrap;
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
font-family: Poppins; font-family: Ubuntu;
&:hover { &:hover {
background-color: var(--color-background-soft); background-color: var(--color-background-soft);
} }

View File

@ -192,6 +192,7 @@ const ProviderItemName = styled.div`
white-space: nowrap; white-space: nowrap;
text-overflow: ellipsis; text-overflow: ellipsis;
font-weight: 500; font-weight: 500;
font-family: Ubuntu;
` `
const AddButtonWrapper = styled.div` const AddButtonWrapper = styled.div`

View File

@ -8,6 +8,7 @@ export const SettingContainer = styled.div`
height: calc(100vh - var(--navbar-height)); height: calc(100vh - var(--navbar-height));
padding: 15px; padding: 15px;
overflow-y: scroll; overflow-y: scroll;
font-family: Ubuntu;
&::-webkit-scrollbar { &::-webkit-scrollbar {
display: none; display: none;