info-inventor-dev
[Top] [All Lists]

Re: freetype libFL wrapper

To: "Steve M. Robbins" <steven.robbins@xxxxxxxxxxxx>
Subject: Re: freetype libFL wrapper
From: Ang Bodhi <angbodhi@xxxxxxxxxxxxxx>
Date: Wed, 08 Aug 2001 23:45:58 +0800
Cc: OpenInventor devel mailing list <info-inventor-dev@xxxxxxxxxxx>
References: <20010730003206.H23031@xxxxxxxxxxxxxxxxxxxxxx>
Sender: owner-info-inventor-dev@xxxxxxxxxxx
Hi Steve,

I can't reproduce the problem you mentioned.

The font I link Utopia-Regular to: /usr/lib/X11/fonts/Type1/UTRG____.pfa

Running "ivview jackInTheBox.iv", I got the following values

_flFTGetBitmap: ' '(0x0020)
  glyph->horiBeringX=0, glyph->metrics.width=0
  left=0, right=0, width=0, height=0
  face->bbox.xMax=1158, face->bbox.xMin=-158
  bit3->xmove=10.000, bbox_width=20

With xmove = 10, the display looks Ok.

If you're still having the problem, can you please check the above
values?

Regards,
Ang Bodhi

"Steve M. Robbins" wrote:

> Hi,
>
> I'm compiling OpenInventor on linux, using "angbodhi"'s
> libFL wrapper library included in the inventor sources.
>
> If I run "ivview jackInTheBox.iv", absolutely nothing comes in the
> window.  However, if I remove the "string [...]" lines from the
> SoText2 node in the .iv file, it works.
>
> Eventually, I discovered that it is the space character that causes
> the problem.  With any SoText2 node, if the string is "abc", the text
> displays OK.  If I change the text to "a b", then the inventor window
> comes up blank.  [I'm using Utopia-Regular font, symlinked to
> /usr/lib/X11/fonts/Type1/UTRG____.pfa, a file that comes from xfree86
> 4.0.3.]
>
> After some poking around, I discovered something odd about the libFL
> wrapper.  If anyone can shed light on this, I'll be grateful.  In the
> file flfreetype.c, function _flFTGetBitmap(), there is code that
> creates a bitmap structure for outline fonts, something like:
>
>   ...
>   bbox_width  = BM_TRUNC(face->bbox.xMax - face->bbox.xMin);
>   ...
>     bit3->xmove     = width > 0 ? width : (bbox_width / 2.0);
>
> which seems quite reasonable.
>
> For the space character, both the height and width are zero, so the
> xmove field gets set to bbox_width/2.  For some reason, this value
> turns out to be outrageously large: something over 600,000.
>
> I changed the line to read
>
>     bit3->xmove     = width > 0 ? width : 10;
>
> and it "works" in that I can render SoText2 nodes with spaces in the
> string.  Clearly this is not the right fix.  Help!
>
> -Steve
>
> --
> by Rocket to the Moon,
> by Airplane to the Rocket,
> by Taxi to the Airport,
> by Frontdoor to the Taxi,
> by throwing back the blanket and laying down the legs ...
> - They Might Be Giants


<Prev in Thread] Current Thread [Next in Thread>