bugThe FreeType Project - Bugs: bug #29404, Horizontal shift of TrueType glyphs

 
 

bug #29404: Horizontal shift of TrueType glyphs

Submitted by:  John Tytgat <joty>
Submitted on:  Thu 01 Apr 2010 05:27:32 PM UTC  
 
Severity: 3 - NormalItem Group: Incorrect behaviour
Status: FixedPrivacy: Public
Assigned to: Werner LEMBERG <wl>Open/Closed: Closed
Planned Release: 2.3.13

Add a New Comment(Rich Markup)
   

You are not logged in

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

 

Mon 12 Apr 2010 02:56:07 PM UTC, comment #2:

Attached buggy file mentioned in previous post.
(note: still interested in the original buggy file,
this is a file for which the fix should be reverted)

bram tassyns <bramt>
Mon 12 Apr 2010 01:39:17 PM UTC, comment #1:

Just some additional info:

at http://www.microsoft.com/typography/otspec/glyf.htm you find the following note:

The scaler will perform better if the glyph coordinates have been created such that the xMin is equal to the lsb. For example, if the lsb is 123, then xMin for the glyph should be 123. If the lsb is -12 then the xMin should be -12. If the lsb is 0 then xMin is 0. If all glyphs are done like this, set bit 1 of flags field in the 'head' table.

(this is a far better explanation of the meaning of the bit then in the head table help)

The font is indeed buggy (xMin is 0, lsb is -150 (for glyph 77), bit one is set). It seems like acrobat simply ignores the possible optimizations (which will cause an unwanted displacement if you use the xMin as lsb), and always calculates the result. So I think freetype should do the same.

bram tassyns <bramt>
Thu 01 Apr 2010 05:27:32 PM UTC, original submission:

I found 3 different instances of TrueType fonts all having one or more glyphs showing a horizontal shift for their outline generated by FT compared to what Acrobat shows when these fonts are used in a PDF file.

I tracked this down to exactly the same report as mentioned in http://lists.nongnu.org/archive/html/freetype-devel/2008-01/msg00063.html

Attached find a zip file with 3 PDF files and the 3 extracted TrueType fonts. I can only get the same outline positions as in Acrobat 7 (or 9, didn't try other versions) when I change in src\truetype\ttgload.c:

--8<--
/* In case bit 1 of the `flags' field in the `head' table isn't */
/* set, translate array so that (0,0) is the glyph's origin. */
if ( ( face->header.Flags & 2 ) == 0 && loader.pp1.x )
FT_Outline_Translate( &glyph->outline, -loader.pp1.x, 0 );
--8<--

back into:

--8<--
if ( loader.pp1.x )
FT_Outline_Translate( &glyph->outline, -loader.pp1.x, 0 );
--8<--

I.e. reverting rev 2752bd1a

Seen the change 2752bd1a has only done for supporting 'buggy fonts', I'm wondering if we shouldn't really revert to the previous case ?

Attached a patch to revert 2752bd1a.

John Tytgat <joty>

 

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

Attach File(s):
   
   
Comment:
   

Attached Files
file #20089:  tt_lsb_problem.zip added by joty (442KiB - application/zip)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by bramt (Posted a comment)
  • -unavailable- added by wl (Updated the item)
  • -unavailable- added by joty (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 6 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Mon 05 Apr 2010 06:24:31 AM UTCwlStatusNone=>Fixed
      Assigned toNone=>wl
      Open/ClosedOpen=>Closed
      Planned ReleaseNone=>2.3.13
    Thu 01 Apr 2010 05:27:32 PM UTCjotyAttached File-=>Added tt_lsb_problem.zip, #20089
      Attached File-=>Added 0001-src-truetype-ttgload.c-Revert-change-2752bd1a-check-.patch, #20090

    Back to the top


    Powered by Savane 3.1-cleanup1