1
5

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

grafana-reporterで日本語が表示されないので、LaTeXの日本語フォントを入れる

Posted at

やりたいこと

同僚がGrafanaの内容を出力するツール「grafana-reporter」を試していて、
はまった部分があり、その解決を手伝ったときのメモ。

GitHub
https://github.com/IzakMarais/reporter
Qiita事例
https://qiita.com/ksawada1979/items/20e8ba0f3b2d09cde73d

grafana-reporterインストール

インストール方法は、上記のQiitaの事例そのまんまで下記で入れられるっぽい。
ここらへんは同僚がやっていたので詳細知らないが、history見た感じ、そのまんまだった。

LaTeX関連のインストール

# yum install texlive-pdftex texlive-latex-bin texlive-texconfig* texlive-latex* texlive-metafont* texlive-cmap* texlive-ec texlive-fncychap* texlive-pdftex-def texlive-fancyhdr* texlive-titlesec* texlive-multirow texlive-framed* texlive-wrapfig* texlive-parskip* texlive-caption texlive-ifluatex* texlive-collection-fontsrecommended texlive-collection-latexrecommended texinfo-tex

パッケージ取得と解凍

# wget https://dl.google.com/go/go1.10.2.linux-amd64.tar.gz
# tar -C /usr/local -xzf go1.10.2.linux-amd64.tar.gz
# export PATH=$PATH:/usr/local/go/bin

インストールと起動

# go get github.com/IzakMarais/reporter/...
# go install -v github.com/IzakMarais/reporter/cmd/grafana-reporter
# grafana-reporter

GitHubの方を見れば、
起動時のコマンドオプションが書いてあるし、
Qiitaの事例の方にはsystemdの起動方法が書いてある。

日本語が表示されない

PDFでレポートが出力されるようになったが、
レポートの中身で日本語の箇所が表示されないという。
文字化けではなく、表示されないという事象

切り分け

最初はLaTeXの文字コードとかを同僚と一緒に疑ったが、

  • 文字化けではない
  • Grafanaの設定をエクスポートしてさくらエディタで見たら、UTF-8でちゃんと日本語が表示されていたこと
  • 同僚がCLIでgrafana-reporterからレポート出力しても同様だった

ということから、下記の事例に行き着いた。
https://github.com/IzakMarais/reporter/issues/46

同じような悩みはありそうなので、
GitHubのGrafana-reporterのIssueを見て回っていたところ、見つけた。
散々ググッタが、こうして公式のIssueに解決策があると、
やはり公式を見るのが近道というのを実感する

日本語フォントのインストール

LaTeX用に日本語フォントを入れる方法を検索して下記がヒット
https://water2litter.net/gin/?p=1738

同僚は下記をインストールしたら、無事にgrafana-reporterが日本語出力された模様。

# yum install texlive
# yum install texlive-xetex
# yum install texlive-xecjk
# yum install texlive-euenc
# yum install ipa-gothic-fonts ipa-mincho-fonts
# yum install ipa-pgothic-fonts ipa-pmincho-fonts
1
5
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
5

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?