Friday, May 27, 2022

[question/proposition] About prefixing fonts packages with `fonts-`

Hi all.

*For me*, currently, is not easy to list the available font packages
to install.

The output of `pkg_info -Q font` gives me a heterogeneous list of
package names. Some examples:

* `amigafonts-1.02p1` - suffix, no separator
* `apl-fonts-1.0p0` - suffix, separator
* `b612-font-1.008` - suffix, separator, non plural
* `farsifonts-ttf-0.4p3` - suffix + type (ttf), no separator
* `font-awesome-6.1.1` - prefix, separator, non plural
* `fontforge-20120731p5` - program :)
* `ja-fonts-funet-19911117p2` - lang (ja) + prefix
* `mixfont-mplus-ipa-20060520p7` - as part of the prefix

On the other hand and without doubt, a seasoned openbsd user (or not so)
has a copy of the ports tree at hand and can list the fonts under
the `fonts` category. There, he can see that some ports as `spleen` or
`abyssinica` are also packages for fonts available to install.


Thinking on improving this, what about if the prefix `fonts-`
is added to all the fonts packages?


To start, a low hang fruit can be add the prefix `fonts-` to
`PKGNAME` in:

```
index 95d4be75f33..755e740b3c9 100644
--- a/infrastructure/mk/font.port.mk
+++ b/infrastructure/mk/font.port.mk
@@ -8,9 +8,9 @@ EXTRACT_SUFX ?= .zip

.if defined(TYPEFACE)
. if defined(V)
-PKGNAME ?= ${TYPEFACE}-$V
+PKGNAME ?= fonts-${TYPEFACE}-$V
. elif defined(VERSION)
-PKGNAME ?= ${TYPEFACE}-${VERSION}
+PKGNAME ?= fonts-${TYPEFACE}-${VERSION}
. endif

FONTDIR ?= ${PREFIX}/share/fonts/${TYPEFACE}
```

followed by the addition of the changed package names in
`devel/quirks/files/Quirks.pm` and the update of all the
references on packages that depends on the renamed fonts.


Some indication of the rest of the work to do:

```
$ find fonts/ -mindepth 2 -name Makefile | wc -l
132
$ grep ^TYPEFACE $(find fonts/ -mindepth 2 -name Makefile) | wc -l
21
```

A lot! ~ 111 packages.


Another approach to "first modify font.port.mk, then fix the rest"
can be the modification of the existing fonts packages to add the
`TYPEFACE` variable in the Makefile (port-modules(5)) if this not
imply the change of the package name. This can be more gradual
and in the future, when a high percentage of the packages uses the
`TYPEFACE` variable then we can modify the font.port.mk file.

Note: this change is *easy* in regard that the contents of the
package doesn't change, only its name and it's trivial to compare the
content of the current font packages with the modified ones.


As a recent user of openbsd with some time to invert in the project:
this type of change is welcomed or it is perceived as not wanted?
Maybe someone has a better idea?


Regards,
JMPC

No comments:

Post a Comment