Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Display all glyphs in Mincho font? Check for self-intersecting outlines?

4 views
Skip to first unread message

Peter Davis

unread,
May 24, 2010, 10:36:35 AM5/24/10
to
We've used FontLabs's AsiaFont Studio to automatically generate bold
versions of some Asian fonts, including MS Mincho. This worked quite
well for most glyphs, but there are a couple of cases where the
outlines self-intersect, causing the bold characters to look totally
awful. FontLabs acknowledged the bug, but doesn't appear to have or
be planning a fix for this anytime in the forseeable future.

I'd like to at least know how many glyphs are affected. Do to that, I
figured I'd write some PostScript code to iterate through the glyphs
and test for self-intersecting outlines. I've done a lot of
PostScript programming over the years, but not so much with TrueType
fonts. Is there an easy way to embed this large TTF so that I can
iterate through it's characters?

Also, is there a straightforward way to check for self intersections
in the outline? As brute force, I could flatten the outline and test
each segment against each other segment, but I thought someone might
have a clever easier way, perhaps using insideness testing.

Thanks!
-pd

ken

unread,
May 24, 2010, 12:09:12 PM5/24/10
to
In article <b2d6eacb-56a5-4f75-bdac-
80dc26...@c11g2000vbe.googlegroups.com>, pfd...@gmail.com says...


> I'd like to at least know how many glyphs are affected. Do to that, I
> figured I'd write some PostScript code to iterate through the glyphs
> and test for self-intersecting outlines. I've done a lot of
> PostScript programming over the years, but not so much with TrueType
> fonts. Is there an easy way to embed this large TTF so that I can
> iterate through it's characters?

Problem 1; PostScript doesn't support TrueType fonts.

It does support type 42 fonts, and CIDFonts with type 42 outlines, but
not actual TrueType fonts. That said, many PostScript interpreters will
allow you to load a native disk-based TrueType font as some form of
PostScript font, usually a CIDFont with Type 42 outlines.

However, this is always implementation-dependent, because its not part
of the specification. So you may or may not get access to the entire
glyph range of the font. The actual glyph range available may depend on
some implementation-specific detail, and it may change depending how the
font has been mapped internally in the RIP.

Assuming the font is available as a Type 2 CIDFont (Type 42 outlines),
you could use the CIDCoutn and/or CIDMap. The internals of the font
dictionary should contain:

/CIDCount <integer>
/GDBytes <integer>
/CIDMap <string|array>

The font contains glyphs with CIDs from 0 to CIDCount-1 (warning not all
glyphs need be present!). So you could simply iterate the CIDs using
glyphshow.

You could instead read the CIDMap whish is either a string or array of
strings, CIDCountxGDBytes in size. Each 'GDBytes' in the string is the
Glyph ID of the TrueType glyph which is stored in the sfnts array. GID
is the TrueType .notdef, which you could skip if you like.


I would recommend you use the Microsoft Font Validator tool
(http://www.microsoft.com/typography/developers/validator/). This uses
the actual TrueType font, and the glyf table tests include (among other
things) a test for self-intersection. Here's an example from a run I
made on msmincho.ttc:

W1112 Not all extremes are marked with the on-curve control points Glyph
index 871
E1111 Intersecting contours Glyph index 871
A1111 Unable to perform test due to previously detected errors Glyph
index 871 Test: ValidateSimpContMisor
W1112 Not all extremes are marked with the on-curve control points
Glyph index 872


FWIW I counted 26 occurences in 17,727 glyphs in the report.

Ken

Peter Davis

unread,
May 24, 2010, 12:58:22 PM5/24/10
to
On May 24, 12:09 pm, ken <k...@spamcop.net> wrote:
> In article <b2d6eacb-56a5-4f75-bdac-
> 80dc26bc0...@c11g2000vbe.googlegroups.com>, pfda...@gmail.com says...

>
> > I'd like to at least know how many glyphs are affected.  Do to that, I
> > figured I'd write some PostScript code to iterate through the glyphs
> > and test for self-intersecting outlines.  I've done a lot of
> > PostScript programming over the years, but not so much with TrueType
> > fonts.  Is there an easy way to embed this large TTF so that I can
> > iterate through it's characters?
>
> Problem 1; PostScript doesn't support TrueType fonts.

Thanks, Ken. I should have been more explicit. I was assuming I'd
have to convert the font into a CID-keyed font with a set of CIDfonts
containing the glyphs. I'm not aware of a good, free tool for doing
that though.


> I would recommend you use the Microsoft Font Validator tool
> (http://www.microsoft.com/typography/developers/validator/).


Thanks very much for this! It looks promising, that link doesn't get
me to the software. The referenced page says I have to apply to join
the MS Font Validator Community, but *that* link appears to be a dead
end: "The MSN Groups service has closed"

Thanks!
-pd

Peter Davis

unread,
May 24, 2010, 1:40:43 PM5/24/10
to

ken

unread,
May 24, 2010, 2:05:45 PM5/24/10
to
In article <bcf60852-2926-4746-8759-
49645a...@o39g2000vbd.googlegroups.com>, pfd...@gmail.com says...

Sorry, I forgot they'd changed it....


Ken

Peter Davis

unread,
May 24, 2010, 4:12:10 PM5/24/10
to
On May 24, 2:05 pm, ken <k...@spamcop.net> wrote:
> In article <bcf60852-2926-4746-8759-
> 49645aba8...@o39g2000vbd.googlegroups.com>, pfda...@gmail.com says...

>
> > On May 24, 12:58 pm, Peter  Davis <pfda...@gmail.com> wrote:
> > > On May 24, 12:09 pm, ken <k...@spamcop.net> wrote:
>
> > > > I would recommend you use the Microsoft Font Validator tool
> > > > (http://www.microsoft.com/typography/developers/validator/).
>
> > > Thanks very much for this!  It looks promising, that link doesn't get
> > > me to the software.  The referenced page says I have to apply to join
> > > the MS Font Validator Community, but *that* link appears to be a dead
> > > end: "The MSN Groups service has closed"
>
> > Actually, I found it here:
>
> >http://www.microsoft.com/typography/FontValidator.mspx
>
> Sorry, I forgot they'd changed it....
>

No problem.

The validator, however, appears to do a very crude test for self
intersection. As far as I can tell, it merely rasterizes the glyphs
at various resolutions, and tests whether any of the pixels gets
written more than once. That's not terribly useful (unless you're
drawing the glyphs in XOR mode, I guess). It doesn't tell you whether
the actual outlines cross each other.

Thanks,
-pd

0 new messages