Skip to content

v0.3.7

Compare
Choose a tag to compare
@hhrutter hhrutter released this 04 Nov 11:59
· 525 commits to master since this release
adad3e0

This release introduces basic support for CJKV and multi plane Unicode fonts in general.

In order to produce stamps/watermarks using your favorite TrueType font you need to install it as a user font:

Go-> pdfcpu font install SimSun.ttf
installing to /Users/horstrutter/Library/Application Support/pdfcpu/fonts...
SimSun

Supported are also TrueType collections:

Go-> pdfcpu font install Songti.ttc
installing to /Users/horstrutter/Library/Application Support/pdfcpu/fonts...
STSongti-SC-Black
STSongti-SC-Bold
STSongti-TC-Bold
STSongti-SC-Light
STSong
STSongti-TC-Light
STSongti-SC-Regular
STSongti-TC-Regular

The following command lists all fonts available:

Go-> pdfcpu font list
Corefonts:
  Courier
  Courier-Bold
  Courier-BoldOblique
  Courier-Oblique
  Helvetica
  Helvetica-Bold
  Helvetica-BoldOblique
  Helvetica-Oblique
  Symbol
  Times-Bold
  Times-BoldItalic
  Times-Italic
  Times-Roman
  ZapfDingbats

Userfonts(/Users/horstrutter/Library/Application Support/pdfcpu/fonts):
  STSong (43033 glyphs)
  STSongti-SC-Black (8535 glyphs)
  STSongti-SC-Bold (43033 glyphs)
  STSongti-SC-Light (43033 glyphs)
  STSongti-SC-Regular (43033 glyphs)
  STSongti-TC-Bold (43033 glyphs)
  STSongti-TC-Light (43033 glyphs)
  STSongti-TC-Regular (43033 glyphs)
  SimSun (22141 glyphs)

Now you are ready to stamp your file:

Go-> pdfcpu stamp add -mode text "这是一个测试" "fo:SimSun" in.pdf out.pdf
writing out.pdf...
pages: all

image

There is also a command for producing font cheat sheets.
pdfcpu will produce a single-page PDF for each Unicode plane covered in the current dir:

Go-> pdfcpu font cheat SimSun
creating cheatsheets for: SimSun

Go-> ls Sim*
-rw-r--r--@ 1 horstrutter  staff   5.9M Oct 27 22:31 SimSun_BMP.pdf

image

image

Open issues:

  • right to left languages
  • horizontal vs. vertical glyph selection
  • support for *.otf files using CFF

Thank you everybody for filing issues and PRs.
You are a big help in making pdfcpu even better
Happy coding 💚

Changelog

be6f998 Add CJVK font tests
89ecdcd Add Henrik Reinstädtler to contributors
7a03716 Add config.yml parsing for wasm
3447d04 Add font cheatsheet cmd
be1af10 Add support for TrueType collections
5c15907 Add support for Type0 fonts
718a3f0 Bump version
15cec79 Correct position of build tag in parseConfig.go
63d5b3d Fix #233
0abfbc1 Fix conversion points to inches.
adad3e0 Fix font test
478c2c9 Merge branch 'cjkv' into master
070b2d4 Remove not needed build tag in parseConfig_js.go
9c1b20f fix panic on zero index