[Top] [All Lists]

freetype libFL wrapper

To: OpenInventor devel mailing list <info-inventor-dev@xxxxxxxxxxx>
Subject: freetype libFL wrapper
From: "Steve M. Robbins" <steven.robbins@xxxxxxxxxxxx>
Date: Mon, 30 Jul 2001 00:32:06 -0400
Cc: angbodhi@xxxxxxxxxxxxxx
Sender: owner-info-inventor-dev@xxxxxxxxxxx
User-agent: Mutt/1.3.18i

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

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!


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>
  • freetype libFL wrapper, Steve M. Robbins <=