# Copyright 2026 Nadeŭka <me+oss@nadevko.cc>
# Distributed under the terms of the GNU General Public License v2
EAPI=8

inherit font

DESCRIPTION='Open-source GOST 2.304-81 compliant fonts family'
HOMEPAGE=https://codeberg.org/nadevko/opengostfonts

SRC_URI="$HOMEPAGE/releases/download/v$PV/OpenGostFonts-$PV.tar.xz -> $P.tar.xz"
S="$WORKDIR/OpenGostFonts-$PV"

LICENSE=OFL-1.1
SLOT=0

KEYWORDS='~*'

IUSE='+type-a +type-b +ttf +otf +plain +ostroke'
REQUIRED_USE='
	|| ( type-a type-b )
	|| ( ttf otf )
	|| ( plain ostroke )
'

src_install() {
	einstalldocs

	use type-a || rm "$S"/*TypeA*
	use type-b || rm "$S"/*TypeB*

	local suffixes=()
	use ttf && suffixes+=( ttf )
	use otf && suffixes+=( otf )

	FONT_SUFFIX="${suffixes[*]}"

	use plain || rm "$S"/*Regular.*
	use ostroke || rm "$S"/*-ostroke*

	font_src_install
}