bugThe FreeType Project - Bugs: bug #16668, PFR font issue with glyph_index ==...

 
 

bug #16668: PFR font issue with glyph_index == num_glyps

Submitted by:  None
Submitted on:  Wed 24 May 2006 11:41:37 AM UTC  
 
Severity: 3 - NormalItem Group: Incorrect behaviour
Status: FixedPrivacy: Public
Assigned to: David Turner <freetype>Open/Closed: Closed
Planned Release: 2.3.0

Add a New Comment(Rich Markup)
   

You are not logged in

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

 

Sun 04 Jun 2006 02:37:19 PM UTC, comment #2:

the problem is that face->num_glyphs isn't computed correctly.

FreeType enforces the rule that a glyph index of 0 should always correspond to the "missing glyph" (commonly represented by a square or an empty box in font files), but this is not guaranteed by the PFR font format.

That's why FreeType shifts all glyph indices by 1 in the case of PFR font, which means that "face->num_glyphs" should really be the value of "char_count+1", where 'char_count' represents the number of glyphs found in the PFR header.

by incrementing it properly in pfr_face_init, we make all other functions work perfectly. The only peculiar thing is that the first character in the font is duplicated at glyph indices 0 and 1 as a consequence.

We do something similar in the Type 1 driver, by the way

I've commited a fix to the CVS

David Turner <freetype>
Project AdministratorIn charge of this item.
Fri 26 May 2006 07:19:46 AM UTC, comment #1:

Thanks for the report.

I've assigned it to David, who is our PFR guru.

BTW, it seems that there is an additional problem
w.r.t. advance widths: In ftview, the lines are
broken too `early', this is, too far to the left.
If you zoom in this effect is very noticeable.

Werner LEMBERG <wl>
Project Administrator
Wed 24 May 2006 11:41:37 AM UTC, original submission:

Hello,

We have a resource compiler as part of our product which makes use of FreeType 2.1.4.

I’ve rebuilt this compiler with FreeType 2.2.1 and I have run into some problems which I would like to bring to your attention.

I’ve attached the font in question.

There are 349 glyphs in this font. The glyph_indices ranges from 1 to 349 yet if I try to call FT_Load_Glyph() it fails on the last glyph, index 349 with Error code 6 (FT_Err_Invalid_Argument).

I checked out the latest FreeType2 source from CVS and it also has a similar problem. The following changes make our resource compiler work with the latest version of FreeType2 (at least with PFR fonts):

Index: autofit/afglobal.c

===================================================================

RCS file: /cvsroot/freetype/freetype2/src/autofit/afglobal.c,v

retrieving revision 1.9

diff -r1.9 afglobal.c

227c227,229

<

---

> if ( gindex > 0 )


> gindex--;


>


Index: base/ftobjs.c

===================================================================

RCS file: /cvsroot/freetype/freetype2/src/base/ftobjs.c,v

retrieving revision 1.253

diff -r1.253 ftobjs.c

544c544

< if ( glyph_index >= (FT_UInt)face->num_glyphs )

---

> if ( glyph_index > (FT_UInt)face->num_glyphs )


I don’t know if other Fonts use glyph indices that range from 0 to num_glyphs-1 but there is some confusion in the FreeType2 code as to what the glyph_index range is.

I think the glyph_index range needs documenting in the freetype.h header file and then let the individual drivers convert this to a range that makes sense for their internal representations.

Regards,

David

--
David Bustin
Software Engineer
Cabot Communications Ltd.
Verona House, Filwood Road,
Bristol BS16 3RY
UK

Email: david.bustin AT cabot.co.uk
http://www.cabot.co.uk

Interactive Digital TV Technology Solutions

  • Complete the Digital Picture *
Anonymous

 

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

Attach File(s):
   
   
Comment:
   

Attached Files
file #10041:  TIRESV80.PFR added by None (16KiB - application/octet-stream - Tiresias PFR Font)

 

Depends on the following items: None found

Items that depend on this one: None found

 

CC list is empty

 

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
Sun 04 Jun 2006 03:08:49 PM UTCfreetypeStatusNone=>Fixed
Sun 04 Jun 2006 02:37:41 PM UTCfreetypeOpen/ClosedOpen=>Closed
  Planned ReleaseNone=>2.3.0
Fri 26 May 2006 07:19:46 AM UTCwlAssigned toNone=>freetype
Wed 24 May 2006 11:41:37 AM UTCNoneAttached File-=>Added TIRESV80.PFR, #10041

Back to the top


Powered by Savane 3.1-cleanup1