groff
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Using arbitrary fonts


From: T. Kurt Bond
Subject: Re: Using arbitrary fonts
Date: Mon, 30 Jan 2023 11:56:13 -0500

Blake, you may find it easier to use the install-font.sh script that is
distributed on the website of the mom macros:
https://www.schaffter.ca/mom/mom-05.html#install-font

(Brandon, I still intend to posixify that script, but I fell off the edge
of the world and it's a long climb back up.)

On Mon, Jan 30, 2023 at 11:51 AM Blake McBride <blake@mcbride.name> wrote:

> Hi Branden,
>
> Thanks a lot for the help!!!  However, I am having trouble interpreting
> your docs.
>
> Please forgive me.  Although I am a software engineer and have been using
> nroff/troff/groff for nearly 40 years, I never really got into the details
> behind fonts and their various formats.  I basically know very little about
> them.  The basic fonts that come with nroff/troff/groff have generally met
> my needs.
>
> 1. I am using PDF (not PS).
>
> 2.  As I mentioned, I have .otf, .ttf, .woff, and .woff2 files.  So my
> question is, can I use any of those, or do I need to convert them to
> another format?
>
> 2.a.  If I need to convert them, which do I start with, and what am I
> converting them to?
>
> 2.b.  How do I convert them?
>
> 3.  What do I install, and where do I install them?  Is there a special
> procedure besides just copying them?
>
> 4. Do I need to do something special to give them a name within an mm
> context?
>
> After all of that, doing
>
> \f[YOURNEWFONT]Blake McBride\f[]
>
> seems easy enough.
>
> If I can understand this and get it working, I would be happy to produce
> formal documentation for inclusion with GROFF (if desired).
>
> Thanks!
>
> Blake McBride
>
>
>
>
> On Mon, Jan 30, 2023 at 10:20 AM G. Branden Robinson <
> g.branden.robinson@gmail.com> wrote:
>
> > Hi Blake,
> >
> > At 2023-01-30T09:28:50-0600, Blake McBride wrote:
> > > I have been using the default groff fonts for many happy years.
> > > However, I need to produce a document with a machine-generated
> > > signature.  There are plenty of adequate signature fonts out there.
> > > However, I do not know how to make groff use them.
> > >
> > > I downloaded a font.  It came with files with the .otf, .ttf, .woff,
> > > and .woff2 extensions.  What are the exact steps I need to use to use
> > > them in a groff/mm document?  (I only want one line to use the special
> > > font.  The rest of the document can use the regular groff fonts.)
> >
> > The first thing to do is to make the font visible to the output driver,
> > which will probably be "ps" or "pdf".
> >
> > Here are some instructions from the grops(1) page in groff Git.
> >
> >   TrueType and other font formats
> >     TrueType fonts can be used with grops if converted first to Type 42
> >     format, a PostScript wrapper equivalent to the PFA format described
> >     in pfbtops(1).  Several methods exist to generate a Type 42 wrapper;
> >     some of them involve the use of a PostScript interpreter such as
> >     Ghostscript—see gs(1).
> >
> >     One approach is to use FontForge, a font editor that can convert
> >     most outline font formats.  Here’s an example of using the Roboto
> >     Slab Serif font with groff.  Several variables are used so that you
> >     can more easily adapt it into your own script.
> >
> >         MAP=/usr/local/share/groff/1.23.0/font/devps/generate/text.map
> >         TTF=/usr/share/fonts/truetype/roboto/slab/RobotoSlab-Regular.ttf
> >         BASE=$(basename "$TTF")
> >         INT=${BASE%.ttf}
> >         PFA=$INT.pfa
> >         AFM=$INT.afm
> >         GFN=RSR
> >         DIR=$HOME/.local/groff/font
> >         mkdir -p "$DIR"/devps
> >         fontforge -lang=ff -c "Open(\"$TTF\");\
> >         Generate(\"$DIR/devps/$PFA\");"
> >         afmtodit "$DIR/devps/$AFM" "$MAP" "$DIR/devps/$GFN"
> >         printf "$BASE\t$PFA\n" >> "$DIR/devps/download"
> >
> >     fontforge and afmtodit may generate warnings depending on the
> >     attributes of the font.  The test procedure is simple.
> >
> >         printf ".ft RSR\nHello, world!\n" | groff -F "$DIR" > hello.ps
> >
> >     Once you’re satisfied that the font works, you may want to generate
> >     any available related styles (for instance, Roboto Slab also has
> >     “Bold”, “Light”, and “Thin” styles) and set up GROFF_FONT_PATH in
> >     your environment to include the directory you keep the generated
> >     fonts in so that you don’t have to use the -F option.
> >
> > Ensure that you do the test procedure shown, before worrying about macro
> > package integration.
> >
> > Once this works (please reply to the list if it doesn't), the mm usage
> > issue can be tackled.
> >
> > > I need to produce a document with a machine-generated signature.
> >
> > In mm this requires some context.  Are you using one of the memorandum
> > types ("MT") or one of the letter formats ("LT")?  If so I'll have do
> > some digging, because the signature line is automatically printed and
> > I'll need to work up a recommendation for how to override that cleanly
> > (or someone who's more of an mm expert than I am may have ideas).
> >
> > If not, and you're outputting the signature line like any other
> > formatted text, it should be straightforward.
> >
> > Put in a line like this.
> >
> > \f[YOURNEWFONT]Blake McBride\f[]
> >
> > ...where YOURNEWFONT is the groff name you have given to the font you
> > installed using the procedure above.
> >
> > Let us know if this helps, or doesn't.
> >
> > Regards,
> > Branden
> >
>


-- 
T. Kurt Bond, tkurtbond@gmail.com, https://tkurtbond.github.io


reply via email to

[Prev in Thread] Current Thread [Next in Thread]