noaione / mpv-js-scripts

Some mpv scripts I created (made in JS)
24 stars 2 forks source link

[Feature Request] Add `font` or `annotation-font` option in script-opt to properly handle Chinese characters. #15

Closed ak1ra-komj closed 2 months ago

ak1ra-komj commented 2 months ago

When fileName contains Chinese characters (or any other CJK or non-latin language), magick convert can't handle it without -font option, the final annotation left empty for those characters.

You can test their behavior using the -font option of ImageMagick,

# English is ok
magick -size 1000x200 caption:"The quick brown fox jumps over the lazy dog" output.en.png

# empty for Simplified Chinese without -font option
magick -size 1000x200 caption:"敏捷的棕色狐狸跳过了懒狗" output.zh-CN.png

# this is ok with -font option
magick -size 1000x200 -font c:/windows/fonts/msyh.ttc caption:"敏捷的棕色狐狸跳过了懒狗" output.zh-CN.msyh.png

# also empty for Japanese without -font option
magick -size 1000x200 caption:"素早い茶色のキツネが怠け者の犬を飛び越える" output.jpn.png

# this is ok with -font option
magick -size 1000x200 -font c:/windows/fonts/msyh.ttc caption:"素早い茶色のキツネが怠け者の犬を飛び越える" output.jpn.msyh.png
noaione commented 2 months ago

Please try with latest master

SubsPlease _VTuberなんだが配信切り忘れたら伝説になってた - 01 (1080p)  BA8D3DBA mkv mosaic4x3

You can configure it in screenshot-mosaic.conf

[...]
# The fallback font family to be used in imagemagick.
font_family=

See readme for more info

ak1ra-komj commented 2 months ago

Fixed! Thanks very much!