---
- name: Install freetype2
  pacman:
    name: freetype2
    state: present

- name: Install cairo
  pacman:
    name: cairo
    state: present

- name: Install fontconfig
  pacman:
    name: fontconfig
    state: present

- name: Enable LCD filter
  file:
    src: /usr/share/fontconfig/conf.avail/11-lcdfilter-default.conf
    dest: /etc/fonts/conf.d/11-lcdfilter-default.conf
    state: link

- name: Enable sub-pixel rendering
  file:
    src: /usr/share/fontconfig/conf.avail/10-sub-pixel-rgb.conf
    dest: /etc/fonts/conf.d/10-sub-pixel-rgb.conf
    state: link

- name: Enable hinting
  file:
    src: /usr/share/fontconfig/conf.avail/10-hinting-slight.conf
    dest: /etc/fonts/conf.d/10-hinting-slight.conf
    state: link

- name: Push font substitutions
  copy:
    src: local.conf
    dest: /etc/fonts/local.conf

- name: Install base fonts
  pacman:
    name: "{{ base_fonts }}"
    state: present

- name: Install AUR fonts
  kewlfft.aur.aur:
    name: "{{ aur_fonts }}"
  become: yes
  become_user: "{{ aur.user }}"
  tags:
    - aur
