Upgrade to Pro — share decks privately, control downloads, hide ads and more …

kanji banner

MSR
December 25, 2016

kanji banner

漢字バナー芸 - 仮名だけじゃなく漢字もください

※bannerコマンドにおける「GNU系」という表記は誤りで、正しくは「System V由来」です。

MSR

December 25, 2016
Tweet

More Decks by MSR

Other Decks in Technology

Transcript

  1. ໨࣍ ➤ ࣗݾ঺հ ➤ όφʔܳͱ͸ ➤ banner, figlet, toilet ➤

    toiletίϚϯυͷ֦ு (׽ࣈΛ͍ͩ͘͞) ➤ ·ͱΊ
  2. BANNERίϚϯυ࣮ߦྫ $ banner -w 50 a
 ### 
 ########
 ##########

    ##### 
 #### #### ######
 ## ## ## 
 ## ## # 
 ## ## ## 
 ##################
 ###################
 ##################
 ## 
 #
 $
  3. όφʔܳͷ୅දతͳίϚϯυ (2) - FIGLET ➤ bannerίϚϯυ͔Βදݱྗ͕ਐԽ ➤ ༷ʑͳදࣔํࣜ ➤ ඪ४౥ࡌͷϑΥϯτ͕๛෋(ΧλΧφͷΈ΍RTLͳ΋ͷ΋)


    showfigfonts ͰҰཡදࣔՄೳ ➤ ϑΥϯτ͸ࣗ࡞Մೳ ➤ ݱࡏɺ։ൃఀࢭத? (࠷৽൛͸2.2.5ɺ2012೥5݄Ҏ߱ߋ৽͞Ε͍ͯͳ͍)
  4. FIGLETίϚϯυ࣮ߦྫ $ figlet FIGlet
 _____ ___ ____ _ _ 


    | ___|_ _/ ___| | ___| |_ 
 | |_ | | | _| |/ _ \ __|
 | _| | | |_| | | __/ |_ 
 |_| |___\____|_|\___|\__|
 
 $ figlet -f roman FIGlet
 oooooooooooo ooooo .oooooo. oooo . 
 `888' `8 `888' d8P' `Y8b `888 .o8 
 888 888 888 888 .ooooo. .o888oo 
 888oooo8 888 888 888 d88' `88b 888 
 888 " 888 888 ooooo 888 888ooo888 888 
 888 888 `88. .88' 888 888 .o 888 . 
 o888o o888o `Y8bood8P' o888o `Y8bod8P' "888" 
 
 
 
 $
  5. όφʔܳͷ୅දతͳίϚϯυ (3) - TOILET ➤ figletͷஔ͖׵͑Λ໨తͨ͠ίϚϯυ ➤ Ծ໊ϑΥϯτඪ४౥ࡌ ➤ ΧϥʔදࣔɺHTMLग़ྗରԠ

    ➤ figletͱಉ༷ɺϑΥϯτࣗ࡞Մೳ(figletͱ͸ܗ͕ࣜҟͳΔ) ➤ ϥΠηϯε͸௝͍͠WTFPL (ύϒϦοΫϥΠηϯε͔ͩΒ޷͖ʹ͠΍͕Ε) ➤ ϗʔϜϖʔδ( http://caca.zoy.org/wiki/toilet )͸Ͳ͏ݟͯ΋͏˓͜
  6. TOILETίϚϯυ࣮ߦྫ $ toilet ͻΒ͕ͳΧλΧφOK׽ࣈ×
 m m m m m 


    m # m "" "m m" " mmm#m"mm # 
 ""#" # # "mm#""m "m # m"" "mmm#"""# 
 m" #"m #m""""m # # m# # # m" # 
 # # " # # # " m"""#m m" # 
 "mmm" mmm"" # "m" "mmm" " m" "m" 
 
 
 m m m 
 #mmmm # # mmmm m m 
 # m" "mmm#"""# "mmmm#"""" m" "m # m" m m 
 m" "mm" m" # # # # #m# "m" 
 m" m" # # # # # #m m" "m 
 mm"" m" "m" m" #mm# # "m 
 
 $
  7. TOILETͷϑΥϯτσʔλ ➤ ৔ॴ: /usr/local/share/figlet ͳͲ ➤ ֦ுࢠ: .tlf (※figletܗࣜ(.flf)΋࢖༻Մೳ) ➤

    ϑΥϯτσʔλ͸zipѹॖͯ͠΋Α͍ ➤ จࣈίʔυ͸Unicode
 →׽ࣈ΋ֆจࣈ΋(͠Α͏ͱࢥ͑͹)දࣔͰ͖Δ!
  8. ϑΥϯτσʔλͷܗࣜʢ֓ཁʣ ➤ 1ߦ໨͸tlf2a$ͱ͍͏ϔομ ɺ1จࣈ͋ͨΓͷߦ਺ͳͲΛఆٛ ➤ จࣈ͸UnicodeॱͰ֨ೲ͞Ε͍ͯΔ ➤ จࣈఆٛ ➤ 1ߦ໨͸Unicode஋ͱจࣈΛهड़

    ➤ 2ߦ໨Ҏ߱ʹରԠ͢ΔจࣈΛඳ͘ ➤ ֤ߦͷऴ୺͸@ͰऴΘΔ ➤ จࣈ1ݸͷ࠷ऴߦ͸@@ͰऴΘΔ 0x3042 ͋
 m @ 
 mmm#m"" @ 
 #mm#m @ 
 m# m" "m @ 
 # "m" # @ 
 "m" mm" @ 
 @ 
 @@
  9. ϑΥϯτσʔλฤूྫ ➤ ascii9.tlfΛల։ͯ͠add.tlfʹมߋͯ͠ɺ࣍ͷจࣈΛ௥Ճ 0x4ECA ࠓ
 # @
 m” “m @


    mm" --- "mm @
 mmmmm @
 m @
 m" @
 @
 @@ 0x65E5 ೔
 mmmmmmmmmm @
 # # @
 #mmmmmmmm# @
 # # @
 # # @
 mmmmmmmmmm @
 @
 @@ 0x1F359 
 m @
 # # @
 # # @
 # mmm # @
 # #m# # @
 mmmmmmmmm @
 @
 @@
  10. ࣮ߦྫ $ toilet -f add ࠓ೔͸
 # mmmmmmmmmm m m

    
 m" "m # # "m m #mm # # 
 mm" --- "mm #mmmmmmmm# m" """# # # 
 mmmmm # # # # # mmm # 
 m # # # mm"""#m # #m# # 
 m" mmmmmmmmmm "# "mmm" " mmmmmmmmm 
 
 
 $
  11. ࣗಈੜ੒͍ͨ͠ ➤ toiletͷιʔείʔυʹ͸ caca2tlf ͱ͍͏πʔϧ͕ଘࡏ ➤ caca2tlf ͸ libcaca಺෦Ͱ࢖༻͢ΔϑΥϯτΛtlfʹม׵͢Δπʔϧ
 (※libcaca͸ΞεΩʔΞʔτΛੜ੒͢ΔάϥϑΟοΫϥΠϒϥϦɺtoiletͰ࢖༻)

    ➤ libcaca಺෦Ͱ࢖༻͢ΔϑΥϯτ͸libcacaͷmakefontπʔϧͰੜ੒͢Δ ͔͠͠ɾɾɾ ➤ libcaca಺෦Ͱ࢖༻͢ΔϑΥϯτ͸׽ࣈ͕ੜ੒ର৅֎
 ͦͷ··ͩͱcaca2tlfͰ͸׽ࣈ͕ग़ͯ͜ͳ͍ ➤ makefontͱlibcacaͷιʔείʔυΛมߋ͠ɺίϯύΠϧ͢Δඞཁ͕͋Δ
  12. ׽ࣈΛࣗಈੜ੒͢Δʹ͸ 1. toilet, libcacaͷιʔείʔυΛೖख
 
 2. toiletΛίϯύΠϧ
 
 
 3.

    libcacaΛbootstrapͱconfigure·Ͱ࣮ߦ $ git clone https://github.com/cacalabs/toilet.git
 $ git clone https://github.com/cacalabs/libcaca.git $ cd toilet
 $ ./bootstrap
 $ ./configure
 $ make $ cd libcaca
 $ ./bootstrap
 $ ./configure
  13. ׽ࣈΛࣗಈੜ੒͢Δʹ͸ 4. libcaca/tools/makefont.cͷάϩʔόϧఆ਺഑ྻ blocklist ʹCJK౷߹׽ࣈΤϦΞ (0x3d00ʙ0x9fd5)Λ௥Ճ
 5. makefontΛίϯύΠϧ diff --git

    a/tools/makefont.c b/tools/makefont.c
 index 226c883..7c58c79 100644
 --- a/tools/makefont.c
 +++ b/tools/makefont.c
 @@ -61,6 +61,7 @@ static unsigned int const blocklist[] =
 0x3000, 0x3040, /* CJK Symbols and Punctuation: 。「」 */
 0x3040, 0x30a0, /* Hiragana: で す */
 0x30a0, 0x3100, /* Katakana: ロ ル */
 + 0x3d00, 0x9fd5, /* CJK unified Ideographs */
 0xff00, 0xfff0, /* Halfwidth and Fullwidth Forms: A, B, C, a, b, c */
 0x10400, 0x10450, /* Deseret: */
 0, 0
  14. ׽ࣈΛࣗಈੜ੒͢Δʹ͸ 6. ಺ଂϑΥϯτΛੜ੒͠ɺcaca/mono*.dataΛ্ॻ͖
 
 
 ˞ͦΕͧΕ9ϙΠϯτ༻ͱ12ϙΠϯτ༻Λੜ੒ɻmono9ͱmonobold12͸ݻఆ
 ˞ୈ2Ҿ਺ʹϑΥϯτ໊ͱϙΠϯτ਺Λهड़ɻ͜ΕͰਖ਼͍͔͠͸ະ֬ೝ
 ˞ୈ3Ҿ਺͸DPI஋(௨ৗ96)ɺୈ4Ҿ਺͸bpp(1ϐΫηϧ͋ͨΓͷϏοτ਺) 7. libcacaΛίϯύΠϧɺΠϯετʔϧ


    8. toiletͷtools/caca2tlfΛ࣮ߦ
 [libcaca/tools] $ ./makefont mono9 "IPA Gothic 9" 96 1 > ../caca/mono9.data
 [libcaca/tools] $./makefont monobold12 "IPA Gothic 12" 96 1 > ../caca/monobold12.data [libcaca] $ make
 [libcaca] $ sudo make install [toilet/tools] $ ./caca2tlf "Monospace 9" > /usr/local/share/figlet/ipa9
 [toilet/tools] $ ./caca2tlf "Monospace Bold 12" > /usr/local/share/figlet/ipa12
  15. ࣮ߦྫ $ toilet -f ipa12 ׽ࣈOK
 
 
 
 ##

    # ## 
 # ########## ############ ## # # 
 # ## # ## ## # # ## ## 
 ######### ## ## # # ## ## 
 # ## ## ## ## ######## ## # # ## # 
 # ## ## ## ## # # #### 
 # ######## ## # # ### 
 ## # # # ### 
 ########## ############## # # #### 
 # ## ############## # # ## # 
 # ########## # # # ## ## 
 # #### # ## ## ## ## 
 # ## ## # #### ## # 
 # ## ## #####
  16. ·ͱΊ ➤ όφʔܳͰ࢖༻͢Δ୅දίϚϯυ: banner, figlet, toilet ➤ toiletͷϑΥϯτ͸֦ுՄೳ ➤ ͦͷؾʹͳΕ͹׽ࣈදࣔ΋ֆจࣈ΋දࣔͰ͖Δ

    ➤ ׽ࣈͷࣗಈੜ੒͕͚ͨ͠Ε͹ 1. libcacaͷπʔϧmakefontΛվ଄ͯ͠libcacaΛίϯύΠϧɺΠϯετʔϧ 2. caca2tlfͰੜ੒ ➤ ࣗಈੜ੒͞ΕͨϑΥϯτϑΝΠϧ͸αΠζ͕େ͖͗ͯ͢ද͕ࣔ஗͍