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

 
 

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

Submitted by:  Igor Khachko <ikhachko>
Submitted on:  Mon 12 Oct 2015 02:26:34 PM UTC  
 
Severity: 4 - ImportantItem Group: Incorrect behaviour
Status: FixedPrivacy: Public
Assigned to: Werner LEMBERG <wl>Open/Closed: Closed
Planned Release: 2.8.2

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

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>
Project AdministratorIn charge of this item.
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>
Project AdministratorIn charge of this item.
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>
Project AdministratorIn charge of this item.
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.)

Attach File(s):
   
   
Comment:
   

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
  • -unavailable- added by wl (Posted a comment)
  • -unavailable- added by ikhachko (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 16 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Tue 28 Nov 2017 02:59:18 PM UTCwlStatusConfirmed=>Fixed
      Open/ClosedOpen=>Closed
      Planned ReleaseNone=>2.8.2
    Wed 28 Oct 2015 01:19:28 PM UTCwlSummaryThe same character is rendered differently=>PS hinter only handles the first opened face correctly
    Wed 28 Oct 2015 12:33:22 PM UTCwlSeverity3 - Normal=>4 - Important
      StatusNeed Info=>Confirmed
    Fri 23 Oct 2015 09:50:26 AM UTCikhachkoAttached File-=>Added helvetic_g.output.txt, #35268
    Fri 23 Oct 2015 09:36:22 AM UTCikhachkoAttached File-=>Added helvetica_g.c, #35267
    Thu 15 Oct 2015 06:19:21 AM UTCwlStatusNone=>Need Info
      Assigned toNone=>wl
    Thu 15 Oct 2015 06:13:32 AM UTCwlAttached File#35166=>Removed
    Thu 15 Oct 2015 06:13:27 AM UTCwlAttached File#35165=>Removed
    Mon 12 Oct 2015 02:26:34 PM UTCikhachkoAttached 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.1-cleanup1