@@ -193,12 +197,13 @@
title="PDF Export"
description="Tune pagination and typography, then export a polished, print-ready PDF." />
+
{showPreview
- ?
+ ?
: null}
@@ -572,11 +577,12 @@
resetDocxExport();
}, [resetPdfExport, resetTextExport, resetDocxExport]);
- const pdfExportProps = useMemo(() => ({ showPreview, previewResult, options, editorFontFamily }), [
+ const pdfExportProps = useMemo(() => ({ showPreview, previewResult, options, editorFontFamily, documentText }), [
showPreview,
previewResult,
options,
editorFontFamily,
+ documentText,
]);
return (
diff --git a/src/components/export/ExportDialog/ExportOptions.tsx b/src/components/export/ExportDialog/ExportOptions.tsx
--- a/src/components/export/ExportDialog/ExportOptions.tsx
+++ b/src/components/export/ExportDialog/ExportOptions.tsx
@@ -1,6 +1,8 @@
import { ORIENTATIONS, PAGE_SIZES } from "$pdf/constants";
-import { MarginSide, Orientation, PageSize } from "$pdf/types";
+import { hasCjkContent, LATIN_ONLY_FONT_NAMES } from "$pdf/fonts";
+import { type FontName, MarginSide, Orientation, PageSize } from "$pdf/types";
import { usePdfDialogUiState } from "$state/selectors";
+import type { EditorFontFamily } from "$types";
import { type ReactNode, useCallback } from "react";
type OptionSectionProps = { title: string; description: string; children: ReactNode };
@@ -172,3 +174,16 @@
);
+
+type PdfCjkWarningProps = { documentText: string; editorFontFamily: EditorFontFamily };
+
+export const PdfCjkWarning = ({ documentText, editorFontFamily }: PdfCjkWarningProps) => {
+ const isLatinOnly = LATIN_ONLY_FONT_NAMES.has(editorFontFamily as FontName);
+ const hasCjk = hasCjkContent(documentText);
+ if (!isLatinOnly || !hasCjk) return null;
+ return (
+
+ CJK characters detected. PDF will use Maple Mono since {editorFontFamily} lacks CJK glyphs.
+
+ );
+};