Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file not shown.
Binary file added public/images/pretendard-safari/italic-after.avif
Binary file not shown.
Binary file not shown.
Binary file added public/images/pretendard-safari/weight-after.avif
Binary file not shown.
Binary file not shown.
4 changes: 2 additions & 2 deletions scripts/sharp-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export type SharpFileType = keyof typeof SHARP_OPTIONS_TYPE_MAPPER
const CONFIG = {
imageGlobPattern: 'public/images/**/*.{png,jpg,jpeg,webp,gif}',
mdxGlobPattern: 'src/content/post/**/*.mdx',
ignoreList: ['og.png', 'thumbnails/'],
ignoreList: ['og.png'],
}

export type ProcessedResult = {
Expand Down Expand Up @@ -83,7 +83,7 @@ export const sharpImages = async () => {
try {
const filename = path.basename(filePath)

if (CONFIG.ignoreList.includes(filename)) {
if (CONFIG.ignoreList.includes(filename) || filePath.includes('thumbnails/')) {
console.log(`::โœง:: Skipping ignored file ${filename}`)
continue
}
Expand Down
56 changes: 56 additions & 0 deletions src/content/post/notes/pretendard-safari.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
---
title: NextJS Pretendard Safari ๊ธ€๊ผด ๊ตต๊ธฐ ๋ Œ๋”๋ง ์˜ค๋ฅ˜ ํ•ด๊ฒฐ
date: 2025-03-04
updatedDate: 2025-03-04
tags: [pretendard safari, nextjs pretendard]
category: cross-browsing
image: ''
---

:::note
PretendardVariable ํฐํŠธ๋ฅผ ์‚ฌ์šฉํ–ˆ์„ ๋•Œ ๋ฐœ์ƒํ•œ ๋ฌธ์ œ์ž…๋‹ˆ๋‹ค.
:::

NextJS์—์„œ Pretendard ํฐํŠธ๋ฅผ ์ ์šฉํ–ˆ์„ ๋•Œ, Semibold ์ด์ƒ์˜ ๊ตต๊ธฐ๊ฐ€ **์œ ๋… ๊ตต๊ฒŒ ๋ Œ๋”๋ง ๋˜๋Š” ๋ฌธ์ œ**๊ฐ€ ๋ฐœ์ƒํ–ˆ๋‹ค.

![์ขŒ Chrome ์šฐ Safari](/images/pretendard-safari/weight-before.avif)

๊ตฌ๊ธ€๋ง์„ ํ†ตํ•ด ๋‹ค์Œ ๋ฐฉ๋ฒ•์œผ๋กœ ํ•ด๊ฒฐํ•  ์ˆ˜ ์žˆ๋‹ค๋Š” ๊ฑธ ์•Œ๊ฒŒ ๋˜์—ˆ๋‹ค.

```css
html,
body {
font-synthesis: none;
}
```

`font-synthesis: none;`์„ ์ ์šฉํ•˜๋ฉด **๋ธŒ๋ผ์šฐ์ €์˜ ๊ฐ•์ œ ํ•ฉ์„ฑ์„ ๋ง‰์•„** ํฐํŠธ ๊ตต๊ธฐ๊ฐ€ ์ •์ƒ์ ์œผ๋กœ ํ‘œ์‹œ๋œ๋‹ค.
ํ•˜์ง€๋งŒ, ํฐํŠธ์— ํŠน์ • ๊ตต๊ธฐ(weight)๋‚˜ italic ์Šคํƒ€์ผ์ด ์—†์œผ๋ฉด ๋ธŒ๋ผ์šฐ์ €๊ฐ€ ํ•ฉ์„ฑํ•ด ์ฃผ๋Š” ๊ธฐ๋Šฅ๋„ ๋ง‰ํ˜€์„œ **๋””์ž์ธ์ด ๋‹ฌ๋ผ์งˆ ์œ„ํ—˜**์ด ์žˆ๋‹ค.

![์ขŒ Chrome ์šฐ Safari](/images/pretendard-safari/italic-before.avif)

`font-synthesis: none;` ์ ์šฉ ํ›„ italic์„ ํ…Œ์ŠคํŠธํ•ด ๋ณด๋‹ˆ Chrome๊ณผ Safari ๋ชจ๋‘์—์„œ ์ ์šฉ๋˜์ง€ ์•Š๋Š” ๊ฑธ ํ™•์ธํ•  ์ˆ˜ ์žˆ์—ˆ๋‹ค.

## Pretendard ๊ณต์‹ ๋ฌธ์„œ์—์„œ ๊ถŒ์žฅํ•˜๋Š” ๋ฐฉ์‹

[Pretendard Github README](https://github.com/orioncactus/pretendard)๋ฅผ ์‚ดํŽด๋ณด๋ฉด, NextJS์—์„œ Pretendard๋ฅผ ์‚ฌ์šฉํ•  ๊ฒฝ์šฐ `weight` ์†์„ฑ์„ ์ถ”๊ฐ€ํ•˜๋ผ๋Š” ์•ˆ๋‚ด๊ฐ€ ์žˆ๋‹ค.

> weight ์˜ต์…˜์„ ์ง€์ •ํ•˜์ง€ ์•Š์œผ๋ฉด WebKit ๊ธฐ๋ฐ˜์˜ ๋ธŒ๋ผ์šฐ์ €์—์„œ ๊ตต๊ธฐ๊ฐ€ ์ž˜๋ชป ๋ Œ๋”๋ง ๋  ์ˆ˜ ์žˆ์œผ๋‹ˆ ์ฃผ์˜ํ•ด ์ฃผ์„ธ์š”.

```jsx
import localFont from 'next/font/local'

const pretendard = localFont({
src: './fonts/PretendardVariable.woff2',
display: 'swap',
weight: '45 920', // [!code highlight]
})
```

![์ขŒ Chrome ์šฐ Safari](/images/pretendard-safari/weight-after.avif)

`weight` ๊ฐ’์„ ์ถ”๊ฐ€ํ•ด ์ฃผ๋‹ˆ Safari์—์„œ์˜ ๊ตต๊ธฐ ๋ Œ๋”๋ง ์ด์Šˆ๊ฐ€ ํ•ด๊ฒฐ๋˜์—ˆ๋‹ค.

![์ขŒ Chrome ์šฐ Safari](/images/pretendard-safari/italic-after.avif)

italic ์—ญ์‹œ ์ •์ƒ์ ์œผ๋กœ ์ ์šฉ๋œ๋‹ค.
Loading