Re: [ft] Bytecode hinter producing bad results, seems to be a regression

2011-01-02 Thread Stuart Longland
On Sun, Jan 02, 2011 at 08:07:03AM +0100, Werner LEMBERG wrote:
  The trickyness is that you are trying to separate hinting
  from rasterizing.  As explained already, the TrueType
  bytecode interpreter and the rasterizer do interact.  It's
  not intended to be handled separately.
  
  I went through the trouble of tweaking my 3rd party library to
  support rendering with FreeType...and the result was identical to
  when I extract the outlines with FreeType and render things myself!
  So I guess my font sucks?  Where are the good fonts?
 
 You might look at the original Helvetica font from Adobe, or its
 freely available clone from URW, `Nimbus Sans', which comes with
 Ghostscript.  Those fonts use PS hinting technology, not TrueType.

How do fonts such as the Linux Libertine family stack up in this regard?
Would that be an ideal TrueType font for comparison, or are there better
examples?

Regards,
-- 
Stuart Longland (aka Redhatter, VK4MSL)  .'''.
Gentoo Linux/MIPS Cobalt and Docs Developer  '.'` :
. . . . . . . . . . . . . . . . . . . . . .   .'.'
http://dev.gentoo.org/~redhatter :.'

I haven't lost my mind...
  ...it's backed up on a tape somewhere.

___
Freetype mailing list
Freetype@nongnu.org
http://lists.nongnu.org/mailman/listinfo/freetype


Re: [ft] Bytecode hinter producing bad results, seems to be a regression

2011-01-01 Thread Vinnie
I'm ashamed to admit it but you are talking about things that are going WAY 
over my head. I tried to use those programs fontforge and ttx but I failed to 
get them to run. Something about needing Cygwin, which also generated errors 
when I tried to install that, and I don't understand TTX.

So my code is supposed to dig into the font file and figure out if hinting is 
supported? I thought FreeType was plug and go... I just want to open the font 
and get hinted outlines without worrying.

What is a monochrome rendering and how do I test it under Windows?

I'm not using FreeType to render...just to extract outlines.

And by the way, the autohinting module works pretty damn good!

--- On Sat, 1/1/11, Werner LEMBERG w...@gnu.org wrote:

 From: Werner LEMBERG w...@gnu.org
 Subject: Re: [ft] Bytecode hinter producing bad results, seems to be a 
 regression
 To: thev...@yahoo.com
 Cc: freetype@nongnu.org
 Date: Saturday, January 1, 2011, 9:43 AM
 
  check your font whether my assumption is
 correct.  I only have
  `Helvetica Neue LT Pro 65 Medium' version 001.000
 (from 2003), but
  this is an OpenType font with CFF outlines.
 
 Accidentally, I've also found `Helvetica Neue LT Com 65
 Medium' (2.01
 from 2006).  My assumption was correct: The `gasp'
 table of this font
 asks for monochrome rendering in the range 9-15ppem.
 
 However, I see strange hinting for certain ppem
 values.  For example,
 the monochrome version of `h' at 11ppem misses the left
 stem, or the
 `C' at 10ppem lacks the middle part (see attached
 image).  I *can't*
 believe that this is FreeType's fault, given that those
 strange
 rendering results are mainly due to DELTA instructions
 which shifts
 certain points at certain ppem values by a fixed
 amount.  Something's
 is going on here, and it would be interesting to know more
 details.
 
 Do you have a chance to check monochrome rendering of this
 particular
 font on Windows?
 
 
     Werner


___
Freetype mailing list
Freetype@nongnu.org
http://lists.nongnu.org/mailman/listinfo/freetype


Re: [ft] Bytecode hinter producing bad results, seems to be a regression

2011-01-01 Thread Werner LEMBERG

 check your font whether my assumption is correct.  I only have
 `Helvetica Neue LT Pro 65 Medium' version 001.000 (from 2003), but
 this is an OpenType font with CFF outlines.

Accidentally, I've also found `Helvetica Neue LT Com 65 Medium' (2.01
from 2006).  My assumption was correct: The `gasp' table of this font
asks for monochrome rendering in the range 9-15ppem.

However, I see strange hinting for certain ppem values.  For example,
the monochrome version of `h' at 11ppem misses the left stem, or the
`C' at 10ppem lacks the middle part (see attached image).  I *can't*
believe that this is FreeType's fault, given that those strange
rendering results are mainly due to DELTA instructions which shifts
certain points at certain ppem values by a fixed amount.  Something's
is going on here, and it would be interesting to know more details.

Do you have a chance to check monochrome rendering of this particular
font on Windows?


Werner
inline: C.png___
Freetype mailing list
Freetype@nongnu.org
http://lists.nongnu.org/mailman/listinfo/freetype


Re: [ft] Bytecode hinter producing bad results, seems to be a regression

2011-01-01 Thread Vinnie
 The function FT_Get_Gasp tells you,
 for a given ppem, whether you should
 render a glyph as monochrome
 (i.e., black-white) or with anti-aliasing.

ppem? is that what I understand to be the font height? Pixels per EM unit? By 
monochrome I assume you mean, two intensity levels (on or off). As in, an old 
school bitmap font (like Apple II+).

All of my font-drawing is anti-aliased, I'm the middle man passing the 
grid-fitted control points over to another third party library that I'm using.

Why would I ever want to render a glyph as monochrome (two-color) only?

 TrueType hinting doesn't work like this.  For
 monochrome rendering, the hinting engine also
 specifies how to rasterize the glyphs
 (selecting a drop-out mode, for example).

From how I interpret those words, I think monochrome rendering is not a 
use-case for me.

  I'm not using FreeType to render...just to extract
 outlines.
 
 This is tricky...

Can you elaborate? Or tell me anything I should know about that is non-obvious 
or non-intuitive?

I'm actually getting really good results with the auto hinter. I can see very 
clearly that it is working, and I painstakingly analyzed the output of each 
glyph to make sure that things are right. Here's a screenshot:

This is using the auto-hinter, with FreeType providing the outlines and my 3rd 
party library (Juce) rasterizing the vector data:
http://rawmaterialsoftware.com/download/file.php?id=186

Here is the same output, only with the autohinter turned off.
http://rawmaterialsoftware.com/download/file.php?id=185

Here's an animation for comparison
http://rawmaterialsoftware.com/download/file.php?id=184

  And by the way, the autohinting module works pretty
 damn good!
 
 Then use it!

Okay well just to make sure I did things right, I loaded up Adobe Kaiti Std 
Regular (a thin serif font) and performed the comparisons. First thing I 
noticed, is the Adobe font is a hefty 16.5 megabytes, while my Neue Helvetica 
is a wimpy 127 kilobytes.

I tried bytecode hinting with the Adobe font and WHOA! amazing outlines! So I 
guess that my problem is not that FreeType wasn't using my bytecodes, its just 
that my Helvetica didn't have them.

My intuition and eyesight tells me that a font with hints is going to look 
better with the bytecode hinting than with the auto-hinter. This is definitely 
the case with this beefy Adobe font.

I wish there was a flag to FT_Open_Face that says hey use the bytecode hinter 
if the font has those hints, or else use the auto-hinter.

So now I am going to trying grasping for the Gasp / Grasp whateveritis table 
and see if I can get some mileage. My goal is to use bytecodes if they are 
there, else use the autohinter.

Thanks



___
Freetype mailing list
Freetype@nongnu.org
http://lists.nongnu.org/mailman/listinfo/freetype


Re: [ft] Bytecode hinter producing bad results, seems to be a regression

2011-01-01 Thread Vinnie
 You haven't told us which FreeType version you are
 using...  For bug
 reports, please always try the recent one, this is, 2.4.4.

Sorry about that and yes of course I'm using the most recent version.

 BTW, I'm not sure that `professional' fonts are intended
 for screen display, working at small ppem values.

By professional I mean I went to a website that looked legit (linotype.com) 
and bought the font, as opposed to just pirating or using something from an 
unknown foundry.

So it seems that the font I have is unhinted, hence the small size. I just 
assumed that all TrueType/OpenType fonts that came from Linotype or other well 
recognized foundries were loaded to the gills with hints but it seems I am 
mistaken. The Adobe font I have seems to have plenty of hints so I will study 
it. And I will try to find a version of Neue Helvetica 65 Medium that has a 
full set of glyphs along with hints. Any ideas on where to get that?



___
Freetype mailing list
Freetype@nongnu.org
http://lists.nongnu.org/mailman/listinfo/freetype


Re: [ft] Bytecode hinter producing bad results, seems to be a regression

2011-01-01 Thread Werner LEMBERG
From: Vinnie thev...@yahoo.com
Subject: Re: [ft] Bytecode hinter producing bad results, seems to be a 
regression
Date: Sat, 1 Jan 2011 12:20:06 -0800 (PST)

 The function FT_Get_Gasp tells you, for a given ppem, whether you
 should render a glyph as monochrome (i.e., black-white) or with
 anti-aliasing.

 ppem? Pixels per EM unit?

Yes.

 By monochrome I assume you mean, two intensity levels (on or
 off). As in, an old school bitmap font (like Apple II+).

Yes.

 All of my font-drawing is anti-aliased, I'm the middle man passing
 the grid-fitted control points over to another third party library
 that I'm using.

 Why would I ever want to render a glyph as monochrome (two-color)
 only?

Here is the problem: For a certain ppem range, as specified in the
gasp table, the particular Helvetica font *expects* B/W rendering!  If
you do anti-aliasing instead, you get bad results.  On the other hand,
some B/W rendering results of Helvetica are really bad and I wonder
whether this is due to a bug in FreeType or whether this font has
simply bad hinting instructions.

 I'm not using FreeType to render...just to extract outlines.

 This is tricky...

 Can you elaborate?  Or tell me anything I should know about that is
 non-obvious or non-intuitive?

The trickyness is that you are trying to separate hinting from
rasterizing.  As explained already, the TrueType bytecode interpreter
and the rasterizer do interact.  It's not intended to be handled
separately.

 I'm actually getting really good results with the auto hinter.  I
 can see very clearly that it is working, and I painstakingly
 analyzed the output of each glyph to make sure that things are
 right.

Yes, because the autohinter works completely differently.  In
particular, it always expects anti-aliased rendering.

 And by the way, the autohinting module works pretty damn good!

 Then use it!

 Okay well just to make sure I did things right, I loaded up Adobe
 Kaiti Std Regular (a thin serif font) and performed the
 comparisons.  First thing I noticed, is the Adobe font is a hefty
 16.5 megabytes, while my Neue Helvetica is a wimpy 127 kilobytes.

Kaiti is a font for Chinese.  Do you need this?

 I tried bytecode hinting with the Adobe font and WHOA! amazing
 outlines!  So I guess that my problem is not that FreeType wasn't
 using my bytecodes, its just that my Helvetica didn't have them.

No, no, no!  The Kaiti font is *not* a TrueType font (this is,
second-order Bezier curves).  It's an *OpenType font* using CFF
outlines (this is, third-order Bezier curves), and there aren't any
bytecode instructions but PS-like hints.  Basically, it's a completely
different font format; it just happens that both TTFs and OTFs use the
SFNT container format, thus they look similar at a first glance.

 My intuition and eyesight tells me that a font with hints is going
 to look better with the bytecode hinting than with the
 auto-hinter. This is definitely the case with this beefy Adobe font.

I'm not sure.  FreeType's native hinter for third-order Bezier
outlines is quite buggy and problematic.

 I wish there was a flag to FT_Open_Face that says hey use the
 bytecode hinter if the font has those hints, or else use the
 auto-hinter.

This is impossible to decide by FreeType.  On the operating system
level, such decisions are controlled by a higher-level library.  On
Linux, this is done by fontconfig, for example.

 So now I am going to trying grasping for the Gasp / Grasp
 whateveritis table and see if I can get some mileage.

Note that `gasp' makes only sense for TTFs, not OTFs.

 My goal is to use bytecodes if they are there, else use the
 autohinter.

I can only repeat that this won't work automatically but needs a user
decision.


Werner

___
Freetype mailing list
Freetype@nongnu.org
http://lists.nongnu.org/mailman/listinfo/freetype


Re: [ft] Bytecode hinter producing bad results, seems to be a regression

2011-01-01 Thread Vinnie
 The trickyness is that you are trying to separate hinting
 from rasterizing.  As explained already, the TrueType
 bytecode interpreter and the rasterizer do interact.  It's
 not intended to be handled separately.

I went through the trouble of tweaking my 3rd party library to support 
rendering with FreeType...and the result was identical to when I extract the 
outlines with FreeType and render things myself! So I guess my font sucks? 
Where are the good fonts?

Are there some example fonts with well defined properties floating around that 
I can test with?

 Kaiti is a font for Chinese.  Do you need this?

Hmm...I don't know about that, it just got installed along with Photoshop and I 
grabbed it out of my Fonts folder and tried it with my code to see how it would 
perform with serifs (which I imagine require more hinting work?).

 No, no, no!  The Kaiti font is *not* a TrueType font
 (this is, second-order Bezier curves).  It's an *OpenType font*
 using CFF outlines (this is, third-order Bezier curves), and there
 aren't any bytecode instructions but PS-like hints.

Oh my...why did they make fonts so confusing?


___
Freetype mailing list
Freetype@nongnu.org
http://lists.nongnu.org/mailman/listinfo/freetype


Re: [ft] Bytecode hinter producing bad results, seems to be a regression

2011-01-01 Thread Werner LEMBERG

 So it seems that the font I have is unhinted, hence the small size.

No.  It's hinted.

 I just assumed that all TrueType/OpenType fonts that came from
 Linotype or other well recognized foundries were loaded to the gills
 with hints but it seems I am mistaken.

Helvetica originally is a Type 1 font from Adobe which has been later
converted to TrueType.  This conversion process was obviously done
semi-automatically, and I suspect that all hinting bytecode
instructions have been applied by a program, not by a human, thus the
bad quality for B/W rendering at such small ppem values.  Remember
that this font is intended for printing, not for displaying fine on
the screen.

 The Adobe font I have seems to have plenty of hints so I will study
 it.

It's different technology...

 And I will try to find a version of Neue Helvetica 65 Medium that
 has a full set of glyphs along with hints.  Any ideas on where to
 get that?

The font *is* complete.  If you want better hinting for such small
ppem values I suspect that you need a different sans-serif font which
has been specially tuned for screen usage, like Arial.


Werner

___
Freetype mailing list
Freetype@nongnu.org
http://lists.nongnu.org/mailman/listinfo/freetype


Re: [ft] Bytecode hinter producing bad results, seems to be a regression

2011-01-01 Thread Werner LEMBERG
 The trickyness is that you are trying to separate hinting
 from rasterizing.  As explained already, the TrueType
 bytecode interpreter and the rasterizer do interact.  It's
 not intended to be handled separately.
 
 I went through the trouble of tweaking my 3rd party library to
 support rendering with FreeType...and the result was identical to
 when I extract the outlines with FreeType and render things myself!
 So I guess my font sucks?  Where are the good fonts?

You might look at the original Helvetica font from Adobe, or its
freely available clone from URW, `Nimbus Sans', which comes with
Ghostscript.  Those fonts use PS hinting technology, not TrueType.

 No, no, no!  The Kaiti font is *not* a TrueType font (this is,
 second-order Bezier curves).  It's an *OpenType font* using CFF
 outlines (this is, third-order Bezier curves), and there aren't any
 bytecode instructions but PS-like hints.
 
 Oh my...why did they make fonts so confusing?

Historical development.  You might read this old article:

  http://www.truetype-typography.com/articles/ttvst1.htm

The English article on Wikipedia about OpenType gives further hints
too.

  Werner

___
Freetype mailing list
Freetype@nongnu.org
http://lists.nongnu.org/mailman/listinfo/freetype