LoginSignup
0
1

More than 3 years have passed since last update.

「文言」でレンダリングhelloworld(問天地好在)してみた

Posted at

はじめに

前回インストールしたwenyanコマンドを使い、レンダリングに挑戦します

実行

レンダリング処理はソースファイルを読み、縦書きにレンダリングし、svgファイルとして出力します。
usageを確認します

$ wenyan
 ,_ ,_
 \/ ==
 /\ []

WENYAN LANG 文言 Compiler v0.1.2

Usage: wenyan [options] [files...]

Options:
  -v, --version        Output the version
  -l, --lang <lang>    Target language, can be "js", "py" or "rb" (default: "js")
  -c, --compile        Output the compiled code instead of executing it
  -e, --eval <code>    Evaluate script
  -i, --interactive    Interactive REPL
  -o, --output [file]  Output compiled code or executing result to file
  -r, --render         Outputs renderings
  --roman [method]     Romanize identifiers. The method can be "pinyin", "baxter" or "unicode"
  --log <file>         Save log to file
  --title <title>      Override title in rendering
  -h, --help           Display help

ver0.1.2になり-rオプションが--romanから--renderになりました。

$ wenyan —render examples/helloworld.wy

ソースと同じexamplesフォルダにhelloworld.svgファイルが出来ました。

Screen Shot 2019-12-31 at 6.10.56.png

すごい、バッチリ縦書きでレンダリングされてます:clap_tone1:

しかし、よく見るとノドの逆側、右のタイトル部分にexamples/helloworldと表示されています。
usageを見直すと、
--titleOverride title in renderingとレンダリングに使用される旨表記されています。

$ wenyan —render examples/helloworld.wy --text "問天地好在"

Screen Shot 2019-12-31 at 6.44.19.png

無事タイトルが入りました

おわりに

ファイル名はソースと同名、出力もソースと同階層が仮定されて謎のエラーに悩まされる事なく、簡単にレンダリング出来ます。美しいですね

0
1
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
0
1