Re: font.port.mk: change default font type handling

2023-05-09 Thread Stuart Henderson
On 2023/05/09 15:14, Matthieu Herrb wrote:
> On Tue, May 09, 2023 at 01:49:16PM +0100, Stuart Henderson wrote:
> > After a discussion with phessler, here's a diff which adjusts
> > font.port.mk (MODULES=font) so that, when FONTTYPES is not specified
> > and both ttf and otf files are present, the otf files are used instead
> > of ttf. (the Previous default was to only use ttf, anything else
> > needed explicit setting).
> > 
> > This currently only changes the files installed by one font
> > using the module (fonts/jaldi) though would have also changed
> > atkinson-hyperlegible if it hadn't been adjusted recently.
> > We could either change jaldi to set FONTTYPES=ttf, or switch
> > to otf and update the plist, I opted for the latter.
> > 
> > (the "&& break" is to stop after otf if any such files are copied).
> > 
> > any comments/ok?
> >
> 
> ok matthieu@ FWIW
> 
> In the atkinson-hyperlegible case, switching FONT_DISTSUBDIR was also
> needed as the OTF and TTF fonts are not in the same subdir of the
> distfile. So the porter needs to draw some attention. 

Ah yes, good point.

> And I discovered recently that one can also use EXTRACT_FILES to
> extract only the useful part of the distfile.  This could be used
> there to save a few I/O

While I see it being a little useful in extreme cases I don't much like
this - it means there's more to do for someone updating a port (and if
it's not noticed or the implications not realised, can be a bit of a
footgun).

Also (though not relevant to fonts) if one is grepping unpacked ports
source, it can mean missing chunks of "things which aren't needed by the
port".

None of the ports with actually big distfiles use this. texlive,
chromium and friends, mozillas, flightgear, wesnoth, stellarium, qt etc.



> > 
> > Index: infrastructure/mk/font.port.mk
> > ===
> > RCS file: /cvs/ports/infrastructure/mk/font.port.mk,v
> > retrieving revision 1.4
> > diff -u -p -r1.4 font.port.mk
> > --- infrastructure/mk/font.port.mk  4 Nov 2016 15:44:14 -   1.4
> > +++ infrastructure/mk/font.port.mk  9 May 2023 12:42:37 -
> > @@ -15,12 +15,17 @@ PKGNAME ?=  ${TYPEFACE}-${VERSION}
> >  
> >  FONTDIR ?= ${PREFIX}/share/fonts/${TYPEFACE}
> >  
> > -FONTTYPES ?=   ttf
> > +FONTTYPES ?=
> >  
> >  FONT_DISTDIR ?=${WRKSRC}
> >  
> > -MODFONT_do-install = ${INSTALL_DATA_DIR} ${FONTDIR}; \
> > -   for t in ${FONTTYPES}; do ${INSTALL_DATA} 
> > ${FONT_DISTDIR}/${FONT_DISTSUBDIR}/*.$$t ${FONTDIR}; done
> > +MODFONT_do-install = ${INSTALL_DATA_DIR} ${FONTDIR};
> > +
> > +.if empty(FONTTYPES)
> > +MODFONT_do-install += for t in otf ttf; do ${INSTALL_DATA} 
> > ${FONT_DISTDIR}/${FONT_DISTSUBDIR}/*.$$t ${FONTDIR} && break; done
> > +.else
> > +MODFONT_do-install += for t in ${FONTTYPES}; do ${INSTALL_DATA} 
> > ${FONT_DISTDIR}/${FONT_DISTSUBDIR}/*.$$t ${FONTDIR}; done
> > +.endif
> >  
> >  .  if !target(do-install)
> >  do-install:
> > Index: fonts/jaldi/Makefile
> > ===
> > RCS file: /cvs/ports/fonts/jaldi/Makefile,v
> > retrieving revision 1.2
> > diff -u -p -r1.2 Makefile
> > --- fonts/jaldi/Makefile23 Jan 2023 09:47:12 -  1.2
> > +++ fonts/jaldi/Makefile9 May 2023 12:42:37 -
> > @@ -2,6 +2,7 @@ COMMENT =   libre Devanagari typeface fami
> >  
> >  TYPEFACE = jaldi
> >  V =1.007
> > +REVISION = 0
> >  
> >  DISTFILES =${V}.zip
> >  MASTER_SITES = https://github.com/Omnibus-Type/Jaldi/archive/refs/tags/
> > Index: fonts/jaldi/pkg/PLIST
> > ===
> > RCS file: /cvs/ports/fonts/jaldi/pkg/PLIST,v
> > retrieving revision 1.1.1.1
> > diff -u -p -r1.1.1.1 PLIST
> > --- fonts/jaldi/pkg/PLIST   23 Jun 2022 12:50:04 -  1.1.1.1
> > +++ fonts/jaldi/pkg/PLIST   9 May 2023 12:42:37 -
> > @@ -1,4 +1,4 @@
> >  share/fonts/
> >  @fontdir share/fonts/jaldi/
> > -share/fonts/jaldi/Jaldi-Bold.ttf
> > -share/fonts/jaldi/Jaldi-Regular.ttf
> > +share/fonts/jaldi/Jaldi-Bold.otf
> > +share/fonts/jaldi/Jaldi-Regular.otf
> > 
> 
> -- 
> Matthieu Herrb
> 



Re: font.port.mk: change default font type handling

2023-05-09 Thread Matthieu Herrb
On Tue, May 09, 2023 at 01:49:16PM +0100, Stuart Henderson wrote:
> After a discussion with phessler, here's a diff which adjusts
> font.port.mk (MODULES=font) so that, when FONTTYPES is not specified
> and both ttf and otf files are present, the otf files are used instead
> of ttf. (the Previous default was to only use ttf, anything else
> needed explicit setting).
> 
> This currently only changes the files installed by one font
> using the module (fonts/jaldi) though would have also changed
> atkinson-hyperlegible if it hadn't been adjusted recently.
> We could either change jaldi to set FONTTYPES=ttf, or switch
> to otf and update the plist, I opted for the latter.
> 
> (the "&& break" is to stop after otf if any such files are copied).
> 
> any comments/ok?
>

ok matthieu@ FWIW

In the atkinson-hyperlegible case, switching FONT_DISTSUBDIR was also
needed as the OTF and TTF fonts are not in the same subdir of the
distfile. So the porter needs to draw some attention. 

And I discovered recently that one can also use EXTRACT_FILES to
extract only the useful part of the distfile.  This could be used
there to save a few I/O

> 
> Index: infrastructure/mk/font.port.mk
> ===
> RCS file: /cvs/ports/infrastructure/mk/font.port.mk,v
> retrieving revision 1.4
> diff -u -p -r1.4 font.port.mk
> --- infrastructure/mk/font.port.mk4 Nov 2016 15:44:14 -   1.4
> +++ infrastructure/mk/font.port.mk9 May 2023 12:42:37 -
> @@ -15,12 +15,17 @@ PKGNAME ?=${TYPEFACE}-${VERSION}
>  
>  FONTDIR ?=   ${PREFIX}/share/fonts/${TYPEFACE}
>  
> -FONTTYPES ?= ttf
> +FONTTYPES ?=
>  
>  FONT_DISTDIR ?=  ${WRKSRC}
>  
> -MODFONT_do-install = ${INSTALL_DATA_DIR} ${FONTDIR}; \
> - for t in ${FONTTYPES}; do ${INSTALL_DATA} 
> ${FONT_DISTDIR}/${FONT_DISTSUBDIR}/*.$$t ${FONTDIR}; done
> +MODFONT_do-install = ${INSTALL_DATA_DIR} ${FONTDIR};
> +
> +.if empty(FONTTYPES)
> +MODFONT_do-install += for t in otf ttf; do ${INSTALL_DATA} 
> ${FONT_DISTDIR}/${FONT_DISTSUBDIR}/*.$$t ${FONTDIR} && break; done
> +.else
> +MODFONT_do-install += for t in ${FONTTYPES}; do ${INSTALL_DATA} 
> ${FONT_DISTDIR}/${FONT_DISTSUBDIR}/*.$$t ${FONTDIR}; done
> +.endif
>  
>  .  if !target(do-install)
>  do-install:
> Index: fonts/jaldi/Makefile
> ===
> RCS file: /cvs/ports/fonts/jaldi/Makefile,v
> retrieving revision 1.2
> diff -u -p -r1.2 Makefile
> --- fonts/jaldi/Makefile  23 Jan 2023 09:47:12 -  1.2
> +++ fonts/jaldi/Makefile  9 May 2023 12:42:37 -
> @@ -2,6 +2,7 @@ COMMENT = libre Devanagari typeface fami
>  
>  TYPEFACE =   jaldi
>  V =  1.007
> +REVISION =   0
>  
>  DISTFILES =  ${V}.zip
>  MASTER_SITES =   https://github.com/Omnibus-Type/Jaldi/archive/refs/tags/
> Index: fonts/jaldi/pkg/PLIST
> ===
> RCS file: /cvs/ports/fonts/jaldi/pkg/PLIST,v
> retrieving revision 1.1.1.1
> diff -u -p -r1.1.1.1 PLIST
> --- fonts/jaldi/pkg/PLIST 23 Jun 2022 12:50:04 -  1.1.1.1
> +++ fonts/jaldi/pkg/PLIST 9 May 2023 12:42:37 -
> @@ -1,4 +1,4 @@
>  share/fonts/
>  @fontdir share/fonts/jaldi/
> -share/fonts/jaldi/Jaldi-Bold.ttf
> -share/fonts/jaldi/Jaldi-Regular.ttf
> +share/fonts/jaldi/Jaldi-Bold.otf
> +share/fonts/jaldi/Jaldi-Regular.otf
> 

-- 
Matthieu Herrb



Re: font.port.mk: change default font type handling

2023-05-09 Thread Peter Hessler
On 2023 May 09 (Tue) at 13:49:16 +0100 (+0100), Stuart Henderson wrote:
:After a discussion with phessler, here's a diff which adjusts
:font.port.mk (MODULES=font) so that, when FONTTYPES is not specified
:and both ttf and otf files are present, the otf files are used instead
:of ttf. (the Previous default was to only use ttf, anything else
:needed explicit setting).
:
:This currently only changes the files installed by one font
:using the module (fonts/jaldi) though would have also changed
:atkinson-hyperlegible if it hadn't been adjusted recently.
:We could either change jaldi to set FONTTYPES=ttf, or switch
:to otf and update the plist, I opted for the latter.
:
:(the "&& break" is to stop after otf if any such files are copied).
:
:any comments/ok?
:

OK as-is, but it would be cool if you could add a comment describing why
we have "&& break" in the loop.  I'm sure we'll forget why in a few
years.


:
:Index: infrastructure/mk/font.port.mk
:===
:RCS file: /cvs/ports/infrastructure/mk/font.port.mk,v
:retrieving revision 1.4
:diff -u -p -r1.4 font.port.mk
:--- infrastructure/mk/font.port.mk 4 Nov 2016 15:44:14 -   1.4
:+++ infrastructure/mk/font.port.mk 9 May 2023 12:42:37 -
:@@ -15,12 +15,17 @@ PKGNAME ?= ${TYPEFACE}-${VERSION}
: 
: FONTDIR ?=${PREFIX}/share/fonts/${TYPEFACE}
: 
:-FONTTYPES ?=  ttf
:+FONTTYPES ?=
: 
: FONT_DISTDIR ?=   ${WRKSRC}
: 
:-MODFONT_do-install = ${INSTALL_DATA_DIR} ${FONTDIR}; \
:-  for t in ${FONTTYPES}; do ${INSTALL_DATA} 
${FONT_DISTDIR}/${FONT_DISTSUBDIR}/*.$$t ${FONTDIR}; done
:+MODFONT_do-install = ${INSTALL_DATA_DIR} ${FONTDIR};
:+
:+.if empty(FONTTYPES)
:+MODFONT_do-install += for t in otf ttf; do ${INSTALL_DATA} 
${FONT_DISTDIR}/${FONT_DISTSUBDIR}/*.$$t ${FONTDIR} && break; done
:+.else
:+MODFONT_do-install += for t in ${FONTTYPES}; do ${INSTALL_DATA} 
${FONT_DISTDIR}/${FONT_DISTSUBDIR}/*.$$t ${FONTDIR}; done
:+.endif
: 
: .  if !target(do-install)
: do-install:
:Index: fonts/jaldi/Makefile
:===
:RCS file: /cvs/ports/fonts/jaldi/Makefile,v
:retrieving revision 1.2
:diff -u -p -r1.2 Makefile
:--- fonts/jaldi/Makefile   23 Jan 2023 09:47:12 -  1.2
:+++ fonts/jaldi/Makefile   9 May 2023 12:42:37 -
:@@ -2,6 +2,7 @@ COMMENT =  libre Devanagari typeface fami
: 
: TYPEFACE =jaldi
: V =   1.007
:+REVISION =0
: 
: DISTFILES =   ${V}.zip
: MASTER_SITES =https://github.com/Omnibus-Type/Jaldi/archive/refs/tags/
:Index: fonts/jaldi/pkg/PLIST
:===
:RCS file: /cvs/ports/fonts/jaldi/pkg/PLIST,v
:retrieving revision 1.1.1.1
:diff -u -p -r1.1.1.1 PLIST
:--- fonts/jaldi/pkg/PLIST  23 Jun 2022 12:50:04 -  1.1.1.1
:+++ fonts/jaldi/pkg/PLIST  9 May 2023 12:42:37 -
:@@ -1,4 +1,4 @@
: share/fonts/
: @fontdir share/fonts/jaldi/
:-share/fonts/jaldi/Jaldi-Bold.ttf
:-share/fonts/jaldi/Jaldi-Regular.ttf
:+share/fonts/jaldi/Jaldi-Bold.otf
:+share/fonts/jaldi/Jaldi-Regular.otf
:

-- 
The light at the end of the tunnel is the headlight of an approaching
train.