9front - general discussion about 9front
 help / color / mirror / Atom feed
From: Eckard Brauer <eckard.brauer@gmx.de>
To: 9front@9front.org, Stanley Lieber <sl@stanleylieber.com>
Subject: Re: [9front] Re: recent changes
Date: Tue, 8 Dec 2020 17:46:06 +0100	[thread overview]
Message-ID: <20201208174606.7a2abe0c@gmx.de> (raw)
In-Reply-To: <725EFB20-5D33-4560-AA85-991B47F931D0@stanleylieber.com>

> On December 8, 2020 11:01:48 AM EST, Stanley Lieber
> <sl@stanleylieber.com> wrote: [...]  
> 
> also, i seem to have somehow misplaced my instructions for adding new
> fonts to troff/postscript. anyone recall who figured this out for us?
> 
> sl

Maybe you're asking for a topic just 3 years back (Dec 13, 2017, some
responses from Travis Moore). See below for 1st part.

Best regards,
E.

From: Travis Moore <umbraticus@prosimetrum.com>
Date: Wed, 13 Dec 2017 13:07:30 +1300
Subject: Re: [9front] WANTED: instructions for adding fonts to troff

> I'd like to expand the font options for troff in my installation.
> How might this be accomplished?

I've kept your mail in my inbox for nearly a year because I'd been
meaning to look into this.  I finally got around to it and figured out
a method of sorts:

1.	Obtain postscript versions of the font.
	The file with the font data has the extension .pfa or .pfb
	The file with the font metrics has the extension .afm
	I tested on the following materials:

		http://mirrors.ctan.org/fonts/urw/garamond.zip
		https://www.math.utah.edu/~beebe/fonts/urwfonts-1.0.zip
		https://www.math.utah.edu/~beebe/fonts/utopia-1.0.zip
		https://www.math.utah.edu/~beebe/fonts/charter-1.0.zip

	Apparently there are tools to convert from other formats.

2.	Convert the font metrics to a troff font description.
	The attached awk script is something I hacked up to do this:

		convpsfont ugmr8a.afm GA	# URW Garamond
	
	This creates a file GA which should look something like this:

		name GA
		fontname GaramondNo8-Reg
		spacewidth 26
		charset
		!	26	2	33
		"	42	2	34
		&c...

	Choose a name not in conflict with those in
	/sys/lib/troff/font/devutf/ Check the contents of this file
	makes sense; I haven't tested many fonts and my script may need
	adjustment or the output may need to be tweaked by hand. The
	troff font format is described in: /sys/doc/troff.ps!32
	The .afm format can be found at:
		http://www.adobe.com/content/dam/acom/en/devnet/font/pdfs/5004.AFM_Spec.pdf

	Put the resulting file GA in /sys/lib/troff/font/devutf/
	or else use troff's -F flag to point to the dir that holds it.

	You can now rm the .afm file or else keep it with its .pfa/.pfb

3.	Let postscript see the font.
	Put the font (.pfa/.pfb) in /sys/lib/postscript/font/
	I put mine in a subdir called useradded.
	Add an entry at the bottom of /sys/lib/postscript/font/fontmap:

		% fonts added by user
		GaramondNo8-Reg	useradded/ugmr8a.pfb

	Create a file called /sys/lib/postscript/troff/GA:

		0x0000 0x00ff GaramondNo8-Reg
		0x2010 0x2044 GaramondNo8-Reg
		0xfb00 0xfb06 GaramondNo8-Reg

	You can use other fonts for ranges missing from your font.

4.	Let ghostscript see the font.

		cd /sys/lib/ghostscript/font && mk

5.	Test.
		echo '.sp 1i
			.ft GA
			.ps 14
			Pack my box with five dozen liquor jugs.
			ø ß á ä à æ ¼ ½ ¾ © ¶ §' | troff | page

	ps2pdf will embed the font and make it printable everywhere.

Hope this is useful to someone,

Travis

  reply	other threads:[~2020-12-08 16:48 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-08 16:01 [9front] " Stanley Lieber
2020-12-08 16:08 ` [9front] " Stanley Lieber
2020-12-08 16:46   ` Eckard Brauer [this message]
2020-12-08 16:50   ` cinap_lenrek
2020-12-08 17:04     ` Stuart Morrow
2020-12-08 16:56   ` Kurt H Maier
2020-12-08 16:49 ` [9front] " ori
2020-12-08 20:08   ` cinap_lenrek
2020-12-09  0:24     ` cinap_lenrek
2020-12-09  0:29       ` Stanley Lieber
2020-12-09  9:34         ` umbraticus
2020-12-09 14:32           ` Stanley Lieber

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201208174606.7a2abe0c@gmx.de \
    --to=eckard.brauer@gmx.de \
    --cc=9front@9front.org \
    --cc=sl@stanleylieber.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).