Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

Going the speed of light is bad for your age.


devel / comp.lang.postscript / otf/ttf to afm with kern pair adjustments

SubjectAuthor
* otf/ttf to afm with kern pair adjustmentsdougLas.L.mc...@maiL.mil
`* Re: otf/ttf to afm with kern pair adjustmentsken
 `* Re: otf/ttf to afm with kern pair adjustmentsdougLas.L.mc...@maiL.mil
  `- Re: otf/ttf to afm with kern pair adjustmentsken

1
otf/ttf to afm with kern pair adjustments

<1c5cc337-1238-4e92-9649-3ce56166a2b8n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=75&group=comp.lang.postscript#75

  copy link   Newsgroups: comp.lang.postscript
X-Received: by 2002:a37:a886:: with SMTP id r128mr21008873qke.453.1632688918910;
Sun, 26 Sep 2021 13:41:58 -0700 (PDT)
X-Received: by 2002:a9d:64f:: with SMTP id 73mr5017001otn.373.1632688918658;
Sun, 26 Sep 2021 13:41:58 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.postscript
Date: Sun, 26 Sep 2021 13:41:58 -0700 (PDT)
Injection-Info: google-groups.googlegroups.com; posting-host=2603:3007:900:2900:acc2:98fe:16f3:a340;
posting-account=vk9mFQoAAABIxUPOHNl8UYcimPtveet8
NNTP-Posting-Host: 2603:3007:900:2900:acc2:98fe:16f3:a340
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <1c5cc337-1238-4e92-9649-3ce56166a2b8n@googlegroups.com>
Subject: otf/ttf to afm with kern pair adjustments
From: dougLas.L.mcaLLaster.civ@mail.mil (dougLas.L.mc...@maiL.mil)
Injection-Date: Sun, 26 Sep 2021 20:41:58 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 180
 by: dougLas.L.mc...@maiL - Sun, 26 Sep 2021 20:41 UTC

Folks,

I found below postscript program in ghostscript distro.
I creates the AFM file but does not include the KPX data.
Does any have a ps job which extracts the KPX data?
Thx, Doug McAllaster
Gettysburg, PA
======
%!
% written by James Clark <jjc@jclark.uucp>
% print an afm file on the standard output
% usage is `fontname printafm' eg `/Times-Roman printafm'

% From the `dvitops' distribution, which included this notice:
% dvitops is not copyrighted; you can do with it exactly as you please.
% I would, however, ask that if you make improvements or modifications,
% you ask me before distributing them to others.

% Altered by d.love@dl.ac.uk to produce input for Rokicki's afm2tfm,
% which groks the format of the Adobe AFMs.

% Modified by L. Peter Deutsch 9/14/93:
% uses Ghostscript's =only procedure to replace 'buf cvs print'.
% Modified by L. Peter Deutsch 9/6/95:
% uses Ghostscript's .shellarguments facility to accept the font name
% on the command line.

% Altered my master@iaas.msu.ru to work with fonts of more than 256 glyphs
% and avoid FSType output. Also print a comment with UniqueID of the font.

/onechar 1 string def

% c toupper - c
/toupper {
dup dup 8#141 ge exch 8#172 le and {
8#40 sub
} if
} bind def

% print unencoded character metric data lines for glyphs in `v' array
% and reset `v' -
/printv {
% define a new font with v as its encoding vector
currentfont maxlength dict /f exch def
currentfont {
exch dup dup /FID ne exch /Encoding ne and {
exch f 3 1 roll put
} {
pop pop
} ifelse
} forall
f /Encoding v put
f /FontName /temp put
% make this new font the current font
/temp f definefont setfont
% print a entry for each character not in old vector
/e currentfont /Encoding get def
0 1 255 {
dup e exch get
dup dup /.notdef ne exch s exch known not and {
exch -1 printmetric
} {
pop pop
} ifelse
} for
0 1 255 {
v exch /.notdef put
} for
} bind def

% printcharmetrics -

/printcharmetrics {
(StartCharMetrics ) print
currentfont /CharStrings get dup length exch /.notdef known { 1 sub } if =
currentfont 1000 scalefont setfont 0 0 moveto
/e currentfont /Encoding get def
0 1 255 {
dup e exch get
dup /.notdef ne {
exch dup printmetric
} {
pop pop
} ifelse
} for
% s contains an entry for each name in the original encoding vector
/s 256 dict def
e {
s exch true put
} forall
% v is the new encoding vector
/v 256 array def
0 1 255 {
v exch /.notdef put
} for
% fill up v with names in CharStrings
/i 0 def
currentfont /CharStrings get {
pop
i 255 le {
v i 3 -1 roll put
/i i 1 add def
} {
printv
v 0 3 -1 roll put
/i 1 def
} ifelse
} forall
printv
(EndCharMetrics) =
} bind def

% name actual_code normal_code printmetric -

/printmetric {
/saved save def
(C ) print =only
( ; WX ) print
onechar 0 3 -1 roll put
onechar stringwidth pop round cvi =only
( ; N ) print =only
( ; B ) print
onechar false charpath flattenpath mark pathbbox counttomark {
counttomark -1 roll
round cvi =only
( ) print
} repeat pop
(;) =
saved restore
} bind def

% fontname printafm -

/printafm {
findfont gsave setfont
(StartFontMetrics 2.0) =

% Print the UniqueID

currentfont /UniqueID known {
(Comment UniqueID ) print
currentfont /UniqueID get =only
(\n) print
} if

(FontName ) print currentfont /FontName get =

% Print the FontInfo

currentfont /FontInfo get {
exch
dup /FSType ne {
=string cvs dup dup 0 get 0 exch toupper put print
( ) print =
} {
pop pop
} ifelse
} forall

% Print the FontBBox

(FontBBox) print
currentfont /FontBBox get {
( ) print round cvi =only
} forall
(\n) print

printcharmetrics
(EndFontMetrics) =
grestore
} bind def

% Check for command line arguments.
[ .shellarguments
{ ] dup length 1 eq
{ 0 get printafm }
{ (Usage: printafm fontname\n) print flush }
ifelse
}
{ pop }
ifelse

Re: otf/ttf to afm with kern pair adjustments

<MPG.3bbbdae31659aa5f9898cd@usenet.plus.net>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=76&group=comp.lang.postscript#76

  copy link   Newsgroups: comp.lang.postscript
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!4.us.feeder.erje.net!2.eu.feeder.erje.net!feeder.erje.net!newsfeed.xs4all.nl!newsfeed9.news.xs4all.nl!border2.nntp.ams1.giganews.com!nntp.giganews.com!buffer2.nntp.ams1.giganews.com!nntp.brightview.co.uk!news.brightview.co.uk.POSTED!not-for-mail
NNTP-Posting-Date: Tue, 28 Sep 2021 01:52:47 -0500
From: ken@spamcop.net (ken)
Newsgroups: comp.lang.postscript
Subject: Re: otf/ttf to afm with kern pair adjustments
Date: Tue, 28 Sep 2021 07:52:45 +0100
Message-ID: <MPG.3bbbdae31659aa5f9898cd@usenet.plus.net>
References: <1c5cc337-1238-4e92-9649-3ce56166a2b8n@googlegroups.com>
Reply-To: ken@spamcop.net
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
User-Agent: MicroPlanet-Gravity/3.0.4
X-Antivirus: Avast (VPS 210928-0, 28/9/2021), Outbound message
X-Antivirus-Status: Clean
Lines: 32
X-Usenet-Provider: http://www.giganews.com
X-Trace: sv3-obPiP3OxhB5aVoyDCbD6U8J+BJaKBlZdt9GMs9CCEDWD4COHVPLNIgQ6Ohh4jUxlza9LzV49ppTxss2!pqnCAoMOGgHvvHUDX6M2QBINKAOk7iojfP7WaQRKYYSuso+H/ayrc3JyB6SzmgdOThViv1GyqNxy!mX2leTwtrWmHSGM=
X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly
X-Postfilter: 1.3.40
X-Original-Bytes: 2563
 by: ken - Tue, 28 Sep 2021 06:52 UTC

In article <1c5cc337-1238-4e92-9649-3ce56166a2b8n@googlegroups.com>,
dougLas.L.mcaLLaster.civ@mail.mil says...

> I found below postscript program in ghostscript distro.
> I creates the AFM file but does not include the KPX data.
> Does any have a ps job which extracts the KPX data?

The printafm.ps program doesn't actully extract any data from the font
at all. What it does is use the built-in font interpreter to interpret
the font data, and some standard PostScript to **create** soemthing akin
to an AFM file. THis means that it will work with any font type
supported by Ghostscript.

Basically it does this by using the PostScript 'stringwidth' on a single
character to determine the horizontal (or vertical, for vertical writing
fonts) displaement of the glyph, and then turns the glyph description
into a path, and executes charpath pathbbox to determine the bounding
box.

If you want actual data from the TrueType font you will need to write a
PostScript program to read and interpret TrueType/OpenType fonts
(bearing in mind that OpenType fonts can have CFF outline data).

Presumably you want the kern table (I've no idea what KPX means in this
context) since you mention OpenType/TrueType fonts.

To be frank, you would almost certainly be better off extracting that
with some other tool; writing a PostScript program to do it is perfectly
possible but probably not wise.

Ken

Re: otf/ttf to afm with kern pair adjustments

<e9ef8c45-fd6c-443f-b2ce-3e77dc34fb95n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=77&group=comp.lang.postscript#77

  copy link   Newsgroups: comp.lang.postscript
X-Received: by 2002:ac8:4744:: with SMTP id k4mr7486955qtp.247.1633021330115;
Thu, 30 Sep 2021 10:02:10 -0700 (PDT)
X-Received: by 2002:a05:6808:10d5:: with SMTP id s21mr268744ois.98.1633021329827;
Thu, 30 Sep 2021 10:02:09 -0700 (PDT)
Path: i2pn2.org!rocksolid2!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.postscript
Date: Thu, 30 Sep 2021 10:02:09 -0700 (PDT)
In-Reply-To: <MPG.3bbbdae31659aa5f9898cd@usenet.plus.net>
Injection-Info: google-groups.googlegroups.com; posting-host=2603:3007:900:2900:18ba:800c:da59:2d6c;
posting-account=vk9mFQoAAABIxUPOHNl8UYcimPtveet8
NNTP-Posting-Host: 2603:3007:900:2900:18ba:800c:da59:2d6c
References: <1c5cc337-1238-4e92-9649-3ce56166a2b8n@googlegroups.com> <MPG.3bbbdae31659aa5f9898cd@usenet.plus.net>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <e9ef8c45-fd6c-443f-b2ce-3e77dc34fb95n@googlegroups.com>
Subject: Re: otf/ttf to afm with kern pair adjustments
From: dougLas.L.mcaLLaster.civ@mail.mil (dougLas.L.mc...@maiL.mil)
Injection-Date: Thu, 30 Sep 2021 17:02:10 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 38
 by: dougLas.L.mc...@maiL - Thu, 30 Sep 2021 17:02 UTC

On Tuesday, September 28, 2021 at 2:52:49 AM UTC-4, ken wrote:
> In article <1c5cc337-1238-4e92...@googlegroups.com>,
> dougLas.L.mc...@mail.mil says...
> > I found below postscript program in ghostscript distro.
> > I creates the AFM file but does not include the KPX data.
> > Does any have a ps job which extracts the KPX data?
> The printafm.ps program doesn't actully extract any data from the font
> at all. What it does is use the built-in font interpreter to interpret
> the font data, and some standard PostScript to **create** soemthing akin
> to an AFM file. THis means that it will work with any font type
> supported by Ghostscript.
>
> Basically it does this by using the PostScript 'stringwidth' on a single
> character to determine the horizontal (or vertical, for vertical writing
> fonts) displaement of the glyph, and then turns the glyph description
> into a path, and executes charpath pathbbox to determine the bounding
> box.
>
> If you want actual data from the TrueType font you will need to write a
> PostScript program to read and interpret TrueType/OpenType fonts
> (bearing in mind that OpenType fonts can have CFF outline data).
>
> Presumably you want the kern table (I've no idea what KPX means in this
> context) since you mention OpenType/TrueType fonts.
>
> To be frank, you would almost certainly be better off extracting that
> with some other tool; writing a PostScript program to do it is perfectly
> possible but probably not wise.
>
>
> Ken
Thanks, Ken, for explaining what that printAFM.ps job actually does.
Yes, I am after the kern table.
Do you have any suggestions on what 'tool' would extract the kern table from a TTF or OTF font file?

Re: otf/ttf to afm with kern pair adjustments

<MPG.3bc0c10185f2f4ee9898ce@usenet.plus.net>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=78&group=comp.lang.postscript#78

  copy link   Newsgroups: comp.lang.postscript
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!4.us.feeder.erje.net!2.eu.feeder.erje.net!feeder.erje.net!border1.nntp.ams1.giganews.com!nntp.giganews.com!buffer1.nntp.ams1.giganews.com!nntp.brightview.co.uk!news.brightview.co.uk.POSTED!not-for-mail
NNTP-Posting-Date: Fri, 01 Oct 2021 01:54:51 -0500
From: ken@spamcop.net (ken)
Newsgroups: comp.lang.postscript
Subject: Re: otf/ttf to afm with kern pair adjustments
Date: Fri, 1 Oct 2021 07:54:49 +0100
Message-ID: <MPG.3bc0c10185f2f4ee9898ce@usenet.plus.net>
References: <1c5cc337-1238-4e92-9649-3ce56166a2b8n@googlegroups.com> <MPG.3bbbdae31659aa5f9898cd@usenet.plus.net> <e9ef8c45-fd6c-443f-b2ce-3e77dc34fb95n@googlegroups.com>
Reply-To: ken@spamcop.net
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
User-Agent: MicroPlanet-Gravity/3.0.4
X-Antivirus: Avast (VPS 211001-0, 1/10/2021), Outbound message
X-Antivirus-Status: Clean
Lines: 17
X-Usenet-Provider: http://www.giganews.com
X-Trace: sv3-jEA3cAcJc6J3ZV1MUewDnKaGz9PmC1QuWtTP8dgBkS4/ouj4qD0zN+4wHDETuxrdiagoBtXBNg6FDPn!SSZJ3FhRtagWqkPnZLqnJkuWODVS21gFRGt/mOaurqeBNznh8EN4pZxe5IPRBzqVP1Gh+JkfPvNE!zdJ6oocjYSj7t4o=
X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly
X-Postfilter: 1.3.40
X-Original-Bytes: 1932
 by: ken - Fri, 1 Oct 2021 06:54 UTC

In article <e9ef8c45-fd6c-443f-b2ce-3e77dc34fb95n@googlegroups.com>,
dougLas.L.mcaLLaster.civ@mail.mil says...

> Thanks, Ken, for explaining what that printAFM.ps job actually does.
> Yes, I am after the kern table.
> Do you have any suggestions on what 'tool' would extract the kern table from a TTF or OTF font file?

Well there's FreeType of course, the Microsoft Font Validation tool (I'm
not sure that dumps the table but it might), then there's ttfdump, I
suspect FontForge will give you the information too.

Obviously there may be other tools around, and of course there are
always commercial solutions as well. All the ones above are FOSS
projects of one kind or another.

Ken

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor