Werner LEMBERG | 1 Sep 2005 23:49
Picon

Re: [ft] FreeType2 configuration


> I have a code which is using only a few FreeType2 functions for TTF fonts
> rendering:
> FT_Init_FreeType
> FT_Done_FreeType
> FT_Done_Face
> FT_New_Memory_Face
> FT_New_Face
> FT_Attach_File
> FT_Select_Charmap
> FT_Set_Char_Size
> FT_Set_Pixel_Sizes
> FT_Get_Char_Index
> FT_Load_Glyph
> FT_Render_Glyph
> 
> I'd like to statically link the library to my application so it has
> as small size as possible.  What minimal FreeType config would you
> suggest to achieve this?

What you describe is the standard interface of FreeType to be used
with any font.  What you don't say is what kind of fonts you actually
want to use!  Have a look into the file docs/INSTALL.ANY of the
currrent CVS to see which font drivers, renderers, and utility modules
are available.

    Werner
k04jg02 | 2 Sep 2005 00:32

[ft] Compiling freetype with VC++ 7,1 = automattic memory leak?

I'm using freetype for rendering fonts in an OpenGL app I'm working on,
and up until now I was using 2.1.8 from gnuwin32. But I wanted to use the 
library statically so I didn't have to ship DLLs too, so I downloaded the 
source for it and compiled it. Linking against it automatically caused
visual studio to complain it detected memory leaks. Changing back to the
precompiled version from gnuwin32 made it go away with no code changes. I 
figured it must be a bug, so I downloaded the 2.1.10 source -- same issue.

I don't think it's my code because the only difference between the
version where it finds leaks and the version where it doesn't is whether
I'm linking against my compiled version or the precompiled version from
gnuwin32. Any ideas?

Here's the output it gives me, even if I just try to print "Hello" in
Times font once on the screen:

Detected memory leaks!
Dumping objects ->
{4342} normal block at 0x013D9B28, 154 bytes long.
 Data: <                > D0 C0 C0 C0 C0 C0 C0 C0 C0 C0 D0 E0 00 00 00 00 
{4341} normal block at 0x013D9AB8, 52 bytes long.
 Data: < .;  #  stib    > D8 2E 3B 01 DC 23 95 00 73 74 69 62 00 00 11 00 
{4334} normal block at 0x013D6EA8, 33 bytes long.
 Data: <    i     s 0 1 > 19 AA C5 BA 69 0E 00 00 00 00 73 AC 30 00 31 A6 
{4333} normal block at 0x013D95E0, 52 bytes long.
 Data: < .;  #  stib    > D8 2E 3B 01 DC 23 95 00 73 74 69 62 00 00 0B 00 
{4326} normal block at 0x013D9520, 126 bytes long.
 Data: <      p      R  > 02 00 00 00 00 00 70 91 16 00 00 00 00 52 DF 18 
{4325} normal block at 0x013D94B0, 52 bytes long.
 Data: < .;  #  stib    > D8 2E 3B 01 DC 23 95 00 73 74 69 62 00 00 0B 00 
(Continue reading)

Werner LEMBERG | 2 Sep 2005 08:43
Picon

Re: [ft] FreeType2 configuration


> I need to use only TrueType fonts. I have checked the document you
> described...so doest i mean I should only compile the base
> components + TrueType driver?

Yes.

    Werner
Werner LEMBERG | 2 Sep 2005 09:43
Picon

Re: [SPAM?]: [ft] Compiling freetype with VC++ 7,1 = automattic memory leak?


> I'm using freetype for rendering fonts in an OpenGL app I'm working
> on, and up until now I was using 2.1.8 from gnuwin32.  But I wanted
> to use the library statically so I didn't have to ship DLLs too, so
> I downloaded the source for it and compiled it.  Linking against it
> automatically caused visual studio to complain it detected memory
> leaks.  [...]
>
> Any ideas?

No, sorry.  Perhaps you can run a program similar to `valgrind':

  http://www-306.ibm.com/software/awdtools/purify/win/

> Here's the output it gives me, [...]

Unfortunately, this isn't very helpful...

    Werner
Turner, David | 2 Sep 2005 10:15
Favicon

RE: [ft] Compiling freetype with VC++ 7,1 = automattic memory leak?

Hello,

FreeType 2 comes with a built-in memory debugger that
can be used to track leaked memory. More details are
available in the 'docs/DEBUG' file

Briefly, you need to:

  - #define FT_DEBUG_MEMORY  within your 'ftoption.h' file
  - then run the program with the environment variable
    FT2_DEBUG_MEMORY set to 1

the memory debugging information is only printed when
FreeType is closed, so nothing will appear if you put
a breakpoint or if your program crashes.

The leaked memory is only the one that was allocated within
FreeType. If your application leaks elsewhere, it will not
appear in the FT2 report !

Hope this helps,

- David Turner
- The FreeType Project  (www.freetype.org)

> -----Message d'origine-----
> De : freetype-bounces+dturner=nds.com <at> nongnu.org
> [mailto:freetype-bounces+dturner=nds.com <at> nongnu.org]De la part de
> k04jg02 <at> kzoo.edu
> Envoyé : vendredi 2 septembre 2005 00:32
(Continue reading)

Ole Marius Liabø | 2 Sep 2005 11:39
Picon

RE: [ft] Compiling freetype with VC++ 7,1 = automattic memory leak?


>Detected memory leaks!
>Dumping objects ->
>{4342} normal block at 0x013D9B28, 154 bytes long.
> Data: <                > D0 C0 C0 C0 C0 C0 C0 C0 C0 C0 D0 E0 00 00 00 00 


A MSVC tip that is useful if you want to find out who allocated the leaking memory: {4342} is the allocation
number. The allocation number is stored in the global variable _crtBreakAlloc. If you set
_crtBreakAlloc to 4342 in your debugger, your app will break when this allocation takes place. 

For more info see: 
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vsdebug/html/_core_Tracking_Heap_Allocation_Requests.asp


Ole

_______________________________________________
Freetype mailing list
Freetype <at> nongnu.org
http://lists.nongnu.org/mailman/listinfo/freetype
Michele Petrazzo | 2 Sep 2005 11:47
Picon

[ft] Tutorial example segmentation fault

I try to compile the example1.c found into the tutorial. It work well
until I use a very big character size like 1000 or bigger, but with
smaller size, it work well. With a debugger, I see that the problem is at:

image[j][i] |= bitmap->buffer[q * bitmap->width + p];

for example, if I execute the with the parameters:
FT_New_Face( library, "Arial.ttf", 0, &face )
FT_Set_Char_Size( face, 1500  * 64, 0, 96, 96 );
Character to write "K"

for ( i = x, p = 0; i < x_max; i++, p++ ) {
  for ( j = y, q = 0; j < y_max; j++, q++ ) {
   if ( i >= WIDTH || j >= HEIGHT )
         continue;
   image[j][i] |= bitmap->buffer[q * bitmap->width + p];
  }
}

it segfault on q = 58, p = 0, bitmap->width = 1233

It happen with all font file, like arial and vera on both my OS (win 2k
and linux)

Is there a solution?

Thanks,
Michele
Cyphre | 2 Sep 2005 11:34
Picon
Favicon

Re: [ft] FreeType2 configuration


>
> > I need to use only TrueType fonts. I have checked the document you
> > described...so doest i mean I should only compile the base
> > components + TrueType driver?
>
> Yes.
>
>

Thanks, I'll give it a try. One more question: Do you know the approximate
binary size of the library (for static compilation/linking) for my case of
usage? (I'd like to know this just for comparison of my result)

Richard
Werner LEMBERG | 2 Sep 2005 12:05
Picon

Re: [ft] FreeType2 configuration


> One more question: Do you know the approximate binary size of the
> library (for static compilation/linking) for my case of usage? (I'd
> like to know this just for comparison of my result)

I've no idea, sorry.

    Werner
Richard Smolak | 2 Sep 2005 00:36
Picon

Re: [ft] FreeType2 configuration


>
> > I have a code which is using only a few FreeType2 functions for TTF
fonts
> > rendering:
> > FT_Init_FreeType
> > FT_Done_FreeType
> > FT_Done_Face
> > FT_New_Memory_Face
> > FT_New_Face
> > FT_Attach_File
> > FT_Select_Charmap
> > FT_Set_Char_Size
> > FT_Set_Pixel_Sizes
> > FT_Get_Char_Index
> > FT_Load_Glyph
> > FT_Render_Glyph
> >
> > I'd like to statically link the library to my application so it has
> > as small size as possible.  What minimal FreeType config would you
> > suggest to achieve this?
>
> What you describe is the standard interface of FreeType to be used
> with any font.  What you don't say is what kind of fonts you actually
> want to use!  Have a look into the file docs/INSTALL.ANY of the
> currrent CVS to see which font drivers, renderers, and utility modules
> are available.
>
>

(Continue reading)


Gmane