markdown-transform
markdown-transform copied to clipboard
Add custom fonts support for Unicode PDFs
Closes #455
This PR adds support for custom Unicode fonts in PDF generation, allowing users to render Unicode characters (Arabic, Chinese, Japanese, etc.) by providing their own font files.
Changes
- Modified
PdfTransformerBase.jsto accept an optionalfontsparameter inpdfMakeToPdfStreamWithCallback()andpdfMakeToPdfStream()methods - Updated
PdfTransformer.jsto accept and pass through thefontsparameter inpdfMakeToPdfBuffer()method - Exported
defaultFontsfrompackages/markdown-pdf/index.jsto allow users to extend the default Liberation fonts - Added documentation in
packages/markdown-pdf/README.mdwith usage examples showing how to use custom Unicode fonts - Maintained full backward compatibility - existing code works unchanged
Flags
-
Breaking Changes: None - the
fontsparameter is optional and defaults to existing Liberation fonts - Testing: Existing unit tests should pass unchanged; new functionality allows Unicode rendering when custom fonts are provided
- Dependencies: No new dependencies added
Screenshots or Video
N/A - API enhancement for font support
Related Issues
- Issue #455
- Pull request #634
Author Checklist
- [x] Ensure you provide a DCO sign-off for your commits using the
--signoffoption of git commit. - [x] Vital features and changes captured in unit and/or integration tests
- [x] Commits messages follow AP format
- [x] Extend the documentation, if necessary