Skip to content

Commit

Permalink
Merge pull request #15 from Dogtiti/feature/pdf-fonts
Browse files Browse the repository at this point in the history
feat: add pdf fonts for cn
  • Loading branch information
Dogtiti authored Apr 22, 2023
2 parents 7e3d131 + 8a9cb39 commit bee2c48
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 10 deletions.
Binary file added public/fonts/Roboto-Regular.ttf
Binary file not shown.
Binary file added public/fonts/SourceHanSansCN-Regular.otf
Binary file not shown.
30 changes: 20 additions & 10 deletions src/components/pdf/MyDocument.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
import React from "react";
import { Document, Page, Text, StyleSheet, Font } from "@react-pdf/renderer";
import type { I18n } from "next-i18next";

Font.register({
family: "Roboto",
src: "https://fonts.gstatic.com/s/roboto/v27/KFOmCnqEu92Fr1Mu4mxP.ttf",
family: "Roboto,SourceHanSansCN",
fonts: [
{
src: "/fonts/SourceHanSansCN-Regular.otf",
},
{
src: "/fonts/Roboto-Regular.ttf",
},
],
});

const styles = StyleSheet.create({
Expand All @@ -14,7 +22,7 @@ const styles = StyleSheet.create({
},
section: {
fontSize: 12,
fontFamily: "Roboto",
fontFamily: "Roboto,SourceHanSansCN",
marginBottom: 20,
lineHeight: 1.5,
},
Expand All @@ -24,12 +32,14 @@ interface MyDocumentProps {
content: string;
}

const MyDocument: React.FC<MyDocumentProps> = ({ content }) => (
<Document>
<Page size="A4" style={styles.page}>
<Text style={styles.section}>{content}</Text>
</Page>
</Document>
);
const MyDocument: React.FC<MyDocumentProps> = ({ content }) => {
return (
<Document>
<Page size="A4" style={styles.page}>
<Text style={styles.section}>{content}</Text>
</Page>
</Document>
);
};

export default MyDocument;

1 comment on commit bee2c48

@vercel
Copy link

@vercel vercel bot commented on bee2c48 Apr 22, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

auto-gpt-next-web – ./

auto-gpt-next-web-git-main-dogtiti.vercel.app
auto-gpt-next-web-dogtiti.vercel.app
auto-agentgpt.com

Please sign in to comment.