[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Reading font metrics

Ray(:bies, :mundo)

8/31/2006 9:09:00 PM

Hi, I'm looking for a way to read Truetype & PS Type 1 font metrics so
that I can generate a list of installed fonts by name in a Ruby script.
I have been searching the Internet for some tips on how-to with no luck
so far. Can anyone point me in the right direction?
Ta, Ray.

4 Answers

Austin Ziegler

8/31/2006 9:22:00 PM

0

On 8/31/06, Ray(:bies, :mundo) <ray@thecarrascos.com> wrote:
> Hi, I'm looking for a way to read Truetype & PS Type 1 font metrics so
> that I can generate a list of installed fonts by name in a Ruby script.
> I have been searching the Internet for some tips on how-to with no luck
> so far. Can anyone point me in the right direction?

I haven't implemented it yet, but there's definite information you can
get from one of the TeX distributions. Look for ttf2afm.

-austin
--
Austin Ziegler * halostatue@gmail.com * http://www.halo...
* austin@halostatue.ca * http://www.halo...feed/
* austin@zieglers.ca

Dave Howell

9/5/2006 11:48:00 PM

0


On Aug 31, 2006, at 14:10, Ray(:bies, :mundo) wrote:

> Hi, I'm looking for a way to read Truetype & PS Type 1 font metrics so
> that I can generate a list of installed fonts by name in a Ruby script.
> I have been searching the Internet for some tips on how-to with no luck
> so far. Can anyone point me in the right direction?

Hmm. First, you should figure out if your operating system offers a way
to do that. For example, on the Macintosh, fonts are almost certainly
in three different locations (/System/Library/Font, /Library/Fonts,
~/Library/Fonts) and could easily be in five or more (/System
Folder/Font, /Network/Library/Fonts). Using RubyCocoa to make a call to
the OS's font manager delivers a list of installed fonts without having
to try to track them all down. Dunno what the Win equivalent would be.

Second, if what you want are font names, you don't need any special
tool for PostScript fonts. .pfb files start with a text header that
contains the name of the font. Just read the first 1k or so of the file
into memory, and grep for the line with the info you want. In the case
of Caflisch Script Bold, your choices are:

/FullName (Caflisch Script Bold) readonly def
/FamilyName (Caflisch Script) readonly def
/FontName /CaflischScript-Bold def

You'll have to figure out which of those you want. All three are
required in a PostScript font.

TrueType fonts are more likely to be all-binary, and have to be run
through a translator of some kind. "ttf2afm" is a good tool for this;
it's available on a lot of platforms. The output will be very similar
to the above:

FullName Caflisch Script Bold
FamilyName Caflisch Script
FontName CaflischScript-Bold





Patrick Gundlach

9/6/2006 7:35:00 AM

0

Ray(:bies, :mundo) wrote:
> Hi, I'm looking for a way to read Truetype & PS Type 1 font metrics so
> that I can generate a list of installed fonts by name in a Ruby script.
> I have been searching the Internet for some tips on how-to with no luck
> so far. Can anyone point me in the right direction?
> Ta, Ray.

Hi,

I have just started a rubyforge project ('fontlib') that should be able
to do so. I'll take
some code from 'rfil' (the ruby font installler library - ) and put it
there. There is currently
only type1 support and truetype via the ttftoafm (from your favourite
TeX distribution).

Just in case you want to reply off-list: pg <at> levana . de

Patrick

--
Posted via http://www.ruby-....

zehnoner@gmail.com

10/18/2009 11:58:00 PM

0

On Oct 8, 5:51 pm, mr bill <libbysda...@gmail.com> wrote:
> On Oct 7, 3:12 pm, Jasmine <zehno...@gmail.com> wrote:
>
> > does the Almighty speak to us and if so, how? all thoughts are
> > appreciated...
>
> > Peace
>
> no
> there is no "almighty"
> :)

I think my tiny brain will accept that once it stops blaming "it" for
darkness. there are spoons everywhere! *achingly accepts the reality
of seeing spoons