FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Ubuntu > Ubuntu User

 
 
LinkBack Thread Tools
 
Old 07-29-2011, 09:01 PM
NoOp
 
Default Need help to batch create pfm files via pf2afm

I've a large amount of licensed postscript fonts that I'd like to use in
OpenOffice/LO. I have both the .pfb and .pfm files in the same folder
and can generate the .afm file via:

$ pf2afm <fontfilename>

Unfortunately that will get old real fast with 400 font files. How would
I go about using pf2afm to batch convert all 400 in one go?

Note: Abiword only needs the .pfb, but OOo/LO require the .afm.


--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
 
Old 07-29-2011, 09:18 PM
Avi Greenbury
 
Default Need help to batch create pfm files via pf2afm

NoOp wrote:

> I've a large amount of licensed postscript fonts that I'd like to use
> in OpenOffice/LO. I have both the .pfb and .pfm files in the same
> folder and can generate the .afm file via:
>
> $ pf2afm <fontfilename>
>
> Unfortunately that will get old real fast with 400 font files. How
> would I go about using pf2afm to batch convert all 400 in one go?
>
> Note: Abiword only needs the .pfb, but OOo/LO require the .afm.
>
>

It's not clear quite which you'd like, but if it's for every file in
the directory, then in a bash prompt in the directory in question:

for file in *; do pf2afm $file; done

Which is a one-line form of this:

for file in *; do
pf2afm $file
done

Which causes bash to expand the asterisk to match every file name, and
iterate through them, passing each in turn (as the variable '$file') to
pf2afm.

The general syntax is

for [variable name] in[list]; do
something
done

And the newlines can be replaced with semi-colons. The [variable name]
is the definition of it - that's where you decide what you can refer to
the current list element with during the loop, and the 'list' can be
anything that produces a space- or newline-separated list.

So you could go restrict it to file of a particular extension:

for file in *.pfb

Or replace the asterisk with a way of getting just the part of the
filename before the extension if that's actually what you like:

for file in $(ls | awk -F. '{print $1}'); do

Where you run ls and pipe it through to awk, which splits each line on
periods (the argument to -F) and then prints the first element. You'd
then need to reappend whichever extension you need in the loop:

for file in $(ls | awk -F. '{print $1}'); do
pf2afm $file.pfm
done

I don't know the first thing about fonts, so I'm not sure which is
what you'd like

--
Avi

--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
 

Thread Tools




All times are GMT. The time now is 04:31 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org