bugThe FreeType Project - Bugs: bug #46186, PS hinter only handles the first...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #46186: PS hinter only handles the first opened face correctly

Submitter:  Igor Khachko <ikhachko>
Submitted:  Mon 12 Oct 2015 02:26:34 PM UTC
   
 
Severity:  4 - Important Item Group:  Incorrect behaviour
Status:  Fixed Privacy:  Public
Assigned to:  wl Open/Closed:  Closed
Planned Release:  2.9

Tue 28 Nov 2017 02:59:18 PM UTC, comment #5: 

In current git, Type 1 fonts are now hinted with Adobe's CFF engine; this means that this problem no longer exists (at least theoretically).

I'm not going to fix the old, deprecated hinting engine, thus closing the report.  Please reopen in case you are still experiencing problems!

Werner LEMBERG <wl>
Group administrator
Wed 28 Oct 2015 12:33:22 PM UTC, comment #4: 

Thanks a lot for the sample code!

I can confirm the problem, and it is indeed a serious bug that nobody has noticed previously: For Type 1 fonts, only the first FT_Face object (after initializing the parent FT_Library object) gets the right hints if hinted natively!  Note that neither the auto-hinter, nor the TrueType or CFF hinter are affected.

Failing to recognize this issue probably explains why the FreeType hinting of PS fonts is sometimes horribly bad...

Right now, I don't have the time to fix this issue.  In case you urgently need a solution, please use separate FT_Library objects for all Type 1 faces.

For the record: A solution to the problem is very similar to Behdad's fixes to make the auto-hinter thread-safe.

http://git.savannah.gnu.org/cgit/freetype/freetype2.git/commit/?id=89bc8d4de7bf93336e182bd42507851f5b46f66f

Werner LEMBERG <wl>
Group administrator
Fri 23 Oct 2015 09:37:58 AM UTC, comment #3: 

C-code snippet has been attached. It uses "Helvetica Regular.pfb" and "Helvetica Bold.pfb" to reproduce the issue

Igor Khachko <ikhachko>
Mon 19 Oct 2015 09:44:45 AM UTC, comment #2: 

Thank you for the response. We need some time to create stand-alone C-code snippet.
We will attach it when it will be ready.

Igor Khachko <ikhachko>
Thu 15 Oct 2015 06:19:21 AM UTC, comment #1: 

Thanks for the report.  However, never attach copyrighted files like the two Helvetica fonts to a bug tracker!  I had to delete them (after saving them for future investigation).  Additionally, the `BMP' format wastes an extreme amount of disk space and internet bandwidth.  The next time, please convert such images to the PNG format.

It would help a lot and speed up the handling of this report if you could provide a small, stand-alone C code snippet (with TTY output, not using platform-specific code) that I can compile on my GNU/Linux box, and which demonstrates the problem you have.  Have a look at

http://freetype.org/freetype2/docs/tutorial/example1.c

to see what I mean.

Werner LEMBERG <wl>
Group administrator
Mon 12 Oct 2015 02:26:34 PM UTC, original submission:  

Character "g" from the font Helvetica Regular is rendered differently when only it is used or Helvetica Bold is rendered before.

Steps:

Without Helvetica Bold
1. Initialize FreeType
2. Load Helvetic Regular.pfb
3. Render character "g" (please see below)
Result is in the g.bmp

With Helvetica Bold
1. Initialize FreeType
2. Load Helvetic Bold.pfb
3. Render character "a"
4. Load Helvetic Regular.pfb
5. Render character "g"
Result is in the ag.bmp

Received bitmaps for character "g" are a little bit different in these cases

Character "g" is rendered like below:
FT_Set_Char_Size(pRegularFace, 608, 608, 300, 300);
FT_Set_Transform(pRegularFace, NULL, NULL);
FT_Load_Glyph(pRegularFace, 87, 8);
FT_Get_Glyph(pRegularFace->glyph, &pGlyphFill);
FT_Glyph_To_Bitmap(&pGlyphFill, FT_RENDER_TO_MONO(2), NULL, 1);

Character "a" is rendered like below:
FT_Set_Char_Size(pBoldFace, 704, 704, 300, 300);
FT_Set_Transform(pBoldFace, NULL, NULL);
FT_Load_Glyph(pBoldFace, 80, 8);
FT_Get_Glyph(pBoldFace->glyph, &pGlyphFill);
FT_Glyph_To_Bitmap(&pBoldFace, FT_RENDER_TO_MONO(2), NULL, 1);


Igor Khachko <ikhachko>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attached Files
file #35268:  helvetic_g.output.txt added by ikhachko (3KiB - text/plain - helvetica_g output which shows the difference)
file #35267:  helvetica_g.c added by ikhachko (4KiB - text/x-csrc - C-code snippet has been attached. It uses "Helvetica Regular.pfb" and "Helvetica Bold.pfb" to reproduce the issue.)
file #35167:  g.bmp added by ikhachko (1MiB - image/bmp)
file #35168:  ag.bmp added by ikhachko (1MiB - image/bmp)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by wl (Posted a comment)
  • -email is unavailable- added by ikhachko (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

     

    Follow 16 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2017-11-28 wl StatusConfirmed Fixed
        Open/ClosedOpen Closed
        Planned ReleaseNone 2.9
    2015-10-28 wl SummaryThe same character is rendered differently PS hinter only handles the first opened face correctly
    2015-10-28 wl Severity3 - Normal 4 - Important
        StatusNeed Info Confirmed
    2015-10-23 ikhachko Attached File- Added helvetic_g.output.txt, #35268
    2015-10-23 ikhachko Attached File- Added helvetica_g.c, #35267
    2015-10-15 wl StatusNone Need Info
        Assigned toNone wl
    2015-10-15 wl Attached File#35166 Removed
    2015-10-15 wl Attached File#35165 Removed
    2015-10-12 ikhachko Attached File- Added Helvetica Bold.pfb, #35165
        Attached File- Added Helvetica Regular.pfb, #35166
        Attached File- Added g.bmp, #35167
        Attached File- Added ag.bmp, #35168

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code