---
- name: fonts | Create font directory for Sarasa Gothic
  file:
    path: '{{ xdg_dir.data_home }}/fonts/sarasa-gothic'
    mode: '755'
    state: directory

- name: fonts | Download Sarasa Gothic font archive
  get_url:
    url: https://github.com/be5invis/Sarasa-Gothic/releases/download/v{{ font_versions['sarasa-gothic'] }}/sarasa-gothic-ttc-{{ font_versions['sarasa-gothic'] }}.7z
    dest: /tmp/sarasa-gothic.7z
    mode: '644'

# NOTE: require libarchive-tools package
- name: fonts | Decompress downloaded Sarasa Gothic font archive
  command: bsdtar -xf /tmp/sarasa-gothic.7z
  args:
    creates: '{{ xdg_dir.data_home }}/fonts/sarasa-gothic/sarasa-regular.ttc'
    chdir: '{{ xdg_dir.data_home }}/fonts/sarasa-gothic'
