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

Re: freetype libFL wrapper

To: Ang Bodhi <angbodhi@xxxxxxxxxxxxxx>
Subject: Re: freetype libFL wrapper
From: "Steve M. Robbins" <steven.robbins@xxxxxxxxxxxx>
Date: Mon, 20 Aug 2001 23:16:41 -0400
Cc: OpenInventor devel mailing list <info-inventor-dev@xxxxxxxxxxx>
In-reply-to: <3B715EB6.541C4F44@xxxxxxxxxxxxxx>
References: <20010730003206.H23031@xxxxxxxxxxxxxxxxxxxxxx> <3B715EB6.541C4F44@xxxxxxxxxxxxxx>
Sender: owner-info-inventor-dev@xxxxxxxxxxx
User-agent: Mutt/1.3.20i
On Wed, Aug 08, 2001 at 11:45:58PM +0800, Ang Bodhi wrote:
> Hi Steve,
> 
> I can't reproduce the problem you mentioned.
> 
> The font I link Utopia-Regular to: /usr/lib/X11/fonts/Type1/UTRG____.pfa

Me too.
 
> 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?

OK.  I inserted some tracing code in ang/flfreetype.c as
follows.

--- inventor-2.1.5-7.orig/libFL/ang/flfreetype.c
+++ inventor-2.1.5-7/libFL/ang/flfreetype.c
@@ -130,6 +130,8 @@
 {
   FLscalableBitmap *bit3;
 
+  TRACE(("unfinished code called"));
+
   /* TODO */
   bit3 = NULL;
 
@@ -202,6 +204,8 @@
   bbox_height = BM_TRUNC(face->bbox.yMax - face->bbox.yMin);
 
   if (glyph->format == ft_glyph_format_outline) {    
+    TRACE(("  creating bitmap from outline glyph\n"));
+
     pitch     = (width + 7) >> 3;
     size      = pitch * height; 
     pitch2    = ((width + (PIXEL_ROW_ALIGNMENT << 3) - 1) >> 5) << 2;
@@ -235,6 +239,7 @@
     free(bit2.buffer);
   }
   else {
+    TRACE(("  creating bitmap from non-outline glyph\n"));
     bit3->width     = glyph->bitmap.width;
     bit3->height    = glyph->bitmap.rows;
     bit3->xorig     = bearing_x;
@@ -243,6 +248,18 @@
     bit3->ymove     = 0.0;
     bit3->bitmap    = glyph->bitmap.buffer;
   }
+
+  /* debugging added by Steve, 2001-08-14 */
+  TRACE(("  glyph->metrics.horiBearingX = %d\n", glyph->metrics.horiBearingX));
+  TRACE(("  glyph->metrics.width = %d\n", glyph->metrics.width ));
+  TRACE(("  left = %d\n", left ));
+  TRACE(("  right = %d\n", right ));
+  TRACE(("  width = %d\n", width ));
+  TRACE(("  height = %d\n", height ));
+  TRACE(("  face->bbox.xMax = %d\n", face->bbox.xMax ));
+  TRACE(("  face->bbox.xMin = %d\n", face->bbox.xMin ));
+  TRACE(("  bit3->xmove = %d\n", bit3->xmove ));
+  TRACE(("  bbox_width = %d\n", bbox_width ));
 
   return bit3;
 }


With this installed, I ran "ivview" on the following file:

        #Inventor V2.0 ascii
        Text2 {
                string [ "a b" ]
        }

And here is what I see:

_flSearchFont: path=[/usr/share/inventor/fonts/Utopia-Regular]
flUniGetBitmap
_flFTUniGetBitmap: 0x004d
_flFTGetOutline: 'M'(0x004d)
_flFTNewGlyphChar: 'M'(0x4d), slot=0x80e8c38
_flFTLoadChar: c='M'(77), numVertices=37
_flFTGetBitmap: 'M'(0x004d)
  creating bitmap from outline glyph
  glyph->metrics.horiBearingX = 0
  glyph->metrics.width = 576
  left = 0
  right = 576
  width = 9
  height = 7
  face->bbox.xMax = 75890688
  face->bbox.xMin = -10354688
  bit3->xmove = 0
  bbox_width = 1347584
flUniGetBitmap
_flFTUniGetBitmap: 0x0061
_flFTGetOutline: 'a'(0x0061)
_flFTNewGlyphChar: 'a'(0x61), slot=0x80e8c38
_flFTLoadChar: c='a'(97), numVertices=26
_flFTGetBitmap: 'a'(0x0061)
  creating bitmap from outline glyph
  glyph->metrics.horiBearingX = 0
  glyph->metrics.width = 384
  left = 0
  right = 384
  width = 6
  height = 5
  face->bbox.xMax = 75890688
  face->bbox.xMin = -10354688
  bit3->xmove = 0
  bbox_width = 1347584
flUniGetBitmap
_flFTUniGetBitmap: 0x0020
_flFTGetOutline: ' '(0x0020)
_flFTNewGlyphChar: ' '(0x20), slot=0x80e8c38
_flFTLoadChar: c=' '(32), numVertices=0
_flFTGetBitmap: ' '(0x0020)
  creating bitmap from outline glyph
  glyph->metrics.horiBearingX = 0
  glyph->metrics.width = 0
  left = 0
  right = 0
  width = 0
  height = 0
  face->bbox.xMax = 75890688
  face->bbox.xMin = -10354688
  bit3->xmove = 0
  bbox_width = 1347584
flUniGetBitmap
_flFTUniGetBitmap: 0x0062
_flFTGetOutline: 'b'(0x0062)
_flFTNewGlyphChar: 'b'(0x62), slot=0x80e8c38
_flFTLoadChar: c='b'(98), numVertices=27
_flFTGetBitmap: 'b'(0x0062)
  creating bitmap from outline glyph
  glyph->metrics.horiBearingX = 0
  glyph->metrics.width = 384
  left = 0
  right = 384
  width = 6
  height = 8
  face->bbox.xMax = 75890688
  face->bbox.xMin = -10354688
  bit3->xmove = 0
  bbox_width = 1347584
flGetCurrentContext: ctx=0x80cbe28
flGetCurrentContext: ctx=0x80cbe28
flGetCurrentContext: ctx=0x80cbe28
flGetCurrentContext: ctx=0x80cbe28



So, it seems that the bbox "min" and "max" numbers are screwed up!
This must be a bug in the freetype library I have.  I am using Debian
("unstable") which has "post-2.0.2 freetype2-current as of
2001-05-14", whatever that means.  I'll contact the debian freetype
maintainer to see if he knows.

In the meantime, if you have any suggestions, I'm all ears!

Thanks,
-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>