Re: [ft-devel] ttfautohint 0.6 has been released

2012-01-03 Thread Miles Bader
Werner LEMBERG w...@gnu.org writes:
 Today in the morning, while still dozing, I had a great idea how to
 largely simplify hinting of composite glyphs, and which solves the
 Roboto issue at the same time.

Heh, you have your best coding ideas while half-asleep too eh...?

:}

-miles

-- 
Monday, n. In Christian countries, the day after the baseball game.


___
Freetype-devel mailing list
Freetype-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/freetype-devel


Re: [ft-devel] ttfautohint 0.6 has been released

2011-12-31 Thread Werner LEMBERG

 Today in the morning, while still dozing, I had a great idea how to
 largely simplify hinting of composite glyphs, and which solves the
 Roboto issue at the same time.  In particular, I believe that I've
 found a way to completely avoid fiddling with point indices.

Following this route I shot myself in the foot :-(

Some details:

Let's assume that we have glyph `Agrave', a composite of `A' and
`grave'.  Before version 0.6, ttfautohint hinted `A' first, then
`grave', and the hinted subglyphs got glued together afterwards.

In 0.6, however, ttfautohint works differently: It now hints the whole
glyph, this is, composites get recursively expanded so that they form
simple glyphs, then hints are applied -- this is the normal working
mode of FreeType's autohinter.  Obviously, this gives better rendering
results because the autohinter can consider the glyph's complete
shape.  The only drawback is an increased output font size since more
glyphs are fully hinted.

One problem, however, must be solved: We have to deactivate hinting
for subglyphs (which usually are used as normal glyphs also) so that
nothing but the final bytecode of the composite gets executed.

The trick introduced in 0.6 is to prepend a composite called
`.ttfautohint', a dummy glyph with a single point, and which has a
single job: Its bytecode increases a CVT register (I call it
`cvtl_is_subglyph'), indicating that we are within a composite glyph.
Returning to our example, `Agrave' now consists of three subglyphs:
`.ttfautohint', `A', and `grave' (in this order).  The bytecode
generated by ttfautohint has been slightly modified so that
`cvtl_is_subglyph' is honoured, and the bytecode of the composite
glyph decrements this counter accordingly:

  bytecode ofaction
  ---
  .ttfautohint   cvtl_is_subglyph += 1 (now: 1)
  A  do nothing because cvtl_is_subglyph  0
  grave  do nothing because cvtl_is_subglyph  0
  Agrave cvtl_is_subglyph -= 1 (now: 0)
 apply hints because cvtl_is_subglyph == 0

The trickiest part was to adjust glyph point indices since each
`.ttfautohint' subglyph shifts all following indices by one.  This
must be done for both the bytecode and one subformat of GPOS anchor
tables.

Back to my `great idea'.  The Roboto font makes ttfautohint crash
because I didn't consider the case that a composite glyph references
an empty glyph.  In this font, `nonbreakingspace' contains `space' as
its only subglyph.  But wait: What if I use this technique also?
Bingo!  The new code which I have been writing the last few days
replaces the simple glyph `.ttfautohint' with a composite glyph,
referencing an empty glyph.  Doing so I can prepend the necessary
bytecode to increase the counter while no contour gets added so that
point indices stay the same.

Very, very unfortunately this approach fails with FreeType, as I have
discovered today: Due to a bug it executes bytecode only if there is
at least one contour.  Apparently noone has ever considered the
construction which I envisioned while dozing...  Maybe other engines
implement a similar shortcut; I've asked this question on the OpenType
list.

Even if other TrueType engines handle this case correctly, I have to
reject the new route because I can't expect that all applications
which use FreeType immediately upgrade to the newest version.

Anyway, 0.6.1 is coming soon (with point index shifts)!


Werner

___
Freetype-devel mailing list
Freetype-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/freetype-devel


Re: [ft-devel] ttfautohint 0.6 has been released

2011-12-28 Thread Werner LEMBERG

 While testing google's new Roboto font (version 1.0), I found out
 that ttfautohint 0.6 crashes, unfortunately.  Reason is the very
 weird glyph `nonbreakingspace' (its bbox is xMin=32767, yMin=32767,
 xMax=-32767, yMax=-32767, BTW) which is a composite glyph with a
 single component, namely `space'.  However, `space' has no contours
 at all...
 
 Well, constructing such an anomaly is valid, but I haven't
 considered this case.  Alas, it means a major redesign of some
 algorithms in ttfautohint.  I'll release 0.6.1 after fixing this
 issue.

Today in the morning, while still dozing, I had a great idea how to
largely simplify hinting of composite glyphs, and which solves the
Roboto issue at the same time.  In particular, I believe that I've
found a way to completely avoid fiddling with point indices.  However,
this means a lot of changes, so it will take a bit longer until 0.6.1
gets released.  Note that 0.6.1 will have exactly the same
functionality as 0.6; all modifications will be under the hood, not
influencing the visible result.

I ask you to test version 0.6 with fonts which don't make ttfautohint
crash :-) In case you find a font which causes a segfault, or which
causes bad rendering, or which makes font validation tools cry, please
tell me the font's name so that I can test it later on.


Werner

___
Freetype-devel mailing list
Freetype-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/freetype-devel


Re: [ft-devel] ttfautohint 0.6 has been released

2011-12-27 Thread Werner LEMBERG

 Could this be the same reason why 0.6 crashes for me on osx with a
 segmentation fault when autohinting any font?

Of course not :-)  What font have you tried?


Werner

___
Freetype-devel mailing list
Freetype-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/freetype-devel


Re: [ft-devel] ttfautohint 0.6 has been released

2011-12-27 Thread vernon adams



Could this be the same reason why 0.6 crashes for me on osx with a  
segmentation fault when autohinting any font?

-v

-Original message-
From: Werner LEMBERG w...@gnu.org
To: freetype-devel@nongnu.org
Cc: roberts...@google.com, dcrossl...@google.com
Sent: Tue, 27 Dec 2011, 06:29:50 GMT+00:00
Subject: Re: [ft-devel] ttfautohint 0.6 has been released



ttfautohint 0.6 has been released.


While testing google's new Roboto font (version 1.0), I found out that
ttfautohint 0.6 crashes, unfortunately.  Reason is the very weird
glyph `nonbreakingspace' (its bbox is xMin=32767, yMin=32767,
xMax=-32767, yMax=-32767, BTW) which is a composite glyph with a
single component, namely `space'.  However, `space' has no contours at
all...

Well, constructing such an anomaly is valid, but I haven't considered
this case.  Alas, it means a major redesign of some algorithms in
ttfautohint.  I'll release 0.6.1 after fixing this issue.


   Werner

___
Freetype-devel mailing list
Freetype-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/freetype-devel

___
Freetype-devel mailing list
Freetype-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/freetype-devel


Re: [ft-devel] ttfautohint 0.6 has been released

2011-12-26 Thread Werner LEMBERG

 ttfautohint 0.6 has been released.

While testing google's new Roboto font (version 1.0), I found out that
ttfautohint 0.6 crashes, unfortunately.  Reason is the very weird
glyph `nonbreakingspace' (its bbox is xMin=32767, yMin=32767,
xMax=-32767, yMax=-32767, BTW) which is a composite glyph with a
single component, namely `space'.  However, `space' has no contours at
all...

Well, constructing such an anomaly is valid, but I haven't considered
this case.  Alas, it means a major redesign of some algorithms in
ttfautohint.  I'll release 0.6.1 after fixing this issue.


Werner

___
Freetype-devel mailing list
Freetype-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/freetype-devel


[ft-devel] ttfautohint 0.6 has been released

2011-12-25 Thread Werner LEMBERG

ttfautohint 0.6 has been released.

It is available from

http://savannah.nongnu.org/download/freetype/

or

http://sourceforge.net/projects/freetype/files/ttfautohint

Merry Xmas!


   Werner


PS: Downloads from savannah.nongnu.org will redirect to your nearest
mirror site.  Files on mirrors may be subject to a replication
delay of up to 24 hours.  In case of problems use
http://download-mirror.savannah.gnu.org/releases/


--


This project provides a library which takes a TrueType font as the input,
remove its bytecode instructions (if any), and return a new font where all
glyphs are bytecode hinted using the information given by FreeType's
autohinting module.  The idea is to provide the excellent quality of the
autohinter on platforms which don't use FreeType.

The library has a single API function, `TTF_autohint'; see
`src/ttfautohint.h' for a detailed description.  Note that the library
itself won't get installed currently.

A simple command-line interface to the library is the demo program
`ttfautohint'; after compilation and installation, say

  ttfautohint --help

for usage information, or say

  man ttfautohint

to read its manual page.


=


New in 0.6:

* Improved handling of composite glyphs.

* Implement option `-p' to pre-hint glyphs with original hints before
  conversion takes place.

* Don't add a DSIG table if there is none in the input font.

* Human-readable error messages instead of hexadecimal error codes.

* Better tests (both at runtime and compile time) to reject too old FreeType
  versions.

___
Freetype-devel mailing list
Freetype-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/freetype-devel