#!/bin/sh
set -e

fc-cache -f

fc-match "B612" | grep -qi "b612"
fc-match "B612 Mono" | grep -qi "b612mono"
fc-match "B612:style=Bold" | grep -qi "b612"
fc-match "B612:style=Italic" | grep -qi "b612"
fc-match "B612:style=Bold Italic" | grep -qi "b612"
fc-match "B612Mono:style=Bold" | grep -qi "b612mono"
fc-match "B612Mono:style=Italic" | grep -qi "b612mono"
fc-match "B612Mono:style=Bold Italic" | grep -qi "b612mono"

# #1051064: the Mono faces must not claim the legacy "B612" family
fc-match "B612:style=Regular" file | grep -q "/B612-Regular.otf"
if fc-list "B612" file | grep -qi "b612mono"; then
	echo "FAIL: B612 Mono faces are listed under family B612" >&2
	exit 1
fi

echo "OK: All font families found by fontconfig."
