Re: [ft-devel] success?
> > >> But, even after setting all the metric values and bitmap, it is not > >> displaying a glyph in `ftview' and just displaying a blank output. > > Thanks to your new branch in `freetype2-demos' I can finally test the > GF+TFM combo... > > Assuming that you are running a GNU/Linux box: Have you ever used > `valgrind', as I've recommended to you a few times? > Yes I have :-), Also if you see the `cleaned' branch and debug it with `valgrind' you will find it completely error free. These errors by `valgrind' are reported after I changed the logic to load bitmaps on demand, and as reported by you because of the double free in `tfm module'. Sorry for that, I'll fix it :-) FT2_DEBUG=any:7 valgrind ./ftview 20 cmr10.600gf &> cmr10.600gf.log > > Doing this you can immediately see in `cmr10.600gf.log' that there is > a double free: > > ... > TFM_Read_Metrics: TFM Metric Information: > Check Sum : 1274110073 > Design Size: 10 > Begin Char : 0 > End Char : 127 > font_bbx_w : 10 > font_bbx_h : 10 > slant : 0 > Invalid read of size 8 > at 0x412F6D: FT_Stream_Free (ftobjs.c:251) > by 0x41718E: FT_Attach_Stream (ftobjs.c:2711) > by 0x417089: FT_Attach_File (ftobjs.c:2672) > by 0x40A756: my_face_requester (ftcommon.c:267) > by 0x4BC018: ftc_face_node_init (ftcmanag.c:243) > by 0x4BCD50: FTC_MruList_New (ftcmru.c:269) > by 0x4BC201: FTC_Manager_LookupFace (ftcmanag.c:325) > by 0x40B0FC: FTDemo_Set_Current_Font (ftcommon.c:551) > by 0x406FC4: event_font_change (ftview.c:1039) > by 0x408C10: main (ftview.c:1904) >Address 0x79a80c8 is 56 bytes inside a block of size 80 free'd > at 0x4C2B35C: free (in /usr/lib64/valgrind/vgpreload_ > memcheck-amd64-linux.so) > by 0x4DF876: ft_free (ftsystem.c:138) > by 0x42256C: ft_mem_free (ftutil.c:174) > by 0x4DDE84: tfm_close (tfmobjs.c:136) > by 0x47F8F1: TFM_Read_Metrics (gfdrivr.c:511) > by 0x417154: FT_Attach_Stream (ftobjs.c:2708) > by 0x417089: FT_Attach_File (ftobjs.c:2672) > by 0x40A756: my_face_requester (ftcommon.c:267) > by 0x4BC018: ftc_face_node_init (ftcmanag.c:243) > by 0x4BCD50: FTC_MruList_New (ftcmru.c:269) > by 0x4BC201: FTC_Manager_LookupFace (ftcmanag.c:325) > by 0x40B0FC: FTDemo_Set_Current_Font (ftcommon.c:551) >Block was alloc'd at > at 0x4C2A110: malloc (in /usr/lib64/valgrind/vgpreload_ > memcheck-amd64-linux.so) > by 0x4DF82B: ft_alloc (ftsystem.c:76) > by 0x42229F: ft_mem_qalloc (ftutil.c:76) > by 0x40: ft_mem_alloc (ftutil.c:55) > by 0x412E2C: FT_Stream_New (ftobjs.c:197) > by 0x41710B: FT_Attach_Stream (ftobjs.c:2698) > by 0x417089: FT_Attach_File (ftobjs.c:2672) > by 0x40A756: my_face_requester (ftcommon.c:267) > by 0x4BC018: ftc_face_node_init (ftcmanag.c:243) > by 0x4BCD50: FTC_MruList_New (ftcmru.c:269) > by 0x4BC201: FTC_Manager_LookupFace (ftcmanag.c:325) > by 0x40B0FC: FTDemo_Set_Current_Font (ftcommon.c:551) > > `FT_Attach_Stream' frees the stream passed as an argument to > `TFM_Read_Metrics' by itself. While you have modeled your code after > `afm_parser_init', you've missed that this function allocates a new > stream but your code doesn't. This means that in `tfm_close' you must > not close the stream since this happens later on. > Applying this fix > > diff --git a/src/tfm/tfmobjs.c b/src/tfm/tfmobjs.c > index 8cd3b5bf5..c03873e7a 100644 > --- a/src/tfm/tfmobjs.c > +++ b/src/tfm/tfmobjs.c > @@ -131,9 +131,10 @@ > FT_LOCAL( void ) > tfm_close( TFM_Parser parser ) > { > -FT_Memory memory = parser->memory; > +FT_UNUSED( parser ); > > -FT_FREE( parser->stream ); > + > +/* nothing */ > } > > helps. > Done! > > Note that there are still memory leaks in your driver. > > FT2_DEBUG=any:7 \ > valgrind --leak-check=full \ >--show-leak-kinds=all \ >./ftview 20 cmr10.600gf > > 80 bytes in 1 blocks are definitely lost in loss record 42 of 73 > at 0x4C2C240: calloc (in /usr/lib64/valgrind/vgpreload_ > memcheck-amd64-linux.so) > by 0x4DE498: tfm_parse_metrics (tfmobjs.c:282) > by 0x47F85E: TFM_Read_Metrics (gfdrivr.c:497) > by 0x417154: FT_Attach_Stream (ftobjs.c:2708) > by 0x417089: FT_Attach_File (ftobjs.c:2672) > by 0x40A756: my_face_requester (ftcommon.c:267) > by 0x4BC018: ftc_face_node_init (ftcmanag.c:243) > by 0x4BCD50: FTC_MruList_New (ftcmru.c:269) > by 0x4BC201: FTC_Manager_LookupFace (ftcmanag.c:325) > by 0x40B0FC: FTDemo_Set_Current_Font (ftcommon.c:551) > by 0x406FC4: event_font_change (ftview.c:1039) > by 0x408C10: main (ftview.c:1904) > > 128 bytes in 1 blocks are definitely lost in loss record 44 of 73 > at 0x4C2C240: calloc (in
Re: [ft-devel] success?
> FT2_DEBUG=any:7 valgrind ./ftview 20 cmr10.600gf &> cmr10.600gf.log For other people reading this I forgot to mention that you need `cmr10.tfm' in the same directory as `cmr10.600gf' to see the problems. Werner ___ Freetype-devel mailing list Freetype-devel@nongnu.org https://lists.nongnu.org/mailman/listinfo/freetype-devel
Re: [ft-devel] success?
>> But, even after setting all the metric values and bitmap, it is not >> displaying a glyph in `ftview' and just displaying a blank output. Thanks to your new branch in `freetype2-demos' I can finally test the GF+TFM combo... Assuming that you are running a GNU/Linux box: Have you ever used `valgrind', as I've recommended to you a few times? FT2_DEBUG=any:7 valgrind ./ftview 20 cmr10.600gf &> cmr10.600gf.log Doing this you can immediately see in `cmr10.600gf.log' that there is a double free: ... TFM_Read_Metrics: TFM Metric Information: Check Sum : 1274110073 Design Size: 10 Begin Char : 0 End Char : 127 font_bbx_w : 10 font_bbx_h : 10 slant : 0 Invalid read of size 8 at 0x412F6D: FT_Stream_Free (ftobjs.c:251) by 0x41718E: FT_Attach_Stream (ftobjs.c:2711) by 0x417089: FT_Attach_File (ftobjs.c:2672) by 0x40A756: my_face_requester (ftcommon.c:267) by 0x4BC018: ftc_face_node_init (ftcmanag.c:243) by 0x4BCD50: FTC_MruList_New (ftcmru.c:269) by 0x4BC201: FTC_Manager_LookupFace (ftcmanag.c:325) by 0x40B0FC: FTDemo_Set_Current_Font (ftcommon.c:551) by 0x406FC4: event_font_change (ftview.c:1039) by 0x408C10: main (ftview.c:1904) Address 0x79a80c8 is 56 bytes inside a block of size 80 free'd at 0x4C2B35C: free (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) by 0x4DF876: ft_free (ftsystem.c:138) by 0x42256C: ft_mem_free (ftutil.c:174) by 0x4DDE84: tfm_close (tfmobjs.c:136) by 0x47F8F1: TFM_Read_Metrics (gfdrivr.c:511) by 0x417154: FT_Attach_Stream (ftobjs.c:2708) by 0x417089: FT_Attach_File (ftobjs.c:2672) by 0x40A756: my_face_requester (ftcommon.c:267) by 0x4BC018: ftc_face_node_init (ftcmanag.c:243) by 0x4BCD50: FTC_MruList_New (ftcmru.c:269) by 0x4BC201: FTC_Manager_LookupFace (ftcmanag.c:325) by 0x40B0FC: FTDemo_Set_Current_Font (ftcommon.c:551) Block was alloc'd at at 0x4C2A110: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) by 0x4DF82B: ft_alloc (ftsystem.c:76) by 0x42229F: ft_mem_qalloc (ftutil.c:76) by 0x40: ft_mem_alloc (ftutil.c:55) by 0x412E2C: FT_Stream_New (ftobjs.c:197) by 0x41710B: FT_Attach_Stream (ftobjs.c:2698) by 0x417089: FT_Attach_File (ftobjs.c:2672) by 0x40A756: my_face_requester (ftcommon.c:267) by 0x4BC018: ftc_face_node_init (ftcmanag.c:243) by 0x4BCD50: FTC_MruList_New (ftcmru.c:269) by 0x4BC201: FTC_Manager_LookupFace (ftcmanag.c:325) by 0x40B0FC: FTDemo_Set_Current_Font (ftcommon.c:551) `FT_Attach_Stream' frees the stream passed as an argument to `TFM_Read_Metrics' by itself. While you have modeled your code after `afm_parser_init', you've missed that this function allocates a new stream but your code doesn't. This means that in `tfm_close' you must not close the stream since this happens later on. Applying this fix diff --git a/src/tfm/tfmobjs.c b/src/tfm/tfmobjs.c index 8cd3b5bf5..c03873e7a 100644 --- a/src/tfm/tfmobjs.c +++ b/src/tfm/tfmobjs.c @@ -131,9 +131,10 @@ FT_LOCAL( void ) tfm_close( TFM_Parser parser ) { -FT_Memory memory = parser->memory; +FT_UNUSED( parser ); -FT_FREE( parser->stream ); + +/* nothing */ } helps. Note that there are still memory leaks in your driver. FT2_DEBUG=any:7 \ valgrind --leak-check=full \ --show-leak-kinds=all \ ./ftview 20 cmr10.600gf 80 bytes in 1 blocks are definitely lost in loss record 42 of 73 at 0x4C2C240: calloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) by 0x4DE498: tfm_parse_metrics (tfmobjs.c:282) by 0x47F85E: TFM_Read_Metrics (gfdrivr.c:497) by 0x417154: FT_Attach_Stream (ftobjs.c:2708) by 0x417089: FT_Attach_File (ftobjs.c:2672) by 0x40A756: my_face_requester (ftcommon.c:267) by 0x4BC018: ftc_face_node_init (ftcmanag.c:243) by 0x4BCD50: FTC_MruList_New (ftcmru.c:269) by 0x4BC201: FTC_Manager_LookupFace (ftcmanag.c:325) by 0x40B0FC: FTDemo_Set_Current_Font (ftcommon.c:551) by 0x406FC4: event_font_change (ftview.c:1039) by 0x408C10: main (ftview.c:1904) 128 bytes in 1 blocks are definitely lost in loss record 44 of 73 at 0x4C2C240: calloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) by 0x4DE480: tfm_parse_metrics (tfmobjs.c:281) by 0x47F85E: TFM_Read_Metrics (gfdrivr.c:497) by 0x417154: FT_Attach_Stream (ftobjs.c:2708) by 0x417089: FT_Attach_File (ftobjs.c:2672) by 0x40A756: my_face_requester (ftcommon.c:267) by 0x4BC018: ftc_face_node_init (ftcmanag.c:243) by 0x4BCD50: FTC_MruList_New (ftcmru.c:269) by 0x4BC201: FTC_Manager_LookupFace (ftcmanag.c:325) by 0x40B0FC: FTDemo_Set_Current_Font (ftcommon.c:551) by 0x406FC4:
Re: [ft-devel] success with branch `kushal-work'
> On 14-Aug-2017, at 4:30 AM, Werner LEMBERGwrote: > > > Kushal, > > > finally, I had success! Attached is the script I'm using; it should > run out of the box (note the minor fixes to `make tests’). Awesome. Will update the script. > Regarding the HTML presentation, there is still a lot of room for > visual improvements. Given that GSoC ends soon, I ask you for new > commits :-) The HTML part is almost complete. I didn’t commit partly completed Code in this part. > In particular, you are generating sprites, but I don't see > them in action. Am I missing something? I have the code. Refining and fixing things. > BTW, I suggest that a glyph image appears magnified by a factor 10 or > so if the cursor hovers over it. What do you think Did it. Will update the same :) PS: Will update ASAP (in next 36 hrs) > >Werner > #!/bin/sh > # > # This script builds up an environment in the current directory for testing > # Kushal's font testing stuff. > # > # For building, we use the FreeType git repository. You also need GNU > # aclocal, autoconf, libtool, and GNU sed. > > > # The FreeType git repository URL. > FREETYPE_REPO=file:///home/wl/git/freetype/freetype2 > > > # > # Nothing to configure below. > # > > # Clean up, just to be sure. > rm -rf base > rm -rf test > > > # We check out and build version 2.6.5 as the baseline. > git clone --mirror $FREETYPE_REPO base/.git > cd base > git config --unset core.bare > git config receive.denyCurrentBranch updateInstead > git checkout -b VER-2-6-5 VER-2-6-5 > > # Activate subpixel rendering. > sed -i "s|/\* *\(#define *FT_CONFIG_OPTION_SUBPIXEL_RENDERING\) *\*/|\1|" \ > include/freetype/config/ftoption.h > > ./autogen.sh > ./configure --enable-shared --disable-static > make > > BASE_DLL=`pwd`/objs/.libs/libfreetype.so > > cd .. > > > # We test `master' against the baseline. > git clone --mirror $FREETYPE_REPO test/.git > cd test > git config --unset core.bare > git config receive.denyCurrentBranch updateInstead > git checkout -b kushal-work origin/kushal-work > > ./autogen.sh > ./configure --enable-shared --disable-static > make > > TEST_DLL=`pwd`/objs/.libs/libfreetype.so > > > # Build test program; ensure to not link statically with FreeType. > cd tests/make_png > make SRC_LIB= \ > OBJS= \ > LIBS="-lpng -ldl" \ > tests > > > # Run tests. > echo ./tests $BASE_DLL $TEST_DLL test.ttf 20 > ./tests $BASE_DLL $TEST_DLL test.ttf 20 > > cd .. > > # eof ___ Freetype-devel mailing list Freetype-devel@nongnu.org https://lists.nongnu.org/mailman/listinfo/freetype-devel