bugThe FreeType Project - Bugs: bug #49141, Composite glyphs incorrectly...

 
 

bug #49141: Composite glyphs incorrectly positioned

Submitted by:  Sascha Brawer <saschabrawer>
Submitted on:  Tue 20 Sep 2016 03:39:55 PM UTC  
 
Severity: 3 - NormalItem Group: None
Status: InvalidPrivacy: Public
Assigned to: Werner LEMBERG <wl>Open/Closed: Closed
Planned Release: None

Add a New Comment(Rich Markup)
   

You are not logged in

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

 

(Jump to the original submission Jump to the original submission)

Mon 26 Sep 2016 06:39:22 AM UTC, comment #6:

OK, closing.

Werner LEMBERG <wl>
Project AdministratorIn charge of this item.
Mon 26 Sep 2016 06:26:39 AM UTC, comment #5:

Thanks for the pointers! It was my bug; fixed.

Sascha Brawer <saschabrawer>
Wed 21 Sep 2016 08:34:16 AM UTC, comment #4:

Indeed, there are problems.

https://github.com/brawer/fonttest/blob/master/src/fonttest/freestack_font.cpp#L59

You have forgotten to multiply `fixedSize' by 64 to convert to 26.6 format – I assume that you don't have overloaded the `static_cast<FT_Fixed>' operator to do that automatically, right? (Admittedly, I don't know whether this is possible at all.)

https://github.com/brawer/fonttest/blob/master/src/fonttest/freestack_font.cpp#L95

You are loading the font at 1000ppem, which is arbitrary. In particular, since you don't use FT_LOAD_NO_SCALE in line 97, glyph component positions get rounded which might lead to incorrect values even at that size.

Either use the UPEM value as the charsize (then rounding to full pixels doesn't do any harm since you are essentially operating in font units), or add the FT_LOAD_NO_SCALE flag to directly get all values in font units.

Werner LEMBERG <wl>
Project AdministratorIn charge of this item.
Wed 21 Sep 2016 07:49:29 AM UTC, comment #3:

Thanks for the analysis. Here’s my call to FT_New_Face():
https://github.com/brawer/fonttest/blob/master/src/fonttest/freestack_engine.cpp#L41

Here’s the call to FT_Set_Char_Size():
https://github.com/brawer/fonttest/blob/master/src/fonttest/freestack_font.cpp#L59

Here’s the call to FT_Load_Glyph():
https://github.com/brawer/fonttest/blob/master/src/fonttest/freestack_font.cpp#L97

Here’s the call to FT_Outline_Decompose():
https://github.com/brawer/fonttest/blob/master/src/fonttest/freestack_path.cpp#L49

Did I fail to set any other flags that should be set? (By the way, I’ll soon move the codebase out of my private repo to some place owned by unicode.org, so the above links will change).

Sascha Brawer <saschabrawer>
Wed 21 Sep 2016 07:20:18 AM UTC, comment #2:

The value `ROUND_XY_TO_GRID' is indeed set for this glyph component. So the question is how the conformance test gets called.

I've just checked the source: FreeType only rounds to pixels if `FT_LOAD_NO_SCALE' is not set. Maybe you load the glyph at PPEM size without this flag, and you have forgotten to use 26.6 format for the width and height arguments in the call to `FT_Set_Char_Size'?

Werner LEMBERG <wl>
Project AdministratorIn charge of this item.
Tue 20 Sep 2016 08:54:18 PM UTC, comment #1:

What is the the value of ROUND_XY_TO_GRID flag for this component?
If it is TRUE, then (262,0) gets rounded to (256,0), then the first point is placed at (262,671), like you said.

Alexei Podtelezhnikov <podtelez>
Project Member
Tue 20 Sep 2016 03:39:55 PM UTC, original submission:

FreeType sometimes mis-positions components of composite glyphs.

With the attached test font, FreeType places the accent on top of `gcommaabove` ģ too far to the left; the placement is off by six font design units. In the font’s `glyf` table, gcommaabove has two components: 1. g at (0,0), and 2. commaturnedabovecomb at (262,0). The path for commaturnedabovecomb starts with an on-curve point at (6,671). Therefore, when FreeType is asked for an outline of the composite glyph `gcommaabove`, the accent’s first point should be at (268,671). Instead, it’s at (262,671). It smells interesting that the mis-placement is by the same amount as the accent’s first point’s x coordinate.
https://raw.githack.com/brawer/fonttest/master/reports/FreeStack.html#GLYF-1

Apple’s CoreText renders the glyph as expected. Compared to FreeType, the accent is six units further to the right, that is at the expected position.
https://raw.githack.com/brawer/fonttest/master/reports/CoreText.html#GLYF-1

Sascha Brawer <saschabrawer>

 

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

Attach File(s):
   
   
Comment:
   

Attached Files
file #38565:  TestGLYFOne.ttf added by saschabrawer (1KiB - application/octet-stream)

 

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

    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 5 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Mon 26 Sep 2016 06:39:22 AM UTCwlStatusNone=>Invalid
      Assigned toNone=>wl
      Open/ClosedOpen=>Closed
    Tue 20 Sep 2016 03:39:55 PM UTCsaschabrawerAttached File-=>Added TestGLYFOne.ttf, #38565
      Carbon-Copy-=>Added -unavailable-

    Back to the top


    Powered by Savane 3.1-cleanup1