Skip to content

Commit

Permalink
不要なフォントを削除・line-clampをstyleで指定
Browse files Browse the repository at this point in the history
  • Loading branch information
miyaji255 committed Dec 3, 2023
1 parent 182c2ce commit cfb001c
Show file tree
Hide file tree
Showing 8 changed files with 5 additions and 26 deletions.
Binary file removed fonts/Noto_Sans_JP/NotoSansJP-VariableFont_wght.ttf
Binary file not shown.
Binary file removed fonts/Noto_Sans_JP/static/NotoSansJP-Black.ttf
Binary file not shown.
Binary file removed fonts/Noto_Sans_JP/static/NotoSansJP-ExtraBold.ttf
Binary file not shown.
Binary file removed fonts/Noto_Sans_JP/static/NotoSansJP-ExtraLight.ttf
Binary file not shown.
Binary file removed fonts/Noto_Sans_JP/static/NotoSansJP-Light.ttf
Binary file not shown.
Binary file removed fonts/Noto_Sans_JP/static/NotoSansJP-Medium.ttf
Binary file not shown.
Binary file removed fonts/Noto_Sans_JP/static/NotoSansJP-Thin.ttf
Binary file not shown.
31 changes: 5 additions & 26 deletions src/pages/blog/[slug]/_OgImageGenerator.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import satori from 'satori'
import oucc from '../../assets/icons/oucc.svg?raw'
import oucc from '@/assets/icons/oucc.svg?raw'
import fs from 'node:fs/promises'
import sharp from 'sharp'

Expand All @@ -15,26 +15,10 @@ export async function createOgImage(title: string, author: string) {
fontCache ??= await Promise.all(
(
[
{
weight: 100,
path: './fonts/Noto_Sans_JP/static/NotoSansJP-Thin.ttf',
},
{
weight: 200,
path: './fonts/Noto_Sans_JP/static/NotoSansJP-ExtraLight.ttf',
},
{
weight: 300,
path: './fonts/Noto_Sans_JP/static/NotoSansJP-Light.ttf',
},
{
weight: 400,
path: './fonts/Noto_Sans_JP/static/NotoSansJP-Regular.ttf',
},
{
weight: 500,
path: './fonts/Noto_Sans_JP/static/NotoSansJP-Medium.ttf',
},
{
weight: 600,
path: './fonts/Noto_Sans_JP/static/NotoSansJP-SemiBold.ttf',
Expand All @@ -43,14 +27,6 @@ export async function createOgImage(title: string, author: string) {
weight: 700,
path: './fonts/Noto_Sans_JP/static/NotoSansJP-Bold.ttf',
},
{
weight: 800,
path: './fonts/Noto_Sans_JP/static/NotoSansJP-ExtraBold.ttf',
},
{
weight: 900,
path: './fonts/Noto_Sans_JP/static/NotoSansJP-Black.ttf',
},
] as const
).map(async ({ weight, path }) => ({
weight,
Expand All @@ -76,7 +52,10 @@ export async function createOgImage(title: string, author: string) {
type: 'div',
props: {
children: title,
tw: 'text-6xl font-bold line-clamp-2 px-8',
tw: 'text-6xl font-bold px-8',
// satori の tailwind のバージョンは v3.1.8 で line-clamp のサポートは v3.3 からのため
style:
'overflow: hidden; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2;',
},
},
},
Expand Down

0 comments on commit cfb001c

Please sign in to comment.