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

吉田を支える技術

cockscomb
November 26, 2021

 吉田を支える技術

cockscomb

November 26, 2021
Tweet

More Decks by cockscomb

Other Decks in Programming

Transcript

  1. ٢ాΛࢧ͑Δٕज़
    গ͚ͩؒ͠Λ͓͍ͯ٢ా͕͖·͢ɻ

    View full-size slide

  2. גࣜձࣾ͸ͯͳ
    νʔϑΤϯδχΞ
    Ճ౻ਘथ
    JEDPDLTDPNC

    View full-size slide

  3. 8%#13&447PM
    (SBQI2-׬શΨΠυ

    View full-size slide

  4. ͸ͯͳಗ໊μΠΞϦʔ
    ໊લΛӅָͯ͘͠͠೔هɻ
    w໊લΛग़ͣ͞ʹ೔هΛॻ͚ΔαʔϏε
    w೥݄೔ͷϦϦʔε͔Β೥

    View full-size slide

  5. ͸ͯͳಗ໊μΠΞϦʔ
    ݟ͑ͳ͍ͱ͜Ζͷվળ͕ओ
    wίϯςφԽͯ͠"84&,4Ͱ࣮ߦ
    wεύϜରࡦͷվળ
    wΞϓϦέʔγϣϯϩάͷվળ
    w΄͔

    View full-size slide

  6. ࣮Λݴ͏ͱ͸ͯͳ͸΋͏ͩΊͰ͢ɻ
    ಥવ͜Μͳ͜ͱݴͬͯ͝ΊΜͶɻ
    Ͱ΋ຊ౰Ͱ͢ɻ
    ̎ɺ̏೔ޙʹ΋ͷ͘͢͝
    ௕͍૿ా͕͋Γ·͢ɻ
    ͦΕ͕ऴΘΓͷ߹ਤͰ͢ɻ
    ఔͳ͘େ͖Ίͷຊా͕དྷΔͷͰ
    ؾΛ͚ͭͯɻ
    ͦΕ͕΍ΜͩΒɺগ͚ͩؒ͠Λ͓͍ͯ
    ٢ా͕͖·͢ɻ

    View full-size slide

  7. ͸ͯͳಗ໊μΠΞϦʔʹͳ͔ͥසग़͢Δจࣈྻ
    ૿ా

    View full-size slide

  8. ૿ాΛ٢ాʹ͍ͨ͠

    View full-size slide

  9. ૿ాΛ٢ాʹ͍ͨ͠
    ૿ాΛ٢ాʹ͢Δํ๏ʹ͍ͭͯͷݕ౼
    wαʔόͰT૿ా٢ాH
    wˠ(PPHMFCPUΛࠔΒͤͦ͏
    wϑϩϯτΤϯυͰT૿ా٢ాH
    wˠ࠷ۙͷ(PPHMFCPU͸+BWB4DSJQUΛධՁ͢Δ
    wͳΜ͔͍͢͝ϋοΫ

    View full-size slide

  10. ͳΜ͔͍͢͝ϋοΫ

    View full-size slide

  11. ૿ా͕٢ాʹͳΔ8FCϑΥϯτΛ࡞Δ
    ϑΥϯτͷߏ଄
    wϑΥϯτ͸ʮจࣈʯʹରԠ͢ΔʮάϦϑʯΛఏڙ͢Δ
    wจࣈ
    w6OJDPEFͷίʔυϙΠϯτ
    wॻهૉΫϥελ
    wάϦϑ͸จࣈͷܗ

    View full-size slide

  12. ૿ా͕٢ాʹͳΔ8FCϑΥϯτΛ࡞Δ
    ϑΥϯτʹؚ·ΕΔςʔϒϧͷྫ
    wHMZQςʔϒϧ
    wάϦϑ*%ʹରԠ͢ΔάϦϑͷܗঢ়
    wDNBQςʔϒϧ
    wίʔυϙΠϯτͱάϦϑ*%ͷରԠ

    View full-size slide

  13. ૿ా͕٢ాʹͳΔ8FCϑΥϯτΛ࡞Δ
    DNBQςʔϒϧΛॻ͖׵͑Δ
    6
    6
    ૿
    ٢

    View full-size slide

  14. ૿ా͕٢ాʹͳΔ8FCϑΥϯτΛ࡞Δ
    DNBQςʔϒϧΛॻ͖׵͑Δ
    6
    6
    ૿
    ٢

    View full-size slide

  15. GPOUUPPMT
    ϓϩάϥϚʔͳͷͰϑΥϯτΛϓϩάϥϜͰ࡞Δ
    w1ZUIPOͰϑΥϯτΛૢ࡞͢ΔϥΠϒϥϦ
    w(PPHMF΍"EPCF΋࢖͍ͬͯΔ

    View full-size slide

  16. def build_yoshida(base_font: ttLib.TTFont):


    masu = ord('૿')


    yoshi = ord('٢')


    cmap = base_font.getBestCmap()


    yoshi_cid = cmap[yoshi]


    head = base_font.get('head')


    fb = FontBuilder(head.unitsPerEm, isTTF=False)


    fb.setupGlyphOrder([".notdef", yoshi_cid])


    fb.setupCharacterMap({masu: yoshi_cid})

    View full-size slide

  17. yoshi_glyph = base_font.getGlyphSet().get(yoshi_cid)


    yoshi_pen = T2CharStringPen(yoshi_glyph.width, None)


    yoshi_glyph.draw(yoshi_pen)


    char_strings = {


    ".notdef":
    ...
    ,


    yoshi_cid: yoshi_pen.getCharString(),


    }


    fb.setupCFF(


    "Yoshida-Sans",


    {"FullName": "Yoshida-Sans"},


    char_strings,


    {}


    )

    View full-size slide

  18. ૿ా͕૿͑ͨˠ٢ా͕٢͑ͨ໰୊

    View full-size slide

  19. ૿ాͷͱ͖͚ͩ٢ాʹ͍ͨ͠

    View full-size slide

  20. ϦΨνϟʢ߹ࣈʣ
    ෳ਺ͷάϦϑͷฒͼΛҰͭͷάϦϑʹ͢Δ
    ffi


    f
    !=


    !=
    (BSBNPOE1SFNJFS1SP 'JSB$PEF ͔ͮΒ͖

    View full-size slide

  21. ϦΨνϟʢ߹ࣈʣ
    ෳ਺ͷจࣈͷฒͼΛҰͭͷάϦϑʹ͢Δ
    ૿ా
    ٢ా

    View full-size slide

  22. 0QFO5ZQFͷMJHBGFBUVSF
    (46#ςʔϒϧͰ࣮૷͞ΕΔ
    languagesystem DFLT dflt;


    feature liga {


    substitute cid13827 cid27065 by cidmasuda;


    } liga;

    View full-size slide

  23. fb.addOpenTypeFeatures(f'''


    languagesystem DFLT dflt;


    feature liga {{


    substitute {masu_cid} {da_cid} by {masuda_cid};


    }} liga;


    ''')


    pen = T2CharStringPen(yoshi_glyph.width + da_glyph.width, None)


    yoshi_glyph.draw(pen)


    da_glyph.draw(


    TransformPen(pen, transform.Offset(yoshi_glyph.width))


    )

    View full-size slide

  24. λΠϜϥΠϯ

    Šࢥ͍ͭ͘
    Ϛωʔδϟʢ٢ాʣͱ߹ҙ
    Š։ൃ։࢝
    ŠάϦϑͷஔ׵͕׬੒
    Šํ਑Λมߋ
    ŠϦΨνϟ׬੒
    ŠϓϧϦΫΤετ׬੒
    ŠϚʔδ
    ٢ాʹ͢ΔࢫΛࣾ಺ؔ܎ऀʹใࠂ
    Š൓ө

    View full-size slide

  25. ٢ా͕͖·ͨ͠
    w͓૽͕ͤ͠·ͨ͠
    wϑΥϯτʹखΛೖΕΔͱ͍͏खஈ
    wͨ·ʹ໾ʹཱͭ
    w4*-0QFO'POU-JDFOTF

    View full-size slide

  26. ࣍ճɺେ͖Ίͷຊాɻޤ͏͝ظ଴

    View full-size slide