bugFree UCS Outline Fonts - Bugs: bug #23464, broken bounding boxes

 
 

bug #23464: broken bounding boxes

Submitted by:  Pablo Rodríguez <ousia>
Submitted on:  Mon 02 Jun 2008 09:17:21 PM UTC  
 
Category: font metricsSeverity: 3 - Normal
Item Group: letter positioning poorStatus: Need info
Privacy: PublicAssigned to: Steve White <Stevan_White>
Open/Closed: ClosedRelease: 2008-03-23

Add a New Comment(Rich Markup)
   

You are not logged in

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

 

Sun 19 Sep 2010 03:12:57 PM UTC, comment #5:

Let me know if there is anything further I can do on this point!

Steve White <Stevan_White>
Project AdministratorIn charge of this item.
Mon 09 Jun 2008 07:41:31 AM UTC, comment #4:

Matthais,

Good to hear from you!

You mention the "fmtx" structure, which, as I understand it, is an Apple Advanced Typography thing unsupported by FontForge, the program used to edit FreeFont.
http://fontforge.sourceforge.net/gposgsub.html#Unsupported
If this structure is populated at all, it is done in your system software, not in the font itself.

Determining vertical text placement based on the heights of characters of the string at hand is useful only in very special cases (it is likely to change for each string). I don't think it is right for the text box of your application.

Be aware that FreeFont has an overall line height set by (my) hand, because it contains some very high and low glyphs that would otherwise produce a very unpleasantly large line height. Most fonts don't have this problem, and the line height is just set to the font height. This setting changed between the 2006 and 2008 releases, because the 2006 version worked adequately in some applications and nowhere else. The 2008 one works in much more general environments.

This accounts for the change of behaviour of your application, but it should not have. If you were using the same metrics to measure the height as used in the other applications I tested (several on Linux, Windows, and Mac), it would only have resulted in a small change in the box height.

From what you say, I'm surprised that you ware working at such a low level to build applications. Unless there is a specific need, I usually rely on some third-party library's API for font metrics.

But it's your decision of course.

I haven't recently done such low-level applications programming with fonts, so I would have to look at the TrueType(/OpenType) docs to find out which is the appropriate structure for the overall font info. You might start here:
http://www.adobe.com/devnet/opentype/
But again, I would first look for a higher-level font API appropriate for your programming environment, that gives the correct metric values for any font.

If you would like, I could look at your code. Could you point me to the source file in question?

Cheers!

Steve White <Stevan_White>
Project AdministratorIn charge of this item.
Sun 08 Jun 2008 09:54:57 AM UTC, comment #3:

I admit I haven't looked at this issue too closely- however what I noticed was this:

I seem to get different values for ascend if I:
1.) query the font for it's "ascend" value (from the 'fmtx" table)
2.) calculate all glyph bounding boxes by myself, build the union of these bounding boxes (a.k.a. font bounding box) and use the ymin value of that bounding box as ascender.

I process fonts outlines using freetype.

It's perfectly possible that the problem is in my code and the font is fine- however I should point out that most applications which deal with fonts use freetype for rendering too, whose bitmap engine may not actually use the fmtx ascend value. (We should check the source of freetype here, I guess)

I'd be happy to look into this issue more closely, if that's required- in that case, contact me at kramm@quiss.org.

Matthias Kramm <kramm>
Fri 06 Jun 2008 06:38:07 AM UTC, comment #2:

Pablo,

I had another look at the problem example:
http://ousia.justfree.com/wrong-counters.swf

One sees the letters (from FreeSans, as I understand) drawn much too high in a text field, and chopped off at the top.

Given that the current version FreeSans displays properly in lots of other programs, I have to think the problem lies in the way the text in those counter boxes is drawn.

To achieve correct vertical placement of text in a box, the following works pretty much every time.

The box height ought to be the line height for the font. The text should be drawn starting at a y value offset from the top of the box given by the ascent of the font. (Because most drawing environments refer to the text baseline as the vertical origin.)

This should work for FreeSans as well as most other fonts.

Cheers!

Steve White <Stevan_White>
Project AdministratorIn charge of this item.
Tue 03 Jun 2008 10:50:28 PM UTC, comment #1:

Hi Pablo,

I would, I knew what was meant by "broken bounding boxes".
In what sense are the bounding boxes "broken"?

There was a change in the way the line height is determined.
This is probably what fouled up the application in question. As to who is "right", it is hard to say (the specfications are really poor on these points), but I can say that many other applications were badly challenged by the 2006 version.

If you can show me that other fonts behave like the 2006 version in this application, it might be helpful. You might ask Matthias on this list to explain to me how FreeSans is different from other similar fonts in this way. (Maybe he could write a technical bug report.)

In the other faces (Serif and Mono), I have been working to make the line height really agree with the font height, by surgery on some very high and low glyphs. But in Sans, the problem is the normal Roman glyph height so great, there is little room for accents, etc. I'm not sure how I'll handle that.

Thanks for your report!

Steve White <Stevan_White>
Project AdministratorIn charge of this item.
Mon 02 Jun 2008 09:17:21 PM UTC, original submission:

Hi there,

according to http://lists.gnu.org/archive/html/swftools-common/2008-06/msg00003.html , it seems that the latest release of (at least) the TrueType versions of FreeSans and FreeSansBold include broken bounding boxes.

Could you fix this?

I hope it helps,

Pablo

Pablo Rodríguez <ousia>

 

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

Attach File(s):
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by kramm (Posted a comment)
  • -unavailable- added by Stevan_White (Posted a comment)
  • -unavailable- added by ousia (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 5 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Sun 19 Sep 2010 03:12:57 PM UTCStevan_WhiteOpen/ClosedOpen=>Closed
    Tue 03 Jun 2008 10:50:28 PM UTCStevan_WhiteCategoryNone=>font metrics
      Item GroupNone=>letter positioning poor
      StatusNone=>Need info
      Assigned toNone=>Stevan_White

    Back to the top


    Powered by Savane 3.1-cleanup1