Skip to content

Instantly share code, notes, and snippets.

@kaityo256
Last active July 16, 2025 12:31
Show Gist options
  • Save kaityo256/7a9894e58564f6dab46fb297b21608cb to your computer and use it in GitHub Desktop.
Save kaityo256/7a9894e58564f6dab46fb297b21608cb to your computer and use it in GitHub Desktop.
Word由来とLaTeX由来のPDFのフォントサイズの比較。

インストール。

git clone https://github.com/kaityo256/pdf-fontsize-analyzer
cd pdf-fontsize-analyzer
bundle install

上記のリポジトリには、WordとLaTeXで、

This is a pen.
これはペンです。

と書かれたPDFが保存されている。どちらも10.5ポイントのつもり。

比較。

Word由来。

$ ruby analyze_font_sizes.rb -v samples/word.pdf 
Page 1:
Font F1, Fontsize 10.56
Th
is i
s
 a pe
n.
Font F1, Fontsize 10.56

Font F2, Fontsize 10.56
<035E0397037A>
Font F2, Fontsize 10.56
<03D803F1>
Font F2, Fontsize 10.56
<03720364>
<027D>
Font F1, Fontsize 10.56

Font F1, Fontsize 10.56

Font Size       Character count
10.56           25

Average Size: 10.56

LaTeX由来。

$ ruby analyze_font_sizes.rb -v samples/latex.pdf 
Page 1:
Font F0, Fontsize 9.9626
This
is
a
p
en.
Font F2, Fontsize 9.2125
<035C0395037803D603EF03700362027B>
Font Size       Character count
9.2125          8
9.9626          11

Average Size: 9.65
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment