FT_New_Face called many time for same font.



Hi

I've been using Pango to render markup language, and one day when rendering a Chinese text (with a 8Mb font), I discovered that Pango seems to open the same font many times.

Upon startup of my application the font is opened 5 times, and later 4 more times. The final output from the process' smap file is:

8184 kb 620 kb 0 kb /home/jln/git/eclipse/src/ juno/fonts/CODE2000.TTF 8184 kb 620 kb 0 kb /home/jln/git/eclipse/src/ juno/fonts/CODE2000.TTF 8184 kb 620 kb 0 kb /home/jln/git/eclipse/src/ juno/fonts/CODE2000.TTF 8184 kb 620 kb 0 kb /home/jln/git/eclipse/src/ juno/fonts/CODE2000.TTF 8184 kb 620 kb 0 kb /home/jln/git/eclipse/src/ juno/fonts/CODE2000.TTF 8184 kb 620 kb 0 kb /home/jln/git/eclipse/src/ juno/fonts/CODE2000.TTF 8184 kb 620 kb 0 kb /home/jln/git/eclipse/src/ juno/fonts/CODE2000.TTF 8184 kb 620 kb 0 kb /home/jln/git/eclipse/src/ juno/fonts/CODE2000.TTF 8184 kb 620 kb 0 kb /home/jln/git/eclipse/src/ juno/fonts/CODE2000.TTF

The font is acquired by calling pango_fc_font_lock_face, which then calls FT_New_Face. I assume the font in turn should be free by calling pango_fc_font_unlock_face, however this function doesn't do anything.

The proper call for unloading fonts "FT_Done_Face" is called by pango_ft2_font_finalize. However atleast my program doesn't seem to trigger this at any point.

The goal of course is to use as little memory as possible, so what is supposed to call pango_ft2_font_finalize? Would other programs using Pango also open multiple instances of the same font?

I will keep on digging, but any pointers greatly appreciated.

I'm using Pango 1.20.5.

--
Jesper L. Nielsen
Senior Software Engineer @ 2M-Locatel



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]